[R] Solution to "Can anyone help me reproduce this SAS Mixed output??"

Philip Turk turk at math.montana.edu
Wed Dec 24 19:28:19 CET 2003


To those who might be interested -- following is the solution to my
previous post regarding reproducing output from SAS Proc Mixed for a
two-factor crossed random effects ANOVA model.

I am graciously endebted to the kind replys from two statisticians for
this solution whose names I will refrain from mentioning for the sake of
privacy.

I hope this helps someone?!

-- Phil Turk

> hw7 <- read.table("C:/My Documents/Phil/S412/hw7.txt", header = TRUE)

> hw7

    mpg driver car obs
1  25.3      1   1   1
2  25.2      1   1   2
3  28.9      1   2   1
.    .       .   .   .
.    .       .   .   .
.    .       .   .   .
38 30.7      4   4   2
39 30.3      4   5   1
40 29.9      4   5   2

> attach(hw7)

> driver <- factor(driver)

> car <- factor(car)

> require(nlme)

> const <- factor(rep(1,40))

> hw7.lme <- lme(mpg~1, random=list(const=pdBlocked(list(~car-1,~driver-1,~car:driver-1),
                 pdClass="pdIdent")))

> VarCorr(hw7.lme)

> intervals(hw7.lme)

Phil Turk

Department of                   ____________
Mathematical Sciences          |            |           phone: (406)994-5357
2-235 Wilson Hall               \   BZN, MT |           FAX:   (406)994-1789
Montana State University         |  *_______|
Bozeman, MT 59717                 \_|          e-mail: turk at math.montana.edu




More information about the R-help mailing list