[R-sig-ME] Repeated measures with a non-linear time effect
Daniel Rubi
daniel_rubi at ymail.com
Thu Jul 21 20:13:23 CEST 2016
Hi,
I have repeated measures from two groups (treatment and control), three subjects in each, over three time points.
Here's the data in an R data.frame:df <- data.frame(subject=rep(c("T1","T2","T3","C1","C2","C3"),3), group=rep(c(rep("T",3),rep("C",3)),3), time=c(rep(1,6),rep(2,6),rep(3,6)), measure=c(0,253,155,16,232,251,1035,1014,760,98,239,87,371,60,47,0,260,190), col=rep(c(rep("red",3),rep("blue",3)),3), stringsAsFactors=F)
The plot shows the time x group interaction:
R code for producing the plot:
plot(df$time,df$measure,col=df$col,xlab="time",ylab="measure")
legend("topleft",legend=c("treatment","control"),col=c("red","blue"),pch=1)
My question is what model to use to capture the time x group interaction.
I thought:library(lmerTest)fit <- lmer(measure~time+group+time*group+(time|subject),data=df)
might do it.
But the summary of this model doesn't really capture that:> summary(fit)Linear mixed model fit by REMLt-tests use Satterthwaite approximations to degrees of freedom ['lmerMod']Formula: measure ~ time + group + time * group + (time | subject) Data: df
REML criterion at convergence: 210
Scaled residuals:
Min 1Q Median 3Q Max
-1.228 -0.448 -0.163 0.275 1.923
Random effects:
Groups Name Variance Std.Dev. Corr
subject (Intercept) 0.00e+00 0.00e+00
time 3.06e-16 1.75e-08 NaN
Residual 1.05e+05 3.25e+02
Number of obs: 18, groups: subject, 6
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 168.89 286.35 13.78 0.59 0.56
time -8.17 132.55 13.78 -0.06 0.95
groupT 218.33 404.96 13.78 0.54 0.60
time:groupT 19.83 187.46 13.78 0.11 0.92
Correlation of Fixed Effects:
(Intr) time groupT
time -0.926
groupT -0.707 0.655
time:groupT 0.655 -0.707 -0.926
So my question is what model to use?
Thanks a lot,Dan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Rplot.png
Type: image/png
Size: 4502 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-mixed-models/attachments/20160721/d988a14b/attachment.png>
More information about the R-sig-mixed-models
mailing list