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

# re: st: choice of ANOVA for an ecological experiment

 From "Airey, David C" <[email protected]> To "[email protected]" <[email protected]> Subject re: st: choice of ANOVA for an ecological experiment Date Mon, 31 Jan 2011 11:44:39 -0600

```.

/*

Actually, your problem sounds familar to
a problem I discussed once. I've changed terms below

animal = pond
neuron = enclosure
location = density

u + D_i + E_j + DE_ij + F_k(ij) + e_m(ijk)

u = grand mean
D = density (4 levels), density crossed with pond
E = pond (8 levels)
F = enclosure nested in D*E (3 enclosures in each D&E combination)
e = error (but m = 1 so that this term is empty)

With D fixed, E and F random, the appropriate F-tests are:

D        MS(D)/MS(D*E)
E        MS(E)/MS(F|D*E)
D*E      MS(D*E)/MS(F|D*E)
F|D*E    not available since no residual

You may have to figure out if you really want to consider ponds
as fixed effects. Are you doing the experiment to choose a pond
to work with later, or are you generalizing density of predation
to ponds in general? If you are stuck with 8 ponds as being
the only ponds you could use, that's a sticky problem for
ecologists, but I would still use pond as random even if
it is a convenience sample.

Regardless, talk to a statistician if you intend to actually
do this experiment, because you are putting fish lives in peril,
and you likely have to get regulatory approval.

*/

clear
set obs 96
egen pond = seq(), from(1) to(8) block(12)
egen density = seq(), from(1) to(4) block(3)
egen enclosure = seq(), from(1) to(96) block(1)
gen outcome = rnormal()
// collapse to a simple oneway repeated measures ANOVA
preserve
collapse (mean) outcome, by(pond density)
anova outcome pond density, repeated(density)
restore
// repeated measures ANOVA with replication...
anova outcome pond density pond#density enclosure|pond#density, dropemptycells
/* move enclosure|pond#density to residual */
anova outcome pond density pond#density
test density / pond#density

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```