Page 1 of 1

time-varyinindividual covariates with unequal time intervals

PostPosted: Tue Nov 05, 2019 9:54 am
by mconner
Greetings:

I am having problems with time-varying individual covariate names when using unequal time intervals in the Huggins robust design. When I use a 1 for the time intervals all works fine, but when I change to unequal time intervals I get an error message (see below) and the design matrix is not what I want. The relevant parts of the code are followed by the error message and design matrix.

Is there some trick to using individual covariates with unequal time intervals? I read there is an older method of naming individual covariates – do I need to figure that out and use?

You can see I tried time.varying for the design matrix, but it worked the same as if I skipped that step.

Thanks for any advice. Cheers, Mary
********************************************************************************************************************

intervals = c(0,0.67,0,0,0,0.67,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0)

reg.rob.prevcap.processed=process.data(HCBT.robust.data,begin.time=1,model="RDHuggins",time.intervals=intervals)
design.p=list(time.varying=c("prevcap"))
design.parameters=list(p=design.p)
reg.rob.prevcap.ddl=make.design.data(reg.rob.prevcap.processed,parameter=design.parameters)

p.prevcap=list(formula=~prevcap)
reg.mod.wIC<-mark(reg.rob.prevcap.processed,reg.rob.prevcap.ddl,
model.parameters=list(S=Sdot, p=p.prevcap, c=cdot, GammaDblPrime=GammaDblPrime.0,
GammaPrime=GammaPrimedot),output=F,silent=T,filename=paste("WIC",sep=""))
Error message upon running model
The following covariates are missing: prevcap1.67
The following covariates are missing: prevcap2.34
The following covariates are missing: prevcap3.34
The following covariates are missing: prevcap4.34
The following covariates are missing: prevcap5.34
The following covariates are missing: prevcap6.34
The following covariates are missing: prevcap7.34
The following covariates are missing: prevcap8.34
The following covariates are missing: prevcap9.34

If any are used in the resulting model it will fail

Desing matrix
> reg.mod.wIC$design.matrix
S:(Intercept) p:(Intercept) p:prevcap c:(Intercept)
S g1 c1 a0 t1 "1" "0" "0" "0"
p g1 s1 t1 "0" "1" "prevcap1" "0"
p g1 s1.67 t1 "0" "1" "prevcap1.67" "0"
p g1 s2.34 t1 "0" "1" "prevcap2.34" "0"
p g1 s3.34 t1 "0" "1" "prevcap3.34" "0"
p g1 s4.34 t1 "0" "1" "prevcap4.34" "0"
p g1 s5.34 t1 "0" "1" "prevcap5.34" "0"
p g1 s6.34 t1 "0" "1" "prevcap6.34" "0"
p g1 s7.34 t1 "0" "1" "prevcap7.34" "0"
p g1 s8.34 t1 "0" "1" "prevcap8.34" "0"
p g1 s9.34 t1 "0" "1" "prevcap9.34" "0"
c g1 s1 t2 "0" "0" "0" "1"
Gamma'' g1 c1 a0 t1 "0" "0" "0" "0"
Gamma' g1 c1 a0.67 t1.67 "0" "0" "0" "0"

Re: time-varyinindividual covariates with unequal time inter

PostPosted: Tue Nov 05, 2019 2:54 pm
by jlaake
Mary

Time varying individual covariates have to be named to match the times. Yours must be named prevcap1, prevcap2, etc. That is fine for unit time intervals. But as it says yours should be named prevcap1, prevcap1.67, ...

Re: time-varyinindividual covariates with unequal time inter

PostPosted: Tue Nov 05, 2019 3:20 pm
by mconner
Mucho gracias Jeff. That is an easy fix (and I should have thought of trying it!).

Hopefully this will help someone else when they hit this issue.

Cheers, Mary