Simulates relative hazards, first differences, hazard ratios,
and hazard rates for linear, nontime interacted covariates from Cox
Proportional Hazard models. These can be plotted with simGG
.
1 2 3 
obj 
a 
b 
character string name of the coefficient you would like to simulate. 
qi 
quantity of interest to simulate. Values can be

Xj 
numeric vector of fitted values for 
Xl 
numeric vector of values to compare 
means 
logical, whether or not to use the mean values to fit the
hazard rate for covaraiates other than 
nsim 
the number of simulations to run per value of X. Default is

ci 
the proportion of simulations to keep. The default is

spin 
logical, whether or not to keep only the shortest probability interval rather than the middle simulations. Currently not supported for Hazard Rates. 
extremesDrop 
logical whether or not to drop simulated quantity of
interest values that are 
coxsimLinear
simulates relative hazards, first differences, and
hazard ratios for linear covariates that are not interacted with time or
nonlinearly transformed from models estimated with coxph
using
the multivariate normal distribution. These can be plotted with
simGG
.
a simlinear
, coxsim
object
Gandrud, Christopher. 2015. simPH: An R Package for Illustrating Estimates from Cox Proportional Hazard Models Including for Interactive and Nonlinear Effects. Journal of Statistical Software. 65(3)120.
Licht, Amanda A. 2011. ”Change Comes with Time: Substantive Interpretation of Nonproportional Hazards in Event History Analysis.” Political Analysis 19: 22743.
King, Gary, Michael Tomz, and Jason Wittenberg. 2000. ”Making the Most of Statistical Analyses: Improving Interpretation and Presentation.” American Journal of Political Science 44(2): 34761.
Liu, Ying, Andrew Gelman, and Tian Zheng. 2013. ”SimulationEfficient Shortest Probability Intervals.” Arvix. http://arxiv.org/pdf/1302.2142v1.pdf.
simGG.simlinear
, survival
,
strata
, and coxph
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27  # Load Carpenter (2002) data
data("CarpenterFdaData")
# Load survival package
library(survival)
# Run basic model
M1 < coxph(Surv(acttime, censor) ~ prevgenx + lethal +
deathrt1 + acutediz + hosp01 + hhosleng +
mandiz01 + femdiz01 + peddiz01 + orphdum +
vandavg3 + wpnoavg3 + condavg3 + orderent +
stafcder, data = CarpenterFdaData)
# Simulate Hazard Ratios
Sim1 < coxsimLinear(M1, b = "stafcder",
Xj = c(1237, 1600),
Xl = c(1000, 1000),
qi = "Hazard Ratio",
spin = TRUE, ci = 0.99)
## Not run:
# Simulate Hazard Rates
Sim2 < coxsimLinear(M1, b = "stafcder",
Xj = 1237,
ci = 0.99)
## End(Not run)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.