Description Usage Arguments Details Value References See Also Examples
coxsimPoly
simulates quantities of interest for polynomial covariate
effects estimated from Cox Proportional Hazards models. These can be plotted
with simGG
.
1 2 3 4 5 6 7 8 9 10 11 12 |
obj |
a |
b |
character string name of the coefficient you would like to simulate.
To find the quantity of interest using only the polynomial and not the
polynomial + the linear terms enter the polynomial created using
|
qi |
quantity of interest to simulate. Values can be
|
pow |
numeric polynomial used in |
Xj |
numeric vector of fitted values for |
Xl |
numeric vector of values to compare |
nsim |
the number of simulations to run per value of |
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 |
Simulates quantities of interest for polynomial covariate effects. For example if a nonlinear effect is modeled with a second order polynomial–i.e. β[1]x[i] + β[2]x[i]^2–we can draw n simulations from the multivariate normal distribution for both β[1] and β[2]. Then we simply calculate quantities of interest for a range of values and plot the results as before. For example, we find the first difference for a second order polynomial with:
FD(h[i](t)) = exp(β[1]x[j-1] + β[2]x[j-l]^2) - 1) * 100
where x[j-l] = x[j] - x[l].
Note, you must use I
to create the polynomials.
a simpoly
, 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)1-20.
Keele, Luke. 2010. ”Proportionally Difficult: Testing for Nonproportional Hazards in Cox Models.” Political Analysis 18(2): 189-205.
Carpenter, Daniel P. 2002. ”Groups, the Media, Agency Waiting Costs, and FDA Drug Approval.” American Journal of Political Science 46(3): 490-505.
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.
simGG.simpoly
, 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 | # 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 + natreg + I(natreg^2) +
I(natreg^3) + vandavg3 + wpnoavg3 +
condavg3 + orderent + stafcder, data = CarpenterFdaData)
# Simulate simpoly First Difference
Sim1 <- coxsimPoly(M1, b = "natreg", qi = "First Difference",
pow = 3, Xj = seq(1, 150, by = 5), nsim = 100)
## Not run:
# Simulate simpoly Hazard Ratio with spin probibility interval
Sim2 <- coxsimPoly(M1, b = "natreg", qi = "Hazard Ratio",
pow = 3, Xj = seq(1, 150, by = 5), spin = TRUE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.