if (require(carData)){
OBrienKaiserL <- reshapeW2L(OBrienKaiser, within=c("phase", "hour"),
levels=list(phase=c("pre", "post", "fup"), hour=1:5),
varying=list(score=c("pre.1", "pre.2", "pre.3", "pre.4", "pre.5",
"post.1", "post.2", "post.3", "post.4", "post.5",
"fup.1", "fup.2", "fup.3", "fup.4", "fup.5")))
brief(OBrienKaiserL, c(15, 15))
m1 <- Tapply(score ~ phase + hour + treatment + gender, mean, data=OBrienKaiserL)
m2 <- Tapply(score ~ phase + hour + treatment + gender, mean, data=OBrienKaiserLong)
all.equal(m1, m2) # should be equal
}
if (require(carData)){
OBrienKaiserL2 <- reshapeW2L(OBrienKaiser, within="phase",
levels=list(phase=c("pre", "post", "fup")),
ignore=c("pre.2", "pre.3", "pre.4", "pre.5",
"post.2", "post.3", "post.4", "post.5",
"fup.2", "fup.3", "fup.4", "fup.5"),
varying=list(score=c("pre.1", "post.1", "fup.1")))
brief(OBrienKaiserL2, c(6, 6))
m1 <- Tapply(score ~ phase + treatment + gender, mean, data=OBrienKaiserL2)
m2 <- Tapply(score ~ phase + treatment + gender, mean,
data=subset(OBrienKaiserLong, hour==1))
all.equal(m1, m2) # should be equal
}
Run the code above in your browser using DataLab