survsim.plot: Plot the simulated baseline functions and histograms of...

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/survsim.plot.R


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.


survsim.plot(survsim, type = "both", bins = 30, df = 1)



An object of class "simSurvdata" output by sim.survdata


If type="baseline" the function plots the baseline functions. If type="hist" the function plots the histograms. If type="both" the function plots both the baseline functions and the histograms, aligned in a 2 x 1 array


The number of bins to draw in each histogram. Ignored if type="baseline"


If survsim is generated by a call to sim.survdata in which is greater than 1, the output is a list of iterated simulation output. In this case, df specifies the particular simulation iteration for which to produce visualizations


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 <> and Jeffrey J. Harden <>


Harden, J. J. and Kropko, J. (2018). Simulating Duration Data for the Cox Model. Political Science Research and Methods

See Also

sim.survdata, ggplot, grid.arrange


simdata <- sim.survdata(N=1000, T=100,

coxed documentation built on Aug. 2, 2020, 9:07 a.m.