UCLA Academic Technology Services HomeServicesClassesContactJobs

Stata FAQ
How can I compute effect size in Stata for regression?

Two of the more common measures of effect size for regression analysis are eta2 and partial eta2. Eta2 is the proportion of the total variance that is attributed to an effect. Partial eta2 is the proportion of effect + error variance that is attributable to the effect. The formula differs from the eta squared formula in that the denominator includes the SSeffect plus the SSerror rather than the SStotal. regeffectsize is a program developed at UCLA to compute effects size for regression analysis. You can download the regeffectsize command by typing findit regeffectsize (seeHow can I use the findit command to search for programs and get additional help? for more information about using findit).

Once installed, you can type regeffectsize after using the regress command.  Below, we run an analysis using the hsb2 dataset.
use http://www.ats.ucla.edu/stat/data/hsb2, clear
	
xi: regress write female read math i.prog

i.prog            _Iprog_1-3          (naturally coded; _Iprog_1 omitted)

      Source |       SS       df       MS              Number of obs =     200
-------------+------------------------------           F(  5,   194) =   45.01
       Model |  9602.28627     5  1920.45725           Prob > F      =  0.0000
    Residual |  8276.58873   194  42.6628285           R-squared     =  0.5371
-------------+------------------------------           Adj R-squared =  0.5251
       Total |   17878.875   199   89.843593           Root MSE      =  6.5317

------------------------------------------------------------------------------
       write |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      female |   5.384982    .929572     5.79   0.000     3.551617    7.218346
        read |   .3069424   .0611262     5.02   0.000     .1863852    .4274996
        math |   .3603705   .0690064     5.22   0.000     .2242715    .4964695
    _Iprog_2 |    .436372   1.230379     0.35   0.723    -1.990265    2.863009
    _Iprog_3 |  -2.219748   1.359353    -1.63   0.104    -4.900756    .4612603
       _cons |   15.16272   3.225088     4.70   0.000     8.801985    21.52346
------------------------------------------------------------------------------

regeffectsize

Regression Effect Size

                            % change
variable       eta^2          eta^2     partial eta^2
female        .08007775    14.909991    .14747193
read          .06016839    11.202989    .11502405
math          .06507731    12.117       .1232518
_Iprog_2      .00030015    .055887      .00064797
_Iprog_3      .00636286    1.1847253    .01355852
If you want the effect size for the two degree of freedom test for the variable prog you need to run ANOVA, declaring read and math to be continuous, followed by the effectsize command, as shown below.
anova write female read math prog, continuous(read math)

                           Number of obs =     200     R-squared     =  0.5371
                           Root MSE      = 6.53168     Adj R-squared =  0.5251

                  Source |  Partial SS    df       MS           F     Prob > F
              -----------+----------------------------------------------------
                   Model |  9602.28627     5  1920.45725      45.01     0.0000
                         |
                  female |  1431.70003     1  1431.70003      33.56     0.0000
                    read |  1075.74304     1  1075.74304      25.21     0.0000
                    math |  1163.50906     1  1163.50906      27.27     0.0000
                    prog |  196.937627     2  98.4688136       2.31     0.1022
                         |
                Residual |  8276.58873   194  42.6628285   
              -----------+----------------------------------------------------
                   Total |   17878.875   199   89.843593   

effectsize prog

anova effect size for prog with dep var = write

total variance accounted for
omega2         = .00622781
eta2           = .0110151
Cohen's f      = .07916338

partial variance accounted for
partial omega2 = .01291181
partial eta2   = .02324152
To get the effectsize program type, findit effectsize, in Stata's command window.

How to cite this page

Report an error on this page

UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services


The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California.