Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: repeated measures anova


From   David Airey <[email protected]>
To   [email protected]
Subject   Re: st: repeated measures anova
Date   Sun, 20 Jan 2008 12:57:25 -0600

.

A two factor within subjects repeated measures ANOVA with 700 subjects where each subject is exposed to conditions comprised of 2 levels of factor1 and three levels of factor2 is 4200 observations. To figure out the ANOVA design matrix size for this, follow this link:

http://www.stata.com/statalist/archive/2003-08/msg00276.html

I once thought about using ANOVA for big complicated data sets, but because of help from Ken's comments above, I simplified my design and moved analysis to mixed models. ANOVA is really good for small complicated experimental data sets, but the design matrix gets too large for large complicated experimental data sets with the fully parameterized model.

To see that Stata can run this design, try making a smaller data set that fits your model like this:

***
clear
set matsize 800 // Stata IC matsize maximum
local s 100 // You have 700!
local f1 2
local f2 3
local o = `s'*`f1'*`f2'
set obs `o'
egen subject = seq(), from(1) to(`s') block(6)
egen factor1 = seq(), from(1) to(`f1') block(3)
egen factor2 = seq(), from(1) to(`f2') block(1)
sort subject factor1 factor2
gen score = 10 + 2*invnorm(uniform())
list in 1/20
anova score subject factor1 / ///
subject*factor1 factor2 / ///
subject*factor2 factor1*factor2, ///
repeated(factor1 factor2)
***

Works fine. However, 700 subjects cannot be done using Stata IC. However, xtmixed should be able to handle this number of subjects, even with Stata IC.

http://www.ats.ucla.edu/stat/stata/faq/xtmixed.htm

Something like:

xi: xtmixed score i.factor1*i.factor2 || subject: || subject: R.factor1 || subject: R.factor2

may work, but ANOVA is using coding that makes comparisons to the grand mean whereas xi is using 1-0 coding.

When I try this, I get the following error:

"Hessian has become unstable or asymmetric"

If SPSS whips off this ANOVA instantly, why not use those results?

-Dave

On Jan 20, 2008, at 11:16 AM, Simon Moore wrote:


Dear Statalist,

I am working from the "No between-subjects factors with two repeated variables"
example from here:-

http://www.stata.com/support/faqs/stat/anova2.html#half713

and have specified a repeated measures anova which is nearly identical to the one in the example presented at stata.com...

anova score subject period / subject*period dial / subject*dial period*dial, repeated(period dial)

except that there are only two periods in my data (I have three 'dials', no between factors and just over 700 subjects). The anova will not run - or rather it does seem to run (_delete variables are appearing in the variable list) but I'm running out of patience after 45 mins. Whereas every other test I'm running on the same data is done in the blink of an eye and even SPSS can run this particular anova quickly. So... can anyone see if I have done something wrong, the actual command is:-

anova q id edir / id*edir elag / id*elag edir*elag, repeated(edir elag)

or if stata is just rather slow when it comes to anovas?

Many thanks
Simon



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