Re: [R] Problems with lm()

From: Hsin-Ya Lee <leeznar_at_yahoo.com.tw>
Date: Tue, 01 Jul 2008 20:48:36 -0700 (PDT)

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.

______________________________________________
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.
Received on Wed 02 Jul 2008 - 03:50:51 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 02 Jul 2008 - 08:32:01 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive