Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: adjust with pweight


From   [email protected]
To   [email protected]
Subject   Re: st: adjust with pweight
Date   Thu, 22 May 2003 09:57:19 -0500

Catherine Watt <[email protected]> asks:

> I am using svylogit followed by adjust, using pweights. When I try to set
> certain factors to the grand mean when using adjust, stata seems to be
> forgetting about the pweights.
>
> <cut>
>
> I tried the following commands:
> 
> logit y factor1 factor2 [pweight=w]
> adjust factor1, by(factor2)
> 
> The adjust results tell me that the average if factor 1 is 0.5, which it
> clearly isn't if one uses pweights (I calculate that it is 0.92)
> 
> Am I missing something? Perhaps for my "real" data I need to go through by
> hand to calculate the average value of each factor, and specify it myself.

-adjust- does not examine the weight from the estimation command
in setting factor1 (in your example) to its mean.  If you want to
have -adjust- produce predictions with factor1 set to its
weighted mean, you will have to use syntax such as

    . adjust factor1=.92, by(factor2)

You can use -svymean factor1- (after you have -svyset- your data)
to obtain the pweighted mean of factor1 that you then supply to
-adjust- (.92 in your example).  If you need to do this often,
then you might want to write a wrapper ado-file that automates
these steps.  If it were some other kind of weight (fweights,
iweights, or aweights), you could use -summarize- instead of
-svymean- to obtain the weighted mean.


Ken Higbee    [email protected]
StataCorp     1-800-STATAPC

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



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