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

Re: st: ANOVA model


From   [email protected]
To   [email protected]
Subject   Re: st: ANOVA model
Date   Sat, 28 Sep 2002 10:51:38 -0500

David Airey <[email protected]> asks:

> I am having trouble deciding on the right Stata command to estimate the 
> following ANOVA model:
> ----------------------------------------------------------------------
> Animal          1           2           3           4           5
>                /   \       /   \       /   \       /   \       /   \
> Location     1     2     1     2     1     2     1     2     1     2
>              / \   / \   / \   / \   / \   / \   / \   / \   / \   / \
> Neuron     01-03 04-06 07-10 11-12 13-15 16-18 19-21 22-24 25-27 28-30
> ----------------------------------------------------------------------
> 
> In this design, we have as sources of variation, different neurons 
> measured from the same location in the brain, different locations, and 
> different animals:
> 
> � = population mean
> a = animal effect
> l = location effect
> n = neuron effect <- this might just be in the error
> e = error
> 
> or the measure for a neuron Y = � + a + l + (n + e)
> 
> So I think I should have a fixed effect for location (we are interested 
> in the mean difference between locations and we assigned the locations) 
> and two random effects, one for animal, and one for replicate neurons 
> (random because we are not interested really in the mean differences 
> but just accounting for the variance and because they are animals or 
> neurons selected from a larger population, presumably with equal 
> probability). I am guessing I need to nest neuron in location and treat 
> animal as a random block effect, but at usual, can decide on the proper 
> test constructions.

Take a look at the example starting on page 46 of "[R] anova" in
the Version 7 reference manual.  Your model is almost the same.
In your case, since there are only two locations, you can ignore
the -repeated()- option since with only two levels the repeated
measures analysis produces the same results as without it.

You will end up with something like

    anova y a / n|a l / l*a /

What may be needed depending on exactly how your data are set up
is to reorganize your data in some way.  Here are the first 20
observations from the dataset used in the glucose example from
the manual.

    . use  http://www.stata-press.com/data/r7/glucose.dta
    (Brain Glucose Data)

    . list in 1/20

           glucose     region    subject        rep
      1.        73          1          1          1
      2.        75          1          1          2
      3.        77          1          1          3
      4.        80          1          1          4
      5.        72          2          1          1
      6.        78          2          1          2
      7.        70          2          1          3
      8.        69          2          1          4
      9.        93          3          1          1
     10.        92          3          1          2
     11.        91          3          1          3
     12.        83          3          1          4
     13.        74          1          2          1
     14.        63          1          2          2
     15.        67          1          2          3
     16.        68          1          2          4
     17.        72          2          2          1
     18.        75          2          2          2
     19.        66          2          2          3
     20.        67          2          2          4

Just a footnote.  You can find the datasets used in the manual by
going to

    http://www.stata-press.com/data/r7/

and you can -use- them directly in Stata as I demonstrated above.

Ken Higbee    [email protected]
StataCorp     1-800-STATAPC

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