Title: | Bayesian Survival Analysis for Right Censored Data |
---|---|
Description: | Performs unadjusted Bayesian survival analysis for right censored time-to-event data. The main function, BayesSurv(), computes the posterior mean and a credible band for the survival function and for the cumulative hazard, as well as the posterior mean for the hazard, starting from a piecewise exponential (histogram) prior with Gamma distributed heights that are either independent, or have a Markovian dependence structure. A function, PlotBayesSurv(), is provided to easily create plots of the posterior means of the hazard, cumulative hazard and survival function, with a credible band accompanying the latter two. The priors and samplers are described in more detail in Castillo and Van der Pas (2020) "Multiscale Bayesian survival analysis" <arXiv:2005.02889>. In that paper it is also shown that the credible bands for the survival function and the cumulative hazard can be considered confidence bands (under mild conditions) and thus offer reliable uncertainty quantification. |
Authors: | Stephanie van der Pas [aut, cre], Ismael Castillo [aut] |
Maintainer: | Stephanie van der Pas <[email protected]> |
License: | GPL-3 |
Version: | 0.2.0 |
Built: | 2024-11-23 04:02:03 UTC |
Source: | https://github.com/cran/BayesSurvival |
This is the main function of this package, computing relevant quantities for a Bayesian survival analysis of (possibly right-censored) time-to-event-data. Starting with a piecewise exponential prior with dependent or independent Gamma heights (details below) on the hazard function, the function computes the posterior mean for the hazard, cumulative hazard and survival function, serving as an estimator for the true functions. In addition, for the cumulative hazard and survival function, the radius for a fixed-width credible band is computed. The interpretation of this credible band as a confidence band is justified in Castillo and Van der Pas (2020).
BayesSurv( df, time = "time", event = "event", prior = c("Dependent", "Independent"), K = ceiling((dim(df)[1]/log(dim(df)[1]))^(1/2)), time.max = max(df[[time]]), alpha = 0.05, N = 1000, alpha.dep = 1, alpha0.dep = 1.5, beta0.dep = 1, alpha.indep = 1.5, beta.indep = 1, surv.factor = 10, surv.epsilon = 1e-10 )
BayesSurv( df, time = "time", event = "event", prior = c("Dependent", "Independent"), K = ceiling((dim(df)[1]/log(dim(df)[1]))^(1/2)), time.max = max(df[[time]]), alpha = 0.05, N = 1000, alpha.dep = 1, alpha0.dep = 1.5, beta0.dep = 1, alpha.indep = 1.5, beta.indep = 1, surv.factor = 10, surv.epsilon = 1e-10 )
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. |
prior |
Select either dependent or independent Gamma heights for the piecewise exponential prior on the hazard. Dependent heights (with the Markov structure described below) is default. |
K |
The number of intervals to be used in the piecewise exponential
(histogram) prior. Default is set to |
time.max |
The maximum follow-up time to consider, corresponding to the
parameter |
alpha |
The function will compute (1- |
N |
The number of samples to draw from the posterior. |
alpha.dep |
For the dependent Gamma prior only. The main parameter
|
alpha0.dep |
For the dependent Gamma prior only. The shape parameter for
the Gamma prior on the histogram height for the first interval. It is
recommended to take |
beta0.dep |
For the dependent Gamma prior only. The rate parameter for the Gamma prior on the histogram height for the first interval. |
alpha.indep |
For the independent Gamma prior only. The shape parameter for the Gamma prior on the histogram height for each interval. |
beta.indep |
For the independent Gamma prior only. The rate parameter for the Gamma prior on the histogram height for each interval. |
surv.factor |
The survival function is computed on an equispaced grid
consisting of |
surv.epsilon |
The survival function is computed on the interval [0,
|
There are two options for the prior: a piecewise exponential (histogram)
prior with dependent Gamma heights and a piecewise exponential (histogram)
prior with independent Gamma heights. Both priors are described in detail in
Castillo and Van der Pas (2020). The dependent prior has a Markov structure,
where the height of each interval depends on the height of the previous
interval. It implements the autoregressive idea of Arjas and Gasbarra (1994).
With the histogram height on interval
and
a
user-selected parameter, the structure is such that, with
the number
of intervals:
In the independent Gamma prior, the prior draws for the 's are
independent of each other and are taken from a Gamma distribution with
user-specified shape and rate parameters.
The guideline for the number of intervals suggested by Castillo and
Van der Pas (2020) is
where is the number of observations and
is related to
the smoothness of the true hazard function. In the absence of information
about the smoothness, a default value of
is recommended
and this is implemented as the default in this package. If this choice leads
to many intervals with zero events, it is recommended to decrease the number
of intervals.
The samplers used for the dependent and independent Gamma priors are described in the Supplement to Castillo and Van der Pas (2020).
haz.post.mean |
The posterior mean for the hazard, given as the
value on each of the |
cumhaz.post.mean |
The posterior mean for the cumulative hazard,
given as the value at the end of each of the |
cumhaz.radius |
The radius for the credible set for the cumulative hazard. |
surv.post.mean |
The posterior mean for the
survival, given at each value contained in the also returned
|
surv.radius |
The radius for the credible set for the survival. |
surv.eval.grid |
The grid on which the
posterior mean for the survival has been computed. A finer grid can be
obtained by increasing |
time.max |
The maximum follow-up time considered. |
Castillo and Van der Pas (2020). Multiscale Bayesian survival analysis. <arXiv:2005.02889>.
Arjas and Gasbarra (1994). Nonparametric Bayesian inference from right censored survival data, using the Gibbs sampler. Statistica Sinica 4(2):505-524.
PlotBayesSurv for a function that takes the result
from BayesSurv()
and produces plots of the posterior mean of the hazard,
the posterior mean and credible band for the cumulative hazard, and the
posterior mean and credible band for the survival. To obtain direct samples
from the posterior for the hazard, see SamplePosteriorDepGamma and
SamplePosteriorIndepGamma.
#Demonstration on a simulated data set library(simsurv) library(ggplot2) hazard.true <- function(t,x, betas, ...){1.2*(5*(t+0.05)^3 - 10*(t+0.05)^2 + 5*(t+0.05) ) + 0.7} sim.df <- data.frame(id = 1:1000) df <- simsurv(x = sim.df, maxt = 1, hazard = hazard.true) bs <- BayesSurv(df, "eventtime", "status") PlotBayesSurv(bs, object = "survival") PlotBayesSurv(bs, object = "cumhaz") PlotBayesSurv(bs, object = "hazard")
#Demonstration on a simulated data set library(simsurv) library(ggplot2) hazard.true <- function(t,x, betas, ...){1.2*(5*(t+0.05)^3 - 10*(t+0.05)^2 + 5*(t+0.05) ) + 0.7} sim.df <- data.frame(id = 1:1000) df <- simsurv(x = sim.df, maxt = 1, hazard = hazard.true) bs <- BayesSurv(df, "eventtime", "status") PlotBayesSurv(bs, object = "survival") PlotBayesSurv(bs, object = "cumhaz") PlotBayesSurv(bs, object = "hazard")
This function is intended to evaluate the Bayesian procedure in a simulation study. To that end, this function can be used to check whether the true (user-defined) cumulative hazard function is contained in the credible set generated by the function BayesSurv.
CumhazEval(time.grid, true.cumhaz, post.mean, radius)
CumhazEval(time.grid, true.cumhaz, post.mean, radius)
time.grid |
The time grid on which to evaluate the cumulative hazard. |
true.cumhaz |
The true cumulative hazard function. |
post.mean |
The posterior mean of the cumulative hazard, given as a function. |
radius |
The radius of the credible set for the cumulative hazard. |
covered |
Indicator whether the true cumulative hazard function is
completely covered by the credible set on the times contained in
|
Castillo and Van der Pas (2020). Multiscale Bayesian survival analysis. <arXiv:2005.02889>.
BayesSurv, which computes the posterior mean of the cumulative hazard as well as the radius for its credible set.
#Demonstration on a simulated data set library(simsurv) library(ggplot2) hazard.true <- function(t,x, betas, ...){1.2*(5*(t+0.05)^3 - 10*(t+0.05)^2 + 5*(t+0.05) ) + 0.7} cumhaz.true <- Vectorize( function(t){integrate(hazard.true, 0, t)$value} ) sim.df <- data.frame(id = 1:1000) df <- simsurv(x = sim.df, maxt = 1, hazard = hazard.true) bs <- BayesSurv(df, "eventtime", "status") K <- length(bs$haz.post.mean) cumhaz.pm <- approxfun(c(0, (bs$time.max/K)*(1:K) ), c(0, cumsum(bs$haz.post.mean*bs$time.max/K))) CumhazEval(bs$surv.eval.grid, cumhaz.true, cumhaz.pm, bs$cumhaz.radius)
#Demonstration on a simulated data set library(simsurv) library(ggplot2) hazard.true <- function(t,x, betas, ...){1.2*(5*(t+0.05)^3 - 10*(t+0.05)^2 + 5*(t+0.05) ) + 0.7} cumhaz.true <- Vectorize( function(t){integrate(hazard.true, 0, t)$value} ) sim.df <- data.frame(id = 1:1000) df <- simsurv(x = sim.df, maxt = 1, hazard = hazard.true) bs <- BayesSurv(df, "eventtime", "status") K <- length(bs$haz.post.mean) cumhaz.pm <- approxfun(c(0, (bs$time.max/K)*(1:K) ), c(0, cumsum(bs$haz.post.mean*bs$time.max/K))) CumhazEval(bs$surv.eval.grid, cumhaz.true, cumhaz.pm, bs$cumhaz.radius)
This is the sampler for the first interval in case the piecewise exponential prior with dependent Gamma heights is selected. The sampler is described in the Supplement to Castillo and Van der Pas (2020). Most users of the package will not work with this function directly, but instead use the main function BayesSurv, in which this particular function is incorporated.
MCMCDepGammaFirst( current, next.haz, failure, exposure, alpha.dep = 1, alpha0.dep = 1.5, beta0.dep = 1 )
MCMCDepGammaFirst( current, next.haz, failure, exposure, alpha.dep = 1, alpha0.dep = 1.5, beta0.dep = 1 )
current |
The value of the height of the first interval from the previous iteration. |
next.haz |
The value of the height of the second interval from the previous iteration. |
failure |
The number of individuals who had an event during the first interval. |
exposure |
The total amount of time all individuals were exposed for during the first interval. |
alpha.dep |
The main parameter |
alpha0.dep |
The shape parameter for the Gamma prior on the histogram
height for the first interval. It is recommended to take |
beta0.dep |
The rate parameter for the Gamma prior on the histogram height for the first interval. |
res |
A new sample of the histogram height of the first interval. |
Castillo and Van der Pas (2020). Multiscale Bayesian survival analysis. <arXiv:2005.02889>.
BayesSurv, which computes the posterior mean and credible bands for the cumulative hazard and survival functions, as well as the posterior mean for the hazard. Within BayesSurv, the present function as well as MCMCDepGammaIntermediate is called through SamplePosteriorDepGamma.
This is the sampler for the intermediate intervals (= all intervals except for the first and last one) in case the piecewise exponential prior with dependent Gamma heights is selected. The sampler is described in the Supplement to Castillo and Van der Pas (2020) and uses MCMC within Gibbs, with a Gamma proposal with shape parameter equal to the number of events in the interval plus some epsilon (to prevent proposals equal to zero if there are no events in an interval) and rate parameter equal to the parameter alpha (set by the user) divided by histogram height on the previous interval, plus the total amount of time all individuals were exposed during this interval. Most users of the package will not work with this function directly, but instead use the main function BayesSurv, in which this particular function is incorporated.
MCMCDepGammaIntermediate( current, prev.haz, next.haz, failure, exposure, alpha.dep )
MCMCDepGammaIntermediate( current, prev.haz, next.haz, failure, exposure, alpha.dep )
current |
The value of the height of the first interval from the previous iteration. |
prev.haz |
The value of the height of the preceding interval from the previous iteration. |
next.haz |
The value of the height of the next interval from the previous iteration. |
failure |
The number of individuals who had an event during the first interval. |
exposure |
The total amount of time all individuals were exposed for during the first interval. |
alpha.dep |
The main parameter |
res |
A new sample of the histogram height of the selected interval. |
Castillo and Van der Pas (2020). Multiscale Bayesian survival analysis. <arXiv:2005.02889>.
BayesSurv, which computes the posterior mean and credible bands for the cumulative hazard and survival functions, as well as the posterior mean for the hazard. Within BayesSurv, the present function as well as MCMCDepGammaFirst is called through SamplePosteriorDepGamma.
This function takes the output from BayesSurv and uses ggplot2 to make plots of (1) the posterior mean of the survival function with credible band, or (2) the posterior mean of the cumulative hazard with credible band, or (3) the posterior mean of the cumulative hazard. Users can select some plotting options within this function. Further changes to the plot can be made by storing the plot and adding ggplot2 syntax (see the examples).
PlotBayesSurv( bayes.surv.object, object = c("survival", "cumhaz", "hazard"), band = TRUE, color = "darkblue", plot.title = "", xlab = "time", ylab = "", legend = TRUE, alpha.band = 0.4 )
PlotBayesSurv( bayes.surv.object, object = c("survival", "cumhaz", "hazard"), band = TRUE, color = "darkblue", plot.title = "", xlab = "time", ylab = "", legend = TRUE, alpha.band = 0.4 )
bayes.surv.object |
The output from the function BayesSurv. |
object |
The object to be plotted, the user may select "survival" for the survival function, "cumhaz" for the cumulative hazard, or "hazard" for the hazard function. Default is the survival function. |
band |
Indicator whether a credible band should be plotted (only possible for the survival function and the cumulative hazard). |
color |
The color to be used for the posterior mean and the credible band (if applicable). |
plot.title |
A title for the plot. |
xlab |
A label for the horizontal axis. |
ylab |
a label for the vertical axis. |
legend |
If TRUE, a legend saying 'Credible band' will be included. |
alpha.band |
The transparency of the credible band. |
The posterior mean of the hazard and the posterior mean and credible
band of the cumulative hazard are plotted exactly. The survival is plotted
exactly at the points contained in the vector surv.eval.grid
contained
in the object created by BayesSurv. Between these points, the survival
is linearly interpolated. To evaluate the survival exactly at more points
(and to obtain a smoother plot), increase the parameter surv.factor
within BayesSurv.
gg |
The plot, which may be edited further by adding ggplot2 syntax. |
Castillo and Van der Pas (2020). Multiscale Bayesian survival analysis. <arXiv:2005.02889>.
BayesSurv to create the required object for this plotting function.
#Demonstration on a simulated data set library(simsurv) library(ggplot2) hazard.true <- function(t,x, betas, ...){1.2*(5*(t+0.05)^3 - 10*(t+0.05)^2 + 5*(t+0.05) ) + 0.7} sim.df <- data.frame(id = 1:1000) df <- simsurv(x = sim.df, maxt = 1, hazard = hazard.true) bs <- BayesSurv(df, "eventtime", "status") PlotBayesSurv(bs, object = "survival") cumhaz.plot <- PlotBayesSurv(bs, object = "cumhaz") cumhaz.plot + labs(title = "Cumulative hazard")
#Demonstration on a simulated data set library(simsurv) library(ggplot2) hazard.true <- function(t,x, betas, ...){1.2*(5*(t+0.05)^3 - 10*(t+0.05)^2 + 5*(t+0.05) ) + 0.7} sim.df <- data.frame(id = 1:1000) df <- simsurv(x = sim.df, maxt = 1, hazard = hazard.true) bs <- BayesSurv(df, "eventtime", "status") PlotBayesSurv(bs, object = "survival") cumhaz.plot <- PlotBayesSurv(bs, object = "cumhaz") cumhaz.plot + labs(title = "Cumulative hazard")
This function finds a radius such that (1-alpha)100% of posterior draws are within a distance of at most this radius to the posterior mean. Most users will not use this function directly, but instead use BayesSurv, in which this function is used.
RadiusCredibleSet(draws, post.mean, alpha = 0.05)
RadiusCredibleSet(draws, post.mean, alpha = 0.05)
draws |
A matrix of posterior draws of either the cumulative hazard or the survival. Each row contains a draw, the columns correspond to time points on which the cumulative hazard or survival is evaluated. |
post.mean |
The posterior mean of the cumulative hazard or survival function, evaluated at the same time points as the draws. |
alpha |
The credible band will be such that (1-alpha)100% of draws is contained in it. |
radius |
The radius of the credible set. |
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.
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.
ReshapeData( df, time = "time", event = "event", K = ceiling((dim(df)[1]/log(dim(df)[1]))^(1/2)), time.max = max(df[[time]]) )
ReshapeData( df, time = "time", event = "event", K = ceiling((dim(df)[1]/log(dim(df)[1]))^(1/2)), time.max = max(df[[time]]) )
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 |
time.max |
The maximum follow-up time to consider, corresponding to the
parameter |
failures |
A vector of length |
exposures |
A vector of length |
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.
The sampler is described in the Supplement to Castillo and Van der Pas (2020) and uses MCMC within Gibbs, with a Gamma proposal with shape parameter equal to the number of events in each interval plus some epsilon (to prevent proposals equal to zero if there are no events in an interval) and rate parameter equal to the parameter alpha (set by the user) divided by histogram height on the previous interval, plus the total amount of time all individuals were exposed during this interval. Most users of the package will not work with this function directly, but instead use the main function BayesSurv, in which this particular function is incorporated.
SamplePosteriorDepGamma( failures, exposures, N = 1000, alpha.dep = 1, alpha0.dep = 1.5, beta0.dep = 1 )
SamplePosteriorDepGamma( failures, exposures, N = 1000, alpha.dep = 1, alpha0.dep = 1.5, beta0.dep = 1 )
failures |
A vector of length |
exposures |
A vector of length |
N |
The number of draws to take. |
alpha.dep |
The main parameter |
alpha0.dep |
The shape parameter for the Gamma prior on the histogram
height for the first interval. It is recommended to take |
beta0.dep |
The rate parameter for the Gamma prior on the histogram height for the first interval. |
The samples returned by this function are draws from the posterior for the
hazard function. To obtain draws from the posterior for the cumulative
hazard, one can use numerical integration. One way to achieve this is by
first finding the values of the cumulative hazard at the end of each interval,
e.g. by t(apply(samples*time.max/K, 1, cumsum))
, where samples
is the output from the present function and time.max
and K
are
as described for BayesSurv, and then using approxfun()
to linearly
interpolate in between. To obtain posterior samples from the survival, one
could then use SurvivalFromCumhaz.
samples |
A |
Castillo and Van der Pas (2020). Multiscale Bayesian survival analysis. <arXiv:2005.02889>.
BayesSurv, which computes the posterior mean and credible bands for the cumulative hazard and survival functions, as well as the posterior mean for the hazard. Within BayesSurv, the present function is called.
The sampler is described in the Supplement to Castillo and Van der Pas (2020). Most users of the package will not work with this function directly, but instead use the main function BayesSurv, in which this particular function is incorporated.
SamplePosteriorIndepGamma( failures, exposures, N = 1000, alpha.indep = 1.5, beta.indep = 1 )
SamplePosteriorIndepGamma( failures, exposures, N = 1000, alpha.indep = 1.5, beta.indep = 1 )
failures |
A vector of length |
exposures |
A vector of length |
N |
The number of draws to take. |
alpha.indep |
The shape parameter for the Gamma prior on the histogram height for each interval. |
beta.indep |
The rate parameter for the Gamma prior on the histogram height for each interval. |
The samples returned by this function are draws from the posterior for the
hazard function. To obtain draws from the posterior for the cumulative
hazard, one can use numerical integration. One way to achieve this is by
first finding the values of the cumulative hazard at the end of each interval,
e.g. by t(apply(samples*time.max/K, 1, cumsum))
, where samples
is the output from the present function and time.max
and K
are
as described for BayesSurv, and then using approxfun()
to linearly
interpolate in between. To obtain posterior samples from the survival, one
could then use SurvivalFromCumhaz.
samples |
A |
Castillo and Van der Pas (2020). Multiscale Bayesian survival analysis. <arXiv:2005.02889>.
BayesSurv, which computes the posterior mean and credible bands for the cumulative hazard and survival functions, as well as the posterior mean for the hazard. Within BayesSurv, the present function is called.
This function is intended to evaluate the Bayesian procedure in a simulation study. To that end, this function can be used to check whether the true (user-defined) survival function is contained in the credible set generated by the function BayesSurv.
SurvEval(time.grid, true.surv, post.mean, radius)
SurvEval(time.grid, true.surv, post.mean, radius)
time.grid |
The time grid on which to evaluate the survival function. |
true.surv |
The true survival function. |
post.mean |
The posterior mean of the survival function, given as a function. |
radius |
The radius of the credible set for the survival function |
covered |
Indicator whether the true survival function is
completely covered by the credible set on the times contained in
|
Castillo and Van der Pas (2020). Multiscale Bayesian survival analysis. <arXiv:2005.02889>.
BayesSurv, which computes the posterior mean of the survival function as well as the radius for its credible set.
#Demonstration on a simulated data set library(simsurv) library(ggplot2) hazard.true <- function(t,x, betas, ...){1.2*(5*(t+0.05)^3 - 10*(t+0.05)^2 + 5*(t+0.05) ) + 0.7} cumhaz.true <- Vectorize( function(t){integrate(hazard.true, 0, t)$value} ) surv.true <- function(t){exp(-cumhaz.true(t))} sim.df <- data.frame(id = 1:1000) df <- simsurv(x = sim.df, maxt = 1, hazard = hazard.true) bs <- BayesSurv(df, "eventtime", "status") surv.pm <- approxfun(bs$surv.eval.grid, bs$surv.post.mean) SurvEval(bs$surv.eval.grid, surv.true, surv.pm, bs$surv.radius)
#Demonstration on a simulated data set library(simsurv) library(ggplot2) hazard.true <- function(t,x, betas, ...){1.2*(5*(t+0.05)^3 - 10*(t+0.05)^2 + 5*(t+0.05) ) + 0.7} cumhaz.true <- Vectorize( function(t){integrate(hazard.true, 0, t)$value} ) surv.true <- function(t){exp(-cumhaz.true(t))} sim.df <- data.frame(id = 1:1000) df <- simsurv(x = sim.df, maxt = 1, hazard = hazard.true) bs <- BayesSurv(df, "eventtime", "status") surv.pm <- approxfun(bs$surv.eval.grid, bs$surv.post.mean) SurvEval(bs$surv.eval.grid, surv.true, surv.pm, bs$surv.radius)
Most users will not use this function directly, but will instead use the main
function BayesSurv, which calls this function. This function may be
used to create posterior draws of the survival function, based on posterior
draws of the cumulative hazard. It does so at a number of equispaced time
points on the interval [0, time.max
- surv.epsilon
], with the
number equal to the product of the number of intervals used in the prior, and
a user-defined factor.
SurvivalFromCumhaz(cumhaz, time.max, surv.factor = 10, surv.epsilon = 1e-10)
SurvivalFromCumhaz(cumhaz, time.max, surv.factor = 10, surv.epsilon = 1e-10)
cumhaz |
A matrix containing posterior draws of the cumulative. Each row contains one draw, the columns correspond to each interval. The values in each draw are the values of the cumulative hazard at the end of the corresponding interval. |
time.max |
The maximum follow-up time to consider, corresponding to the
parameter |
surv.factor |
The survival function is computed on an equispaced grid
consisting of |
surv.epsilon |
The survival function is computed on the interval [0,
|
surv(eval.vec) |
A numeric vector containing the posterior mean of
the survival function, evaluated at |
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.