addHazard {WeightCalibSurvival} | R Documentation |
This function fits the additive hazards model with time-varying coefficients and time-invariant coefficients from a nested case-control study with or without weight calibration.
addHazard(data, ncc.subset, outcome.var, time.vars, timeDep.covars, timeIndep.covars, anc.covars, risk.time, risk.time0=0, nCntlPerCase=1, inclProb.var=NULL, nrisk.var=NULL, print=1, min.inclProb=1e-6, control=NULL)
data |
Data frame containing all the data for analysis. |
ncc.subset |
Logical vector giving the subjects in the nested case-control sample.
The length must be equal to the number of rows in |
outcome.var |
Binary outcome variable in |
time.vars |
One or two time-to-event variables in |
timeDep.covars |
Character vector of covariates with time-varying effects. |
timeIndep.covars |
Character vector of covariates with time-invariant effects. |
anc.covars |
NULL or a character vector of ancillary covariates used to impute missing
values of |
risk.time |
Projection time for pure risk. |
risk.time0 |
Initial projection time for pure risk. Only used |
nCntlPerCase |
Number of controls per case. The default is 1. |
inclProb.var |
NULL or a variable in |
nrisk.var |
NULL or a variable in |
print |
0 or 1 to print information. The default is 1. |
min.inclProb |
Positive value |
control |
See |
NOTE: If anc.covars = NULL
, then a seed must be set in order to reproduce
the results. See Step 1 below.
The algorithm is as follows:
Step 1: Obtain predictions for missing data
For any variable in timeDep.covars
and timeIndep.covars
with missing
data from phase 1,
fit a weighted generalized linear model among the nested case-control subjects (phase 2)
with that variable as the outcome adjusting for the
other covariates in timeDep.covars
, timeIndep.covars
and anc.covars
.
The weights in the model are the reciprocals of the inclusion probabilities (inclProb.var
).
If anc.covars = NULL
, then runif(nrow(data))
will be used as an ancillary
covariate.
Step 2: Create auxiliary statistics (influence functions)
Step 3: Calibrate the design weights
Step 4: Fit the additive hazards model with and without weight calibration.
A list containing two lists: with.calibration
and without.calibration
.
Each sublist contains the parameter estimates, standard errors, and other
objects needed to estimate pure risk using addHazardPureRisk
.
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" timeDep.covars <- c("X1", "X2") timeIndep.covars <- c("Z1", "Z2") anc.covars <- "U" risk.time <- 8 inclProb.var <- "incl.prob" nrisk.var <- "nrisk" addHazard(sample_data, ncc.subset, outcome.var, time.vars, timeDep.covars, timeIndep.covars, anc.covars, risk.time, inclProb.var=inclProb.var, nrisk.var=nrisk.var)