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

Description

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.

Usage

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

Arguments

survsim

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

type

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

bins

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

df

If survsim is generated by a call to sim.survdata in which num.data.frames 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

Details

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.

Value

A figure of class "gg" and "ggplot" if type="baseline" or type="hist", and of classes "gtable", "gTree", "grob", and "gDesc" if type="both".

Author(s)

Jonathan Kropko <jkropko@virginia.edu> and Jeffrey J. Harden <jharden2@nd.edu>

References

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

See Also

sim.survdata, ggplot, grid.arrange

Examples

1
2
simdata <- sim.survdata(N=1000, T=100, num.data.frames=1)
survsim.plot(simdata)

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