### 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 hsbdemo dataset.
use http://www.ats.ucla.edu/stat/data/hsbdemo, clear

regress write i.female read math i.prog

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
Total |   17878.875   199   89.843593           Root MSE      =  6.5317

------------------------------------------------------------------------------
write |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
1.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
|
prog |
2  |    .436372   1.230379     0.35   0.723    -1.990265    2.863009
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
------------------------------------------------------------------------------
This is is a fine regression but unfortunately regeffectsize does not work with factor variables. We will need to convert our categorical variables to dummy variables. Actually, we don't need to convert female because is is already a zero/one variable but we will use the tab command to create dummies for prog which has three levels. Then we will rerun the regression.
tab prog, gen(p)

type of |
program |      Freq.     Percent        Cum.
------------+-----------------------------------
general |         45       22.50       22.50
vocation |         50       25.00      100.00
------------+-----------------------------------
Total |        200      100.00

regress write female read math p2 p3

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
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
p2 |    .436372   1.230379     0.35   0.723    -1.990265    2.863009
p3 |  -2.219748   1.359353    -1.63   0.104    -4.900756    .4612603
_cons |   15.16272   3.225088     4.70   0.000     8.801985    21.52346
------------------------------------------------------------------------------
Now we can run the regeffectsize command.
regeffectsize

Regression Effect Size

% change
variable                     eta^2          eta^2     partial eta^2
female                      .08007775     14.909991     .14747193
p3                          .00636286     1.1847253     .01355852