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

Re: st: What is wrong with the anova statement below?


From   [email protected]
To   [email protected]
Subject   Re: st: What is wrong with the anova statement below?
Date   Tue, 27 Aug 2002 14:29:51 -0500

Winston Banya <[email protected]> asks:

> I have a demonstration data set shown below. The design is that two
> observers paid two separate visits to each subject and made a measurement
> called q1 for illustration purpose only. I am interested in determining all
> the various components of the variance. i.e. between subjects, observer,
> visits and the within components as well. I have not used STATA to do this
> kind of analysis before so I followed the manual but received an error
> message as shown below. What did I get wrong and could someone please show
> me the correct way of getting what I want?
> 
> . tabdisp subject visit observer , cell(q1)
> 
> ------------------------------------
>           |    observer and visit   
>           | ---- 1 ---    ---- 2 ---
>   subject |    1     2       1     2
> ----------+-------------------------
>         1 |    7     5       8     9
>         2 |  6.7   8.9     6.9   7.4
>         3 | 12.3    11      13    16
>         4 |   12    11     7.8     9
>         5 |  6.9   6.4      12    13
>         6 |    8   6.8      11  13.2
>         7 |   16    15      10   9.8
>         8 |   12  11.4     9.9   8.4
>         9 |  8.2   7.8     7.6   6.9
>        10 |  7.2   8.5     5.6   6.1
> ------------------------------------
> 
> . anova q1 observer / visit | subject observer*subject , repeated(subject) 
> could not determine between-subject error term; use bse() option
> r(421);

My first comment is that "subject" is probably not the repeated
measures variable for your data.  Instead, I think that "subject"
is your basic experimental unit.  For each subject there are 4
measurements (2 "observer"s each with 2 "visit"s).  My guess is
that the -repeated()- option would be -repeated(observer visit)-.

And, since observer and visit have only 2 levels, and it does not
appear that you are using any terms involving the interaction of
the two, then there is no reason to use the -repeated()- option.
(With only two levels in a repeated measures variable the
correction epsilon is 1 -- i.e. no correction).

The rest of the model specification depends on what items are
fixed or random and the nature of the relationship between
"observer", "visit", and "subject" -- which factors are crossed
and which are nested.

For a single patient, did observer 1 and 2 both go together and
do visit 1 (making separate evaluations during this same visit)
and likewise for visit 2, or were there 4 visits for the patient,
2 of which were by observer 1, and 2 of which were by observer 2?

I would guess that the terms in your model **MIGHT** be

  subject                  9 df   (10 subjects - 1)
  visit|subject           10 df   ((2 visits - 1) * 10 subjects)
  observer                 1 df   (2 observers - 1)
  observer*subject         9 df   ((2 obs. - 1)*(10 sub. - 1))
  observer*visit|subject  10 df   ((2 obs. - 1)*(2 vis. - 1)* 10 sub.)

The last term would probably be omitted (and thereby become
"Residual" error) since otherwise you will have zero degrees of
freedom for residual error with all the terms included.

You could run

    anova q1 sub vis|sub obs obs*sub obs*vis|sub

or better

    anova q1 sub vis|sub obs obs*sub

letting the last term go into residual error.

I did not use "/" in the -anova- command, because without working
out the expected mean squares (EMS) for the model (which requires
knowing which terms are fixed and which are random etc.), I am
not sure which terms should be tested with which other terms in
the model.  You will need to work that detail out, and you can
use the -test- command after the -anova- to get whatever test
you desire.

If you haven't already seen the FAQ

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

you might want to look it over.  The FAQ points to the Winer,
Brown, and Michels book which you might find helpful in trying
to figure your EMS.

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