# [R] Help with repeated measures!

Andreas Nord andreas.nord at zooekol.lu.se
Tue Oct 16 15:36:12 CEST 2007

```Hello all,

I'm an R novice, recently trying to implement R in my research. Using the
data frame below, I want to construct a repeated measures model, with energy
expenditure (kjday) as dependent of treatment (code)
using mass as a covariate.

ind	mass	kjday	code
79	15.8	45.216	  3
42	16.5	44.64	  3
10	14.85	45.216	 3
206	15.75	45.216	 3
23	12.15	42.336	  3
5	14.6	51.264	   3
....
79	16.9	46.944	  5
42	16.6	44.352	  5
10	15.6	51.552	  5
206	15.5	45.504	  5
23	12.3	42.336	   5
5	13.9	42.624	   5

I'm not all to sure on how to perform the analysis, but I've used the
follwing code:

> library(nlme)
> summary(lme(kjday~code+mass,random=~1|ind))

To generate the following output:

Linear mixed-effects model fit by REML
Data: NULL
AIC    BIC      logLik
119.5274 124.75 -54.7637

Random effects:
Formula: ~1 | ind
(Intercept) Residual
StdDev: 0.0001336186 2.578544

Fixed effects: Kjday28 ~ code + mean.mass
Value        Std.Error DF   t-value p-value
(Intercept) 33.25184  6.123011 11  5.430634  0.0002
code        -0.10226  0.526522   10 -0.194218  0.8499
mean.mass  0.85440  0.387132 10  2.206988  0.0518
Correlation:
(Intr) code
code      -0.319
mean.mass -0.935 -0.026

Standardized Within-Group Residuals:
Min         Q1               Med         Q3          Max
-1.0292955 -0.4640126 -0.2943731  0.1448909  2.2666898

Number of Observations: 24
Number of Groups: 12

Am I on the right track here? If so, would I be able to use the same code on
a repeated model with
more covariates, looking something like "energy
expenditure~temperature+treatment(2 levels)+mass" again including "subject"
as a random factor.

Best regards,
Andreas Nord
--
View this message in context: http://www.nabble.com/Help-with-repeated-measures%21-tf4634251.html#a13233742
Sent from the R help mailing list archive at Nabble.com.

```