Some time ago, Rijo John wrote:
>> The robust option along with the _regress_ is not equivallant to doing a
>> GLS right? So appart from doing GLS as below is there a simple command
>> which does the job?
>>
>> regress depvar x1.... xk
>> predict e, residual
>> generate esq = e^ 2
>> regress esq x1.... xk
>> predict v
>> regress depvar x1.... xk [aweight = 1/v]
>>
>> [This is a feasible GLS estimation or feasible weighted least sqares
>> estimation]
To which I replied:
> Looks like WLS to me, which you can fit with rather less hassle by
> . xtreg y x1 x2 xk, be wls
> which gives you the 'between-effects' model. See -whelp xtreg- for more.
By complete accident, I've stumbled across a routine called -vwls- which
may (or may not) offer analysts in Rijo's position (and which was already
known by probably everybody else other than me). An example:
. use http://www.stata-press.com/data/r8/union.dta
(NLS Women 14-24 in 1968)
. reg grade south union black
Source | SS df MS Number of obs =
26200
-------------+------------------------------ F( 3, 26196) =
350.00
Model | 5872.46068 3 1957.48689 Prob > F =
0.0000
Residual | 146510.604 26196 5.59286167 R-squared =
0.0385
-------------+------------------------------ Adj R-squared =
0.0384
Total | 152383.065 26199 5.81636951 Root MSE =
2.3649
------------------------------------------------------------------------------
grade | Coef. Std. Err. t P>|t| [95% Conf.
Interval]
-------------+----------------------------------------------------------------
south | -.2972607 .0313338 -9.49 0.000 -.3586768
-.2358447
union | .4394292 .0358505 12.26 0.000 .3691603
.5096982
black | -.8524282 .0344127 -24.77 0.000 -.9198791
-.7849774
_cons | 13.02079 .0218004 597.27 0.000 12.97806
13.06352
------------------------------------------------------------------------------
. vwls grade south union black
Variance-weighted least-squares regression Number of obs =
26200
Goodness-of-fit chi2(4) = 46.18 Model chi2(3) =
946.33
Prob > chi2 = 0.0000 Prob > chi2 =
0.0000
------------------------------------------------------------------------------
grade | Coef. Std. Err. z P>|z| [95% Conf.
Interval]
-------------+----------------------------------------------------------------
south | -.2928383 .0312435 -9.37 0.000 -.3540744
-.2316022
union | .4392829 .0374729 11.72 0.000 .3658375
.5127284
black | -.8297906 .0339207 -24.46 0.000 -.8962739
-.7633073
_cons | 13.01281 .0204519 636.26 0.000 12.97272
13.05289
------------------------------------------------------------------------------
Note the similarity in parameters and standard errors when comparing
equations. Also, note that using -vwls-, one tends to obtain lower
standard errors than if we were to fit the same equation using -xtreg, be
wls- (go on: try it!). I'll be honest and say that I don't fully
understand why there are large differences, since both routines correct by
WLS. No doubt others are able to answer this.
But the important point was to flag up this routine for Rijo and others
who may find it useful. Also, the ability to access instantly some 80
datasets from within Stata 8 so that one can do exercises like this is a
quite astounding facility that should not go unsung.
CLIVE NICHOLAS |t: 0(044)191 222 5969
Politics |e: [email protected]
Newcastle University |http://www.ncl.ac.uk/geps
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/