[R] Problems with lm()
Hsin-Ya Lee
leeznar at yahoo.com.tw
Wed Jul 2 05:48:36 CEST 2008
Dear Dr. Dalgaard
Sorry for delay reply..
That's exactly what I was looking for - thanks a lot.
Hsin-Ya
Peter Dalgaard wrote:
>
> <oops, this got sent as reply to Andrew only>
>
> Andrew Robinson wrote:
>> In your data, subject is nested within sequence. Was that your
>> intention?
>>
>>
> Presumably yes. This looks like a standard cross-over design.
>
> I fail to see what the interaction between subject and sequence might
> mean, so I also have no idea what SPSS might have done. (The list does
> not allow .doc attachments).
>
> Since this is a balanced design, you can get almost the right analysis by
>
>> m <- lm(Max ~ sequence + subject + period +
> + drug, data=Data)
>> anova(m)
> Analysis of Variance Table
>
> Response: Max
> Df Sum Sq Mean Sq F value Pr(>F)
> sequence 1 585 585 0.0160 0.9014
> subject 12 634325 52860 1.4469 0.2660
> period 1 63175 63175 1.7293 0.2131
> drug 1 58149 58149 1.5917 0.2311
> Residuals 12 438395 36533
>
> in which you have to know that sequence is aliased with the drug:period
> interaction, AND that it needs to be compared with the intersubject
> variation. I.e. the F test is wrong and should be replaced with F=
> 585/52860 = 0.011on 1 and 12 df.
>
> However, a better way is
>
>> summary(aov(Max ~ period*drug + Error(subject), data=Data))
>
> Error: subject
> Df Sum Sq Mean Sq F value Pr(>F)
> period:drug 1 585 585 0.0111 0.918
> Residuals 12 634325 52860
>
> Error: Within
> Df Sum Sq Mean Sq F value Pr(>F)
> period 1 63175 63175 1.7293 0.2131
> drug 1 58149 58149 1.5917 0.2311
> Residuals 12 438395 36533
>
>
>
> --
> O__ ---- Peter Dalgaard Øster Farimagsgade 5, Entr.B
> c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
> (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
> ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
--
View this message in context: http://www.nabble.com/Problems-with-lm%28%29-tp17999900p18229758.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list