[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: _robust and weights [WAS: ivreg2 results do not replicate from stata 9 to stata 11]

From   "Schaffer, Mark E" <>
To   <>
Subject   st: _robust and weights [WAS: ivreg2 results do not replicate from stata 9 to stata 11]
Date   Fri, 14 Aug 2009 13:35:20 +0100

Hi all.  I think I've traced this to an apparent change in behaviour of
the _robust command when used with weights between Stata 10 and Stata
11.  I'm using Stata IC running under Windows XP.

The change in behaviour of _robust can be demonstrated using -regress-
and the toy auto dataset, and the example in the on-line help for

Under Stata 10 (and probably earlier but I haven't checked), using
_robust and aweights or fweights replicates the results obtained with
-regress, robust-.  Under Stata 11, the results with -regress, robust-
are the same as Stata 10, but the results with _robust are different.

Here is the code that demonstrates:

sysuse auto
qui regress mpg weight gear_ratio foreign [aw=trunk], mse1
matrix D = e(V)
predict double e, residual
_robust e [aw=trunk], v(D) minus(4)
matrix list D
qui regress mpg weight gear_ratio foreign [aw=trunk], robust
mat list e(V)

The two VCVs are the same under Stata 10 but not under Stata 11.

The discrepancy is the same with fweights.  pweights are a bit different
because the VCVs obtained using the two methods aren't (supposed to be)
the same, but the Stata 10 VCV obtained with _robust and pweights is
different from that obtained with Stata 11's _robust and pweights.

I've reported this to Stata Tech Support, but in the meantime I'd be
curious to see if others see the same behaviour under other platforms.

Meanwhile ... users of -ivreg2- should not use weights + robust under
Stata 11 for now.  (-ranktest- is OK because it uses Mata rather than

Mark (-ivreg2- coauthor)

> -----Original Message-----
> From: 
> [] On Behalf Of Kit Baum
> Sent: 12 August 2009 21:06
> To:
> Subject: st: re: ivreg2 results do not replicate from stata 9 
> to stata 11
> <>
> Ray said
> I recently updated from Stata 9 to Stata 11. Using Stata 11, 
> I opened  
> the Stata 9 do-file and estimated the same ivreg2 command:    
>   ivreg2  
> depvar (endogenousvar= instrument1 instrument2) 
> controlvariables [aw=weight], first hascon robust 
> Surprisingly, the standard errors in Stata 11 were much 
> larger than in Stata 9, though the coefficient estimates were 
> unchanged.
> ivreg2 is a user-written program from SSC (it has been 
> published in the Stata Journal, but the latest version is 
> that on SSC) of Baum,  
> Schaffer, Stillman.   It has always been distributed with a  
> certification script (help cscript) which allows us to ensure 
> that its results are in accordance with those of ivreg2 and, 
> for Stata 10+, ivregress. I have updated the certification 
> script and run it on Stata 11.  I added a comparison of ivreg 
> and ivreg2 output with an [aw] expression near the top of the 
> script. When the [aw] are used with robust, there are small 
> differences in the e(V), which we will investigate.
> One question I would have is why you would use the hascons 
> option unless you also use the nocons option. hascons is 
> usually used to signal that you are providing your own 
> constant term (perhaps as a full set of dummies) and using 
> nocons to remove the constant term.
> Thanks
> Kit
> Kit Baum   |   Boston College Economics & DIW Berlin   |   
>                                An Introduction to Stata Programming   
> |
>     An Introduction to Modern Econometrics Using Stata  |   
> *
> *   For searches and help try:
> *
> *
> *

Heriot-Watt University is a Scottish charity
registered under charity number SC000278.

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index