I’m running a survival analysis using a cox mixed-effect proportional hazard model with time-varying covariates (using package and function coxme
in R).
My question is: does having multiple observations per individual constitute pseudo-replication?
One solution would be to make ‘individual’ a random effect. However, in my study many individuals (~50%) died during the first interval and were thus measured only once, so within-individual variation is limited to those individuals surviving multiple time periods (max 8 time periods in our study). Perhaps this doesn’t matter, as the model still converges?
See below example with 2 time-varying covariates (tvc1
& tvc2
), 1 time invariant covariate (sex
), and one random effect (randef
). Model coxme
is currently run without individual (id
) as a random effect. As you see, some individuals have multiple rows of data (which allows one to include multiple measurements of covariates). I’ve seen several other examples online using a similar set-up, but no one has mentioned the pseudo replication problem.
df <- data.frame(id=c(1,1,1,1,2,3,3,3,4,4,5,5,5,6,7,8,8,9,10,10),
start=c(1,10,20,30,1,1,10,20,1,10,1,10,20,1,1,1,10,1,1,10),
stop=c(9,19,29,39,9,9,19,29,9,19,9,19,29,9,9,9,19,9,9,19),
event=c(0,0,0,1,1,0,0,1,0,1,0,0,1,1,1,0,1,1,0,1),
sex=c(1,1,1,1,2,2,2,2,1,1,2,2,2,1,2,1,1,2,2,2),
tvc1=c(rnorm(20,0,1)),
tvc2=c(rnorm(20,5,2)),
randef=c(rep(1,10),rep(2,10))
)
mod <- coxme(Surv(start,stop,event)~sex+tvc1+tvc2+(1|randef), data=df)
summary(mod)