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

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

 From Steven Samuels To statalist@hsphsun2.harvard.edu Subject Re: st: Using sampling/probability weights for mixed design ANOVA in STATA Date Wed, 15 Jun 2011 21:06:52 -0400

```Meg-

To answer your question, Example 17 in the Stata Manual entry for -anova- shows a repeated measures design with two within-subject factors.

But on further consideration, I don't think you will be able to emulate the -anova- calculations with -regress-, as you would have to calculated weighted mean squares, which are not available in the regression results.  Moreover, -anova- relies on assumptions, such as the absence of certain interactions, which might not be reasonable.

Since you have 110 subjects, you can still use -regress- directly and analyze hemisphere and time as within-subject effects. I should have realized this sooner, and I apologize..  Create a hemisphere variable coded 1 & 2.  (Strings for won't work for -regress-.)

Here is the code:

****************************
/* Main Effects */
regress brainvol  i.time i.sex i.hemisphere ///
[pweight = yourweight], vce(cluster subject)
/* Interactions */
regress brainvol i.time##i.sex i.time##i.hemisphere i.sex##i.hemisphere ///
[pweight = yourweight], vce(cluster subject)  // interactions
***************************

With the vce(cluster subject) option, -regress- will correctly identify time and hemisphere as within-subject factors

To compare to -anova- run the above without the [pweight=] option.

This approach ignores variability imposed by the sampling design and so from a sampling standpoint the standard errors will be incorrect. You can get an idea of how incorrect, by substituting "postcode" for "subject" in the vce() option.

Now the warning:  If you do not correct your probability weights for non-participation, you risk serious bias, except under conditions which cannot be tested.   You would be better off using no weights at all.  If you do not make such a correction, then whether you use probability weights or not, you will have to state that the children are not representative.

```