coxsimLinear {simPH} | R Documentation |
Simulate quantities of interest for covariates from Cox Proportional Hazards models that are not interacted with time or nonlinearly transformed
Description
Simulates relative hazards, first differences, hazard ratios,
and hazard rates for linear, non-time interacted covariates from Cox
Proportional Hazard models. These can be plotted with simGG
.
Usage
coxsimLinear(
obj,
b,
qi = "Relative Hazard",
Xj = NULL,
Xl = NULL,
means = FALSE,
nsim = 1000,
ci = 0.95,
spin = FALSE,
extremesDrop = TRUE
)
Arguments
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 |
Details
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
.
Value
a simlinear
, coxsim
object
References
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)1-20.
Licht, Amanda A. 2011. ”Change Comes with Time: Substantive Interpretation of Nonproportional Hazards in Event History Analysis.” Political Analysis 19: 227-43.
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): 347-61.
Liu, Ying, Andrew Gelman, and Tian Zheng. 2013. ”Simulation-Efficient Shortest Probability Intervals.” Arvix. https://arxiv.org/pdf/1302.2142v1.pdf.
See Also
simGG.simlinear
, survival
,
strata
, and coxph
Examples
# 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)