Description Usage Arguments Value References See Also
To draw from the posterior of the piecewise exponential priors implemented in this package, it is convenient to convert the data so that two vectors are obtained: one containing the total amount of time all individuals were under follow-up during each interval, and one containing the number of events that happened during each interval. This function takes a dataframe with a column of times (the minimum of the time of the event and the time of censoring) and a column indicating the status (0 if censored, 1 if the event was observed) and reshapes it into the desired format. Most users will not use this function directly, but will instead use the main function BayesSurv, which uses the present function.
1 2 3 4 5 6 7 |
df |
A dataframe, containing at minimum a column with follow-up times and a column with a status indicator (event observed or censored). |
time |
The name of the column in the dataframe containing the (possibly right-censored) follow-up times, that is, the minimum of the time of the event and the time of censoring. Input the name as character/string. |
event |
The name of the column in the dataframe containing the status indicator, which must be coded as: 0 = censored, 1 = event observed. Input the name as character/string. |
K |
The number of intervals to be used in the piecewise exponential (histogram) prior. Default is set to K = (n / \log{n})^{1/2}, with n the number of observations, as recommended by Castillo and Van der Pas (2020). |
time.max |
The maximum follow-up time to consider, corresponding to the parameter tau in Castillo and Van der Pas (2020). |
failures |
A vector of length K, containing for each interval the number of individuals who had an event during that interval. |
exposures |
A vector of length K, containing for each interval the total amount of time all individuals together were under follow-up during that interval. |
Castillo and Van der Pas (2020). Multiscale Bayesian survival analysis. <arXiv:2005.02889>.
BayesSurv, which computes the posterior mean and the radius of the credible band for the cumulative hazard function as well as the survival, and the posterior mean for the hazard. These objects can then be visualized by using PlotBayesSurv.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.