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

View source: R/baseline.build.R

This function is called by `sim.survdata`

and is not intended to be used by itself.

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

`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 |

`spline` |
If |

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.

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.

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

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

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

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.