[R] ANOVA in R
ONKELINX, Thierry
Thierry.ONKELINX at inbo.be
Wed Feb 4 10:51:14 CET 2009
Dear Samor,
Note that the R-Sig-mixed-models is more suitable for that kind of questions.
You need to add "+", ":" or "*" between the variables in the formula
The correlation is lme() is not the same as the correlation in SAS. The correlation in lme() is the correlation among residuals, not among random effects. You need one of the pdClasses if you want to define the correlation among the random effects. Have a look at ?nlme::pdClasses
Hence your code should probably look like this
Model <- lme(response ~ seq + period + treat*time, random = pdCompSymm(form = ~1|SUB))
anova(Model)
HTH,
Thierry
----------------------------------------------------------------------------
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium
tel. + 32 54/436 185
Thierry.Onkelinx at inbo.be
www.inbo.be
To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of.
~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data.
~ Roger Brinner
The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey
-----Oorspronkelijk bericht-----
Van: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] Namens Samor Gandhi
Verzonden: woensdag 4 februari 2009 7:43
Aan: r-help at r-project.org
Onderwerp: [R] ANOVA in R
Hi,I'm using a repeated measures ANOVA in R using lme(). The SAS code would be:
PROC MIXED DATA=[data set below];
CLASS pid treat period time seq;
MODEL Y = seq period treat time treat*time;
REPEATED time / SUBJECT=pid TYPE=cs;
RUN, I donot have SAS, instead I have R and I would like to try the following:
anova(lme(response ~ seq period treat time treat*time,random= ~1|SUB, correlation=corCompSymm()))
Is this correct? Can I also write the model as
Y_ijklt = m + a_l + b_k + c_j + d_t + (cd)_jt + u_ijkltY_ijklt is the response variable due to pid i, treat j, period k, seq l, and time t. Thank you very much in advance for your help :)
Samor
[[alternative HTML version deleted]]
Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer
en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is
door een geldig ondertekend document. The views expressed in this message
and any annex are purely those of the writer and may not be regarded as stating
an official position of INBO, as long as the message is not confirmed by a duly
signed document.
More information about the R-help
mailing list