Re: [R] Problems with lm()

From: Peter Dalgaard <p.dalgaard_at_biostat.ku.dk>
Date: Sat, 21 Jun 2008 10:00:52 +0200

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))

```             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