baseline.build: Generate simulated baseline hazard, cumulative hazard,...

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

View source: R/baseline.build.R

Description

This function is called by sim.survdata and is not intended to be used by itself.

Usage

1
baseline.build(T = 100, knots = 8, spline = TRUE)

Arguments

T

The latest time point during which an observation may fail. Failures can occur as early as 1 and as late as T

knots

The number of points to draw while using the flexible-hazard method to generate hazard functions (default is 8). Ignored if hazard.fun is not NULL.

spline

If TRUE (the default), a spline is employed to smooth the generated cumulative baseline hazard, and if FALSE the cumulative baseline hazard is specified as a step function with steps at the knots. Ignored if hazard.fun is not NULL

Details

This function employs the flexible hazard method described in Harden and Kropko (2018) to generate a baseline failure CDF: it plots points at (0, 0) and (T+1, 1), and it plots knots additional points with x-coordinates drawn uniformly from integers in [2, T] and y-coordinates drawn from U[0, 1]. It sorts these coordinates in ascending order (because a CDF must be non-decreasing) and if spline=TRUE it fits a spline using Hyman’s (1983) cubic smoothing function to preserve the CDF’s monotonicity. Next it constructs the failure-time PDF by computing the first differences of the CDF at each time point. It generates the survivor function by subtracting the failure CDF from 1. Finally, it computes the baseline hazard by dividing the failure PDF by the survivor function.

Value

A data frame containing every potential failure time and the baseline failure PDF, baseline failure CDF, baseline survivor function, and baseline hazard function at each time point.

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

Hyman, J. M. (1983) Accurate monotonicity preserving cubic interpolation. SIAM J. Sci. Stat. Comput. 4, 645–654.

See Also

splinefun, sim.survdata

Examples

1
baseline.functions <- baseline.build(T=100, knots=8, spline=TRUE)

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