Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: Using sampling/probability weights for mixed design ANOVA in STATA


From   Steven Samuels <sjsamuels@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Using sampling/probability weights for mixed design ANOVA in STATA
Date   Tue, 31 May 2011 19:58:28 -0400

--

Meg, here's an example of how to do an -anova- analysis with a probability weight.  It exploits the fact that -anova- is equivalent to an ordinary multiple regression command (Stata -regress-, for example) and Stata's -regress- _will_ take a probability weight. The trick is to run -regress- without options after -anova-  to show the implied predictors that you need to put on the right hand side of the equation. You will need to prefix the categorical factors with "i.". The example is from the -anova- help illustration of a split-plot design:

*******START******************
log close
log using aovtest, replace text
webuse reading

anova score prog / class|prog skill prog#skill / class#skill|prog / group|class#skill|prog /, dropemptycells
regress   // 

//regression equivalent from -regress- statement after -anova-: add the "i." in front of the categorical variables

regress score i.prog i.class#i.prog i.skill i.program#i.skill ///
i.class#i.skill#i.program  i.group#i.class#i.skill#i.program

// regression with probability weight
set seed 4816033
gen finalwt =20*(uniform() +.05)  // weights>1

regress score i.prog i.class#i.prog i.skill i.program#i.skill ///
i.class#i.skill#i.program  i.group#i.class#i.skill#i.program, ///
pweight(finalwt)   // <--pweight option
*********END**************

Meg, 
I'm not sure that you should or can do a full-fledged survey analysis,


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index