[R] Treatment effects on measurements through time: how to tell when (in time) treatment has a significant effect?
Jim Lemon
jim at bitwrit.com.au
Thu Nov 7 01:18:25 CET 2013
On 11/07/2013 07:46 AM, c_e_cressler wrote:
> Hi,
>
> The data (attached) I am looking at consists of measurements of growth rate
> at different ages, for individuals in two treatments (control and infected).
> What I want to know is whether and when (what age) the growth rate of
> infected individuals is higher than the growth rate for control individuals.
>
> The simplest way to approach this question is to just do a t-test at each
> age, but because the growth rates at a given age depend on the growth rates
> at previous ages before, that seems statistically invalid. I have looked at
> some of the time series literature, but most of that seems more complicated
> than what I am trying to do. What I would like to be able to say is
> something like, "The growth rate of infected individuals is higher than
> control individuals for ages 18-30."
>
Hi Clay,
If you calculate the mean growth rates:
inf_mean<-apply(as.matrix(inf.grates),1,
mean,na.rm=TRUE)
cntl_mean<-apply(as.matrix(cntl.grates),1,
mean,na.rm=TRUE)
and plot them:
plot(cntl_mean,col=3)
points(inf_mean,col=2)
It looks like the growth rate in the infected group is consistently
greater. Testing the linear models:
summary(lm(cntl_mean~I(1:length(cnf_mean))))
summary(lm(inf_mean~I(1:length(inf_mean))))
looks like there is a significant effect. The proper comparison would be
a mixed model with the individual scores, I think.
Jim
More information about the R-help
mailing list