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

# st: RE: xtivreg2 and pweights

 From "Schaffer, Mark E" To Subject st: RE: xtivreg2 and pweights Date Mon, 27 Feb 2012 14:07:31 -0000

```Paulo,

pweights in -xtivreg2- are indeed equivalent to aweights+robust.  This
is also true for -ivreg2-, for which -xtivreg2- is a wrapper.

It's also true for various built-in Stata commands, starting with
-regress-.  That is,

regress y x [aw=w], rob

and

regress y x [pw=w]

generate the same output.

The point is that you can have different starting points and end up with
the same estimation.  You might use pweights because you have a survey
that includes such weights.  Or you might use aweights because you want
to do, say, WLS, but you add the robust option for robustness.  These
two motivations will lead you to the same estimation.

Cheers,
Mark

Here's the example using the toy dataset:

. regress mpg weight [aw=price], rob
(sum of wgt is   4.5623e+05)

Linear regression                                      Number of obs =
74
F(  1,    72) =
77.71
Prob > F      =
0.0000
R-squared     =
0.6323
Root MSE      =
3.4906

------------------------------------------------------------------------
------
|               Robust
mpg |      Coef.   Std. Err.      t    P>|t|     [95% Conf.
Interval]
-------------+----------------------------------------------------------
------
weight |   -.005496   .0006235    -8.82   0.000    -.0067389
-.0042532
_cons |    37.6987   2.052916    18.36   0.000     33.60629
41.79112
------------------------------------------------------------------------
------

. regress mpg weight [pw=price]
(sum of wgt is   4.5623e+05)

Linear regression                                      Number of obs =
74
F(  1,    72) =
77.71
Prob > F      =
0.0000
R-squared     =
0.6323
Root MSE      =
3.4906

------------------------------------------------------------------------
------
|               Robust
mpg |      Coef.   Std. Err.      t    P>|t|     [95% Conf.
Interval]
-------------+----------------------------------------------------------
------
weight |   -.005496   .0006235    -8.82   0.000    -.0067389
-.0042532
_cons |    37.6987   2.052916    18.36   0.000     33.60629
41.79112
------------------------------------------------------------------------
------

> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Paulo Regis
> Sent: 27 February 2012 13:20
> To: statalist@hsphsun2.harvard.edu
> Subject: st: xtivreg2 and pweights
>
> Hello Statalisters,
>
> Good day. I am using the command -xtivreg2, with a panel of
> 14 countries and 28 years. The panel is unbalanced because of
> some missign values in two of the variables. The number of
> observations per  country ranges from
> 21 to 28. Naming my variables Y, X1,..., X7, the command line
> looks like:
>
> xtivreg2 Y X2 X3 X4 (X1 = X5 X6 X7) , fe tvar(year) ivar(country) gmm2
> cluster(country)
>
> where the variable X1 is endogenous.
>
> The paper has been submited to a journal. One of the
> referees' comments was related to the unbalancedness and
> asked me to check the robustness to the use of weights. after
> going through the help files of xtivreg2, ivreg2 and weights
> in general in Stata,  I concluded I was looking for somethign
> like this:
>
> xtivreg2 Y X2 X3 X4 (X1 = X5 X6 X7) [pweight=wvar], fe tvar(year)
> ivar(country) gmm2 cluster(country)
>
> where wvar is the number of observation in the dataset of each coutry.
> That is, wvar assumes values from 21 to 28. The results look
> like what i expected (not much change), however, I got
> confused by a comment made in a resent post in statalist:
>
> http://www.stata.com/statalist/archive/2012-02/msg00776.html
>
> where it is mentioned that pweigths in xtivreg are just
> aweights+robust.
>
> My use of sampling weights is not motivated by a complex
> sampling design. My intention is to estimate a weighted least
> square model where the weights of each observaton is the
> inverse of the number of observations in each country, so
> that each country equally important and my results are not
> driven by some particular country. I still need to use IV
> because X2 is endogenous. Can xtivreg2 handle this sort of weights?
>
> Best wishes,
>
> Paulo
> *
> *   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/
>

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

Heriot-Watt University is the Sunday Times
Scottish University of the Year 2011-2012

*
*   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/
```