[R-sig-ME] lme results unstructured covariance matrix

ben pelzer benpe|zer @end|ng |rom gm@||@com
Sat Jul 16 15:59:40 CEST 2022


Hi all,

I have a question about results from lme of package nlme.

Suppose the data consists of repeated measures at two fixed time points.

I used the following equation:



Model1 <- lme ( y ~ 1+t2 , random = ~ 0 + t1+t2|person, data=da)



y is the dependent, t1 and t2 are binary dummy variables, valued 0 or 1,
indicating the time point.  Model1 is estimated without any convergence
problems and the reproduced (co)variances found with



getVarCov(Model1, type=”marginal”, indivual=”1”)



are identical to the observed (co)variances.


My question is:  how can lme estimate 4 (co)variances with only 3 known
(co)variances?



The 4 estimates concern:

-          std. deviation of the random effect of dummy t1

-          std. deviation of the random effect of dummy t2

-          covariance of the random effects of the dummies t1 and t2 t1

-          residual std. error



Related to the question above: how can the variances of the random effects
and the residual std. error be interpreted?



Thanks for any help,



Ben.









I’m struggling with specifying a model in lme from the nlme package.



My data consists of two groups, say men and women. Each person is measured
three times at fixed occasions in time. I would like to estimate un
unstructured 3x3 (co)variance matrix for each group.  So these are the
variables involved:

dependent Y,

time (1, 2 or 3),

gender ( 0 or 1),

person “id” variable.



I also created dummy-indicator variable t1, t2 and t3 denoting the three
points in time.



This is the script to simulate the data:



set.seed(123456)



id <- rep(1:20,each=3)

time <- rep(c(1,2,3), 20)

t1 <- ifelse(time==1, 1, 0)

t2 <- ifelse(time==2, 1, 0)

t3 <- ifelse(time==3, 1, 0)

time <- factor(time)

gender <- rep(c(0,1), each=30)



# Add random person effect.

u <- c(rep(rnorm(10,0,2), each=3), rep(rnorm(10,0,4), each=3))

e <- c(rnorm(30,0,2), rnorm(30,0,3))



y <- 1 + 2*t2 + 5*t3 + 3*gender + u + e



da <- data.frame(id, time, t1, t2, t3, gender, y)



library(nlme)

model1 <- lme(y ~ t2 + t3 + gender, random = ~ 1 + time|id, da)

summary(model1)

	[[alternative HTML version deleted]]



More information about the R-sig-mixed-models mailing list