coxed.npsf.tvc {coxed} | R Documentation |
Predict expected durations using the GAM method with time-varying covariates
Description
This function is called by coxed
and is not intended to be used by itself.
Usage
coxed.npsf.tvc(cox.model, newdata = NULL, coef = NULL, b.ind = NULL)
Arguments
cox.model |
The output from a Cox proportional hazards model estimated
with the |
newdata |
An optional data frame in which to look for variables with which to predict. If omitted, the fitted values are used |
coef |
A vector of new coefficients to replace the |
b.ind |
A vector of observation numbers to pass to the estimation sample to construct the a bootstrapped sample with replacement |
Details
This function employs the NPSF method of generating expected durations described
in Kropko and Harden (2018). See coxed.npsf
for details. This code
replicates the code for cox.npsf
, but works with data whose structure allows time-varying
covariates, and requires using the time2
argument of the Surv
function.
This function requires the data to be reported as cumulative durations. The cumulative baseline hazard
function model is estimated using the ending times for each interval. Then the expected durations are
drawn from the Cox model and the NPSF method as with coxed.npsf
.
Value
Returns a list containing the following components:
exp.dur | A vector of predicted mean durations for the estimation sample
if newdata is omitted, or else for the specified new data. |
baseline.functions | The estimated cumulative baseline hazard function and survivor function. |
Author(s)
Jonathan Kropko <jkropko@virginia.edu> and Jeffrey J. Harden <jharden2@nd.edu>
References
Kropko, J. and Harden, J. J. (2018). Beyond the Hazard Ratio: Generating Expected Durations from the Cox Proportional Hazards Model. British Journal of Political Science https://doi.org/10.1017/S000712341700045X
See Also
Examples
bs.surv <- Surv(time = boxsteffensmeier$start, time2 = boxsteffensmeier$te,
event = boxsteffensmeier$cut_hi)
bs.cox <- coxph(bs.surv ~ ec + dem + south + iv, data = boxsteffensmeier, method = "breslow")
ed <- coxed.npsf.tvc(bs.cox)
ed$exp.dur