# NOT RUN {
##-- Copula types
copula3 <- 'frank'
##-- A real example
##-- One dataset from Prospective Research in Memory Clinics (PRIME) study
##-- Refer to article Brodaty et al (2014),
## the predictors of institutionalization of dementia patients over 3-year study period
data(PRIME)
surv<-as.matrix(PRIME[,1:3]) #time, event and dependent censoring indicators
cova<-as.matrix(PRIME[, -c(1:3)]) #covariates
colMeans(surv[,2:3]) #the proportions of event and dependent censoring
n<-dim(PRIME)[1];print(n)
p<-dim(PRIME)[2]-3;print(p)
names(PRIME)
##--MPL estimate Cox proportional hazard model for institutionalization under medium positive
##--dependent censoring
control <- coxph_mpl_dc.control(ordSp = 4,
binCount = 200, tie = 'Yes',
tau = 0.5, copula = copula3,
pent = 'penalty_mspl', smpart = 'REML',
penc = 'penalty_mspl', smparc = 'REML',
cat.smpar = 'No' )
coxMPLests_tau <- coxph_mpl_dc(surv=surv, cova=cova, control=control, )
plot(x = coxMPLests_tau, parameter = "theta", funtype="hazard",
xout = seq(0, 36, 0.01), se = TRUE,
cols=c("blue", "red"), ltys=c(1, 2), type="l", lwd=1, cex=1, cex.axis=1, cex.lab=1,
xlab="Time (Month)", ylab="Hazard",
xlim=c(0, 36), ylim=c(0, 0.05)
)
title("MPL Hazard", cex.main=1)
legend( 'topleft',legend = c( expression(tau==0.5), "95% Confidence Interval"),
col = c("blue", "red"),
lty = c(1, 2),
cex = 1)
plot(x = coxMPLests_tau, parameter = "theta", funtype="cumhazard",
xout = seq(0, 36, 0.01), se = TRUE,
cols=c("blue", "red"), ltys=c(1, 2),
type="l", lwd=1, cex=1, cex.axis=1, cex.lab=1,
xlab="Time (Month)", ylab="Hazard",
xlim=c(0, 36), ylim=c(0, 1.2)
)
title("MPL Cumulative Hazard", cex.main=1)
legend( 'topleft',
legend = c( expression(tau==0.5), "95% Confidence Interval"),
col = c("blue", "red"),
lty = c(1, 2),
cex = 1
)
plot(x = coxMPLests_tau, parameter = "theta", funtype="survival",
xout = seq(0, 36, 0.01), se = TRUE,
cols=c("blue", "red"), ltys=c(1, 2),
type="l", lwd=1, cex=1, cex.axis=1, cex.lab=1,
xlab="Time (Month)", ylab="Hazard",
xlim=c(0, 36), ylim=c(0, 1)
)
title("MPL Survival", cex.main=1)
legend( 'bottomleft',
legend = c( expression(tau==0.5), "95% Confidence Interval"),
col = c("blue", "red"),
lty = c(1, 2),
cex = 1
)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab