Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: Foreach Loop with anovaplot


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Foreach Loop with anovaplot
Date   Thu, 1 Oct 2009 18:30:39 +0100

-anovaplot- is a user-written command from SJ 4-4. Please remember to
say, as requested in the FAQ, whenever you are using a user-written
command and where it comes from. 

The error message indicates what the help for -anovaplot- explains: 

"With the second syntax [that used here: NJC], a varlist is supplied,
which must be a permutation of the predictors previously used."

So, the short answer is: Make sure your call to -anovaplot- is legal. 

I don't know, however, why you are using this second syntax at all. As
your loop is over 

anova <something> exam_nb clinic 

a call to -anovaplot- without specifying any variables at all would seem
to be what you want, i.e. -anovaplot-'s first syntax. 

Nick 
[email protected] 

Diego Bellavia

I am trying to build a simple script to loop into
some ANOVA for repeated measures tests and
graph them with anovaplot.

The script is the following:

#delimit ;

foreach X of varlist  age blood_p cholesterol...

{;
anova  `X' exam_nb clinic, repeated(exam_nb);
anovaplot exam_nb, scatter(msym(none));

};

#delimit cr

Where of course clinic is the ID of the subject, and exam_nb the ID of
the
single observation.
When  I run it as a command everything works fine but as soon as I put
this
in a .do file, I see the following message:

"exam_nb not a permutation of exam_nb clinic"

that  makes  sense to me but when I try to add clinic in the anovaplot
command I get some weird graph I cannot understand...


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



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index