Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: Household-fixed effect model with 50,000 hh

 From Shikha Sinha To statalist@hsphsun2.harvard.edu Subject Re: st: Household-fixed effect model with 50,000 hh Date Fri, 5 Nov 2010 18:42:54 -0400

```Dear Maarten,

I used xi and xtreg for comparing the results on a smaller sample. The
estimated coefficients are similar in both the approaches. However,
why the R-square is different in tow approaches. for example, in -xi
R-square is 0.0344, but in -xtreg it is 0.0247.

xi: reg literate treatvar scdum stdum femaledum i.yob
i.yob             _Iyob_1981-1997     (naturally coded; _Iyob_1981 omitted)

Source |       SS       df       MS              Number of obs = 1099940
-------------+------------------------------           F( 20,1099919) = 1956.49
Model |  5656.22324    20  282.811162           Prob > F      =  0.0000
Residual |  158993.3461099919   .14455005           R-squared     =  0.0344
Total |  164649.5691099939  .149689728           Root MSE      =   .3802

------------------------------------------------------------------------------
literate |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
treatvar |   .0096066   .0016626     5.78   0.000      .006348    .0128651
scdum |  -.0717236   .0009867   -72.69   0.000    -.0736574   -.0697897
stdum |  -.0833864   .0009866   -84.52   0.000    -.0853202   -.0814526
femaledum |  -.0917641   .0007255  -126.49   0.000     -.093186   -.0903422
_Iyob_1982 |  -.0715752    .003113   -22.99   0.000    -.0776765    -.065474
_Iyob_1983 |   .0077746   .0031037     2.50   0.012     .0016914    .0138578
_Iyob_1984 |  -.0441444   .0028554   -15.46   0.000    -.0497409    -.038548
_Iyob_1985 |   .0219268   .0030655     7.15   0.000     .0159185    .0279352
_Iyob_1986 |  -.0027881   .0029753    -0.94   0.349    -.0086196    .0030433
_Iyob_1987 |   .0129593   .0031674     4.09   0.000     .0067513    .0191672
_Iyob_1988 |   .0268027   .0033661     7.96   0.000     .0202052    .0334002
_Iyob_1989 |   .0364277   .0033757    10.79   0.000     .0298115    .0430439
_Iyob_1990 |   .0396838   .0033278    11.92   0.000     .0331614    .0462061
_Iyob_1991 |   .0736859   .0034076    21.62   0.000     .0670072    .0803646
_Iyob_1992 |   .0300572   .0032963     9.12   0.000     .0235966    .0365178
_Iyob_1993 |   .0589573   .0034205    17.24   0.000     .0522533    .0656614
_Iyob_1994 |  -.0018679   .0033077    -0.56   0.572    -.0083509    .0046151
_Iyob_1995 |  -.0353471   .0033853   -10.44   0.000    -.0419821   -.0287121
_Iyob_1996 |  -.0029324   .0035607    -0.82   0.410    -.0099113    .0040465
_Iyob_1997 |  -.0723428   .0036368   -19.89   0.000    -.0794708   -.0652148
_cons |   .8737828   .0026022   335.78   0.000     .8686825    .8788831
------------------------------------------------------------------------------

. xtset yob
panel variable:  yob (unbalanced)

. xtreg literate treatvar scdum stdum femaledum,fe

Fixed-effects (within) regression               Number of obs      =   1099940
Group variable: yob                             Number of groups   =        17

R-sq:  within  = 0.0235                         Obs per group: min =     21986
between = 0.2733                                        avg =   64702.4
overall = 0.0247                                        max =     94937

F(4,1099919)       =   6629.09
corr(u_i, Xb)  = 0.0407                         Prob > F           =    0.0000

------------------------------------------------------------------------------
literate |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
treatvar |   .0096066   .0016626     5.78   0.000      .006348    .0128651
scdum |  -.0717236   .0009867   -72.69   0.000    -.0736574   -.0697897
stdum |  -.0833864   .0009866   -84.52   0.000    -.0853202   -.0814526
femaledum |  -.0917641   .0007255  -126.49   0.000     -.093186   -.0903422
_cons |   .8813938   .0013269   664.25   0.000     .8787931    .8839944
-------------+----------------------------------------------------------------
sigma_u |  .04135333
sigma_e |  .38019738
rho |  .01169217   (fraction of variance due to u_i)
------------------------------------------------------------------------------
F test that all u_i=0:     F(16, 1099919) =   565.84         Prob > F = 0.0000

Thanks,
Shikha

On Thu, Nov 4, 2010 at 3:59 AM, Maarten buis <maartenbuis@yahoo.co.uk> wrote:
> --- On Wed, 3/11/10, Shikha Sinha wrote:
>> Let child ID is cid and household id is hhid and data are
>> child-level observation within the households, and I want
>> to estimate a household-fixed effect model, then What is
>> the difference among these three estimation or are they same?
>>
>> 1. xi: reg y x1 x2 i.hhid
>>
>> 2. sort cid hhid
>> tsset cid hhid
>> xtreg y x1 x2, fe
>>
>> 3. xi:xtreg y x1 x2 i.hhid, fe
>
> 1. is in principle ok, but you said earlier that your data
> contains too many households for Stata to be able to estimate
> that model.
>
> 2. is wrong for your purpose, you want to use -xtset- not
> -tsset-.
>
> 3. is wrong also, the whole point of -xtreg- is that that
> way you can avoid making those dummies.
>
>
>
> xtset hhid
> xtreg y x1 x2, fe
>
>
> Hope this helps,
> Maarten
>
> --------------------------
> Maarten L. Buis
> Institut fuer Soziologie
> Universitaet Tuebingen
> Wilhelmstrasse 36
> 72074 Tuebingen
> Germany
>
> http://www.maartenbuis.nl
> --------------------------
>
>
>
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```