[R] Summary statistics & plots of repeated measures data
Jay Pfaffman
pfaffman at relaxpc.com
Fri May 23 17:58:33 CEST 2003
I'm an R novice and my colleagues are about to convince me to get my
data into SPSS, which will presumably be easier for someone who
doesn't live in R to point and click his way into some kind of
analysis that might be meaningful.
I've got two groups of subjects (classkey in the table below).
They've each received several different treatments. One measure is a
1-7 rating taken several times per treatment (about 1-14 times per
session). studentkey, classkey, and treatment are factor()s.
The table looks something like this:
ete classkey studentkey treatment
1 7 4 108 bp1
2 4 4 117 bp1
3 6 4 120 bp1
4 6 4 105 bp1
5 3 4 100 bp1
6 3 4 100 bp1
7 4 4 107 bp1
8 3 4 100 bp1
9 7 4 107 bp1
10 4 4 107 bp1
I'd like to see the effects of each of the treatments for this
within-subject comparison. Repeated measures ANOVA seems like the
analysis I need. The results of
summary(lme(ete ~ treatment, data=allitems, random=~1 | studentkey,
subset=allitems$classkey==4))
follow, but I'm not quite sure what to make of them. In particular,
I'm very confused about the meanings of the numbers in the Value
column, as they bear no relation to the group means of the data in
each of those treatments.
Linear mixed-effects model fit by REML
Data: allitems
Subset: allitems$classkey == 4
AIC BIC logLik
2035 2065 -1011
Random effects:
Formula: ~1 | studentkey
(Intercept) Residual
StdDev: 1.39 1.58
Fixed effects: ete ~ treatment
Value Std.Error DF t-value p-value
(Intercept) 5.44 0.322 493 16.90 <.0001
treatmentbp2 -0.80 0.204 493 -3.95 1e-04
treatmentbprog1 -1.84 0.214 493 -8.61 <.0001
treatmentbs1 -2.17 0.291 493 -7.44 <.0001
treatmentbs2 -1.31 0.221 493 -5.91 <.0001
Correlation:
(Intr) trtmntbp2 trtmntbp1 trtmntbs1
treatmentbp2 -0.344
treatmentbprog1 -0.331 0.503
treatmentbs1 -0.239 0.385 0.342
treatmentbs2 -0.327 0.514 0.467 0.352
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-2.888 -0.666 0.102 0.722 2.341
Number of Observations: 521
Number of Groups: 24
I'm clearly misunderstanding something. This is very likely the type
of analysis I'll be doing for much of my career, I'd love to figure
out how to do it in R now. (I've got MASS3, & Dalgaard's Intro Stats
with R as well as various online documents. Pointers to relevant
sections therein would also be appreciated.)
Thanks.
--
Jay Pfaffman pfaffman at relaxpc.com
+1-415-821-7507 (H) +1-415-812-5047 (M)
More information about the R-help
mailing list