0
$\begingroup$

Estimating an OLS model with a single dummy variable in Stata, the constant is exactly equal to the mean of the dependent variable when the dummy is equal to 0.

When estimating an OLS model with two dummy variables in Stata, the constant is no longer exactly equal to the mean of the dependent variable when the dummies are set equal to 0.

Does any one know how Stata predicts the constant term in univariate and multiple regression?

$\endgroup$
  • $\begingroup$ There is precisely no Stata-specific issue here, just a question of the algebra of linear regression. $\endgroup$ – Nick Cox Jun 20 '13 at 12:06
1
$\begingroup$

For that to be true you also need to add the interaction term between your categorical variables:

. sysuse nlsw88, clear
(NLSW, 1988 extract)

. gen byte black = race == 2 if race < .

. reg wage i.married##i.black

      Source |       SS       df       MS              Number of obs =    2246
-------------+------------------------------           F(  3,  2242) =   11.89
       Model |  1164.52967     3  388.176556           Prob > F      =  0.0000
    Residual |  73203.4377  2242  32.6509535           R-squared     =  0.0157
-------------+------------------------------           Adj R-squared =  0.0143
       Total |  74367.9674  2245  33.1260434           Root MSE      =  5.7141

-------------------------------------------------------------------------------
         wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
--------------+----------------------------------------------------------------
    1.married |  -1.183104   .3064573    -3.86   0.000    -1.784074   -.5821341
      1.black |  -2.186919   .4142801    -5.28   0.000    -2.999332   -1.374506
              |
married#black |
         1 1  |   1.417616   .5645766     2.51   0.012     .3104682    2.524763
              |
        _cons |    8.92126   .2568298    34.74   0.000     8.417611    9.424909
-------------------------------------------------------------------------------

. sum wage if married == 0 & black == 0

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
        wage |       495     8.92126    6.975082   1.545893   40.19808
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.