The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

simPH

banner-image

Christopher Gandrud

R build status Build Status Codecov test coverage CRAN Version CRAN Downloads CRAN Total Downloads

Please report any bugs to:

https://github.com/christophergandrud/simPH/issues


simPH is an R package for simulating and plotting quantities of interest (relative hazards, first differences, and hazard ratios) for linear coefficients, multiplicative interactions, polynomials, penalised splines, and non-proportional hazards, as well as stratified survival curves from Cox Proportional Hazard models.

For more information plus examples, please see the description paper in the Journal of Statistical Software.

To cite the paper please use:

@article{simPH_JSS,
    author = {Christopher Gandrud},
    title = {simPH: An R Package for Illustrating Estimates from Cox
        Proportional Hazard Models Including for Interactive and Nonlinear
        Effects},
    journal = {Journal of Statistical Software},
    year = {2015},
    volume = {65},
    issue = {3},
    pages = {1--20}
}

Functions

The package includes the following functions:

Simulation Functions

Plotting Functions

Results from these functions can be plotted using the simGG method. The syntax and capabilities of simGG varies depending on the sim object class you are using:

Additional styling

Because in almost all cases simGG returns a ggplot2 object, you can add additional aesthetic attributes in the normal ggplot2 way. See the ggplot2 documentation for more details.

Misc.

Installation

The package is available on CRAN and can be installed in the normal R way.

Tip

Before running the simulation and graph functions in this package carefully consider how many simulations you are about to make. Especially for hazard rates over long periods of time and with multiple strata, you can be asking simPH to run very many simulations. This will be computationally intensive.

Sources

Simulating Parameter Estimates

For more information about simulating parameter estimates to make interpretation of results easier see:

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.

Stratified Cox PH

For more information about stratified Cox PH models see:

Box-Steffensmeier, Janet M, and Suzanna De Boef. 2006. “Repeated Events Survival Models: the Conditional Frailty Model.” Statistics in Medicine 25(20): 3518–33.

Shortest Probability Intervals

To learn more about shortest probability intervals (and also for the source of the code that made this possible in simPH) see:

Liu, Y., Gelman, A., & Zheng, T. (2015). “Simulation-efficient Shortest Probablility Intervals.” Statistics and Computing 25:809-819.

Also good: Hyndman, R. J. (1996). “Computing and Graphing Highest Density Regions.” The American Statistician, 50(2): 120–126.

Interpreting Interactions

For more information about interpreting interaction terms:

Brambor, Thomas, William Roberts Clark, and Matt Golder. 2006. “Understanding Interaction Models: Improving Empirical Analyses.” Political Analysis 14(1): 63–82.

The Olden Days

For an example of how non-proportional hazard results were often presented before simPH see (some of the problems I encountered in this paper were a major part of why I developed this package):

Gandrud, Christopher. 2013. “The Diffusion of Financial Supervisory Governance Ideas.” Review of International Political Economy. 20(4): 881-916.

Future Plans

I intend to expand the quantities of interest that can be simulated and graphed for Cox PH models. I am also currently working on functions that can simulate and graph hazard ratios estimated from Fine and Gray competing risks models.

I am also working on a way to graph hazard ratios with frailties.


Licensed under GPL-3

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.