| coxHazardPureRisk {WeightCalibSurvival} | R Documentation |
Estimate pure risk from Cox proportional hazards model given a set of covariates.
coxHazardPureRisk(coxHazObj, newdata, risk.time, risk.time0=0,
new.risk.col="pureRisk")
coxHazObj |
A fitted model from addHazard. |
newdata |
Data frame for covariate-specific pure risk estimation. |
risk.time |
Projection time for pure risk. |
risk.time0 |
Initial projection time for pure risk. The default is 0. |
new.risk.col |
New column name added to |
The covariates used in coxHazObj must also be in newdata, and
they must be of the same type.
The data frame newdata with one additional column containing
the estimated pure risk.
Yei Eun Shin syeeun@gmail.com
Shin YE, Pfeiffer RM Graubard BI, Gail MH. Weight calibration to improve efficiency for estimating pure risks from the additive hazards model with the nested case-control design. Biometrics. 2020;1-13. https://doi.org/10.1111/biom.13413
data(sample_data, package="WeightCalibSurvival")
# Set the input arguments
ncc.subset <- sample_data[, "ind.ph2"]
outcome.var <- "ind.fail"
time.vars <- "eventime"
covars <- c("X1", "X2", "Z1", "Z2")
anc.covars <- "U"
risk.time <- 8
inclProb.var <- "incl.prob"
fit <- coxHazard(sample_data, ncc.subset, outcome.var, time.vars, covars,
anc.covars, risk.time, inclProb.var=inclProb.var)
newdata <- sample_data[ncc.subset, ]
ret <- coxHazardPureRisk(fit$with.calibration, newdata, risk.time)
ret[1:5, ]