data(multcif);
multcif$cause[multcif$cause==0] <- 2
zyg <- rep(rbinom(200,1,0.5),each=2)
theta.des <- model.matrix(~-1+factor(zyg))
times=seq(0.05,1,by=0.05) # to speed up computations use only these time-points
add<-comp.risk(Surv(time,cause>0)~+1+cluster(id),data=multcif,causeS=1,
multcif$cause,n.sim=0,times=times,model="fg",max.clust=NULL)
add2<-comp.risk(Surv(time,cause>0)~+1+cluster(id),data=multcif,causeS=2,
multcif$cause,n.sim=0,times=times,model="fg",max.clust=NULL)
out1<-cor.cif(add,data=multcif,cause1=1,cause2=1)
summary(out1)
out2<-cor.cif(add,data=multcif,cause1=1,cause2=1,theta.des=theta.des)
summary(out2)
out3<-cor.cif(add,data=multcif,cause1=1,cause2=2,cif2=add2)
summary(out3)
###########################################################
# investigating further models using parfunc and dparfunc
###########################################################
#functd<-function(theta,t,x) { xt=theta[1]+theta[2]*(t-0.5); return(xt) };
#dfunctd<-function(theta,t,x) { return(c(x[1],(t-0.5))) };
#library(compiler) # using the compiler library to speed up things
#f=cmpfun(functd)
#df=cmpfun(dfunctd)
#out4<-cor.cif(add,data=multcif,multcif$cause,
#parfunc=f,dparfunc=df,
#cause1=1,cause2=1,cens.model="KM",clusters=multcif$id,theta=log(2+1),
#theta.des=theta.des,colnames=c("intercept","slope"))
#summary(out4)
###out4<-cor.cif(add,data=multcif,parfunc=functd,dparfunc=dfunctd,
### cause1=1,cause2=1,cens.model="KM",theta=log(2+1),
### theta.des=theta.des,colnames=c("intercept","slope"),dimpar=2)
###summary(out4)
## no indication of timetrend in cross-odds-ratio
Run the code above in your browser using DataLab