Description Usage Arguments Details Value Author(s) References See Also Examples
This function takes the output of sim.survdata
and plots the baseline
failure PDF, the baseline failure CDF, the baseline survivor function, and the baseline hazard
function that were generated and used to simulate the data. The function also produces histograms
of the simulated durations, the linear predictor, and the exponentiated linear predictor.
1 | survsim.plot(survsim, type = "both", bins = 30, df = 1)
|
survsim |
An object of class " |
type |
If |
bins |
The number of bins to draw in each histogram. Ignored if |
df |
If |
A challenge that can limit research to develop methods to analyze survival data is that a
pre-specified baseline hazard function must be used to generate simulated data, which contradicts the
Cox proportional hazards model's feature of circumventing the hazard to estimate coefficients. The
flexible-hazard method developed by Harden and Kropko (2018) and implemented in sim.survdata
allows for the simulation of duration data without assuming a particular parametric form for hazard.
survsim.plot
is useful for visualizing the baseline functions, including hazard, that result from
this algorithm for a particular draw of simulated duration data. The function uses ggplot
to create line plots for the baseline failure PDF, the baseline failure CDF, the baseline survivor function,
and the baseline hazard function over time. The baseline functions and time are attributes of the
sim.survdata
output.
A figure of class "gg"
and "ggplot"
if type="baseline"
or type="hist"
, and of
classes "gtable"
, "gTree"
, "grob"
, and "gDesc"
if type="both"
.
Jonathan Kropko <jkropko@virginia.edu> and Jeffrey J. Harden <jharden2@nd.edu>
Harden, J. J. and Kropko, J. (2018). Simulating Duration Data for the Cox Model. Political Science Research and Methods https://doi.org/10.1017/psrm.2018.19
sim.survdata
, ggplot
, grid.arrange
1 2 | simdata <- sim.survdata(N=1000, T=100, num.data.frames=1)
survsim.plot(simdata)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.