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

st: RE: RE: Adjusted means and proportion for Survey data


From   "Nick Winter" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: Adjusted means and proportion for Survey data
Date   Thu, 19 Dec 2002 08:42:43 -0500

> -----Original Message-----
> From: Lee Sieswerda [mailto:[email protected]] 
> Sent: Wednesday, December 18, 2002 5:19 PM
> To: '[email protected]'
> Subject: st: RE: Adjusted means and proportion for Survey data
> 
> 
> Judging by the code, -adjmean- and -adjprop- don't work with 
> survey data
> because they are programmed to re-estimate a non-svy linear 
> regression based
> on the arguments that you supply. As a 5-o'clock quickie, you 
> might try
> calculating the adjusted mean the old-fashioned way. For example:
> 
> <svyset this and that>
> svymean mpg
> local mpgmean = _b[mpg]
> svyreg price mpg foreign
> 
> * mean of price, by foreign, adjusted for mpg
> di _b[_cons] + (_b[mpg]*`mpgmean') + (_b[foreign]*1)
> di _b[_cons] + (_b[mpg]*`mpgmean') + (_b[foreign]*0)
> 
> The same logic applies to -adjprop-, only using logistic 
> regression rather
> than linear regression.
> 
> Of course, the little exercise above doesn't do all of the 
> nice things that
> -adjmean- does, like graphs and confidence intervals. It may 
> or may not be
> easy to alter -adjmean- to run -svyreg- rather than 
> -regress-. It would make
> a potentially interesting project. However, The Two Towers 
> opens tonight
> where I live and I'm going, so no working on code for me tonight!
> 
> Regards,
> Lee

Another approach would be to use -adjust- after -svyreg-.  -adjust- will
print confidence intervals and standard errors of the predictions, tho
not graphs.  

	. svyreg price mpg foreign
	. svymean mpg if e(sample)
	. local mpgmean=_b[mpg]
	. adjust mpg=`mpgmean', by(foreign) se ci

--Nick Winter

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