data(ipd.data)
data(meta.data)
#SHARED COVARIATE ~TRT+X
#SURV BASELINE HAZARD COMPONENT OF MODEL ~LOG(TIME)
fit <- coxmeta.fixed(
Surv(time,event)~trt,surv~log(time)+trt,
ipd.data,
meta.data,
meta.data$sigma2,
meta.data$sub.group,
beta.ipd = runif(1),
beta.ad = c(1,0,runif(1)),
)
fit$coef #MODEL FIT
sqrt(diag(fit$var)) #STANDARD ERROR
###SEPARATION OF STUDY-LEVEL AND PATIENT-LEVEL COVARIATE
ipd.data$x.bar <-
rep(tapply(ipd.data$x,ipd.data$group,mean),table(ipd.data$group))
ipd.data$x.c <- ipd.data$x-ipd.data$x.bar
meta.data$x.bar <- meta.data$x
fit <- coxmeta.fixed(
Surv(time,event)~trt+x.c+x.bar,surv~log(time)+trt+x.bar,
ipd.data,
meta.data,
meta.data$sigma2,
meta.data$sub.group,
beta.ipd = runif(3),
beta.ad = c(1,0,runif(2)),
)
fit$coef #MODEL FIT
sqrt(diag(fit$var)) #STANDARD ERROR
Run the code above in your browser using DataLab