# [R] lme problem

Milos Zarkovic mzarkov at EUnet.yu
Tue Apr 12 16:40:53 CEST 2005

```Sorry for the long letter!

I have recently started using R. For the start I have tried to
repeat examples from Milliken &  Johnson "Analysis of
Messy Data - Analysis of Covariance", but I can not replicate
it in R. The example is chocolate chip experiment. Response
variable vas time to dissolve chocolate chip in seconds (time),
covariate was time to dissolve butterscotch chip (bstime), and
type was a type of chocolate chip. Problem is that I obtain
different degrees of freedom compared to one in the book.
Could it be sum of squares problem (type III vs. type I)?
Milliken & Johnson use SAS for calculations and this
is program the used:

proc mixed data=mmacov method=type3; class type;
model time=type bstime*type/solution noint.

My R code is:

LME.1=lme(time~bstime:type+type-1,data=CCE,random=~1|type)

and summary is:

Value Std.Error DF
t-value        p-value
typeBlue M&M                18.0     18.5         0         0.97
NaN
typeButton                        21.6     14.1         0         1.53
NaN
typeChoc Chip                 16.9     17.7         0         0.96
NaN
typeRed M&M                26.6     16.0         0         1.66
NaN
typeSmall M&M              22.2     30.5         0         0.73
NaN
typeSnow Cap                 8.7       13.1         0         0.67
NaN
bstime:typeBlue M&M     1.1       0.6         24         1.72
0.098
bstime:typeButton             1.3       0.4         24         3.57
0.002
bstime:typeChoc Chip      1.2       0.7         24         1.60
0.123
bstime:typeRed M&M     0.5       0.6         24         0.95
0.350
bstime:typeSmall M&M   0.2      1.0          24         0.19
0.848
bstime:typeSnow Cap      0.9      0.4          24         2.25
0.034

However in Milliken & Johnson all df are 23. Values (estimates) are almost
identical, but there are some small differences in SE and t.

Using

anova(LME.1)

I obtain

numDF     denDF       F-value         p-value
type                    6              0             18.19             NaN
bstime:type         6            24               4.04              0.0061

but in the book it is:

numDF     denDF      F-value         p-value
type                    6             23               2.00
0.1075
bstime:type         6             23               4.04              0.0066

Data are at the end of the letter.

I am not sure what I did wrong.

Sincerely,

Milos Zarkovic

******************************************************
Milos Zarkovic MD, Ph.D.
Associate Professor of Internal Medicine
Institute of Endocrinology
Dr Subotica 13
Serbia

Tel +381-63-202-925
Fax +381-11-685-357

Email mzarkov at eunet.yu
******************************************************

type,person,bstime,time
Button,1,27,53
Choc Chip,2,17,36
Blue M&M,3,28,60
Blue M&M,4,30,45
Red M&M,5,20,30
Choc Chip,6,29,51
Small M&M,7,30,25
Button,8,16,47
Small M&M,9,32,25
Blue M&M,10,19,38
Blue M&M,11,33,48
Button,12,19,39
Snow Cap,13,15,20
Blue M&M,14,19,34
Choc Chip,15,20,40
Blue M&M,16,24,42
Snow Cap,17,21,29
Button,18,35,90
Red M&M,19,35,45
Small M&M,20,30,33
Button,21,34,65
Button,22,40,58
Small M&M,23,22,26
Snow Cap,24,16,23
Button,25,28,72
Blue M&M,26,25,48
Choc Chip,27,14,34
Button,28,23,45
Snow Cap,28,40,44
Blue M&M,30,28,48
Snow Cap,31,19,26
Snow Cap,32,21,29
Small M&M,33,32,30
Red M&M,34,16,32
Red M&M,35,19,47

```