Package 'BayesSurvival'

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

Help Index


Compute the posterior mean and a credible band for the survival and cumulative hazard, and the posterior mean for the hazard.

Description

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).

Usage

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
)

Arguments

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 K=(n/logn)1/2K = (n / \log{n})^{1/2}, with nn 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).

alpha

The function will compute (1-alpha)100% credible bands for the cumulative hazard and survival function.

N

The number of samples to draw from the posterior.

alpha.dep

For the dependent Gamma prior only. The main parameter α\alpha for the dependent Gamma prior, as described below. It is recommended to take alpha.dep smaller than alpha0.dep.

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 alpha.dep smaller than alpha0.dep.

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 K x surv.factor (the number of intervals times this factor).

surv.epsilon

The survival function is computed on the interval [0, time.max - surv.epsilon].

Details

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 λk\lambda_k the histogram height on interval kk and α\alpha a user-selected parameter, the structure is such that, with KK the number of intervals:

E[λkλk1,,λ1]=λk1,k=2,,K.E[\lambda_k | \lambda_{k-1}, \ldots, \lambda_1] = \lambda_{k-1}, k = 2, \ldots, K.

Var(λkλk1,,λ1)=(λk1)2/α,k=2,,K.Var(\lambda_k | \lambda_{k-1}, \ldots, \lambda_1) = (\lambda_{k-1})^2/\alpha, k = 2, \ldots, K.

In the independent Gamma prior, the prior draws for the λk\lambda_k'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 KK suggested by Castillo and Van der Pas (2020) is

K=(n/logn)1/(1+2γ),K = (n / \log{n})^{1/(1 + 2\gamma)},

where nn is the number of observations and γ\gamma is related to the smoothness of the true hazard function. In the absence of information about the smoothness, a default value of γ=1/2\gamma = 1/2 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).

Value

haz.post.mean

The posterior mean for the hazard, given as the value on each of the KK intervals.

cumhaz.post.mean

The posterior mean for the cumulative hazard, given as the value at the end of each of the KK intervals. The cumulative hazard can be obtained from this by starting at 0 and linearly interpolating between each of the returned values.

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.eval.grid.

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 surv.factor in the function call.

time.max

The maximum follow-up time considered.

References

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.

See Also

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.

Examples

#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")

Evaluate whether a true cumulative hazard function is contained in the credible set.

Description

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.

Usage

CumhazEval(time.grid, true.cumhaz, post.mean, radius)

Arguments

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.

Value

covered

Indicator whether the true cumulative hazard function is completely covered by the credible set on the times contained in time.grid. 0 = not completely covered, 1 = completely covered.

References

Castillo and Van der Pas (2020). Multiscale Bayesian survival analysis. <arXiv:2005.02889>.

See Also

BayesSurv, which computes the posterior mean of the cumulative hazard as well as the radius for its credible set.

Examples

#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)

Sampler for the first interval for the piecewise exponential prior with dependent Gamma heights.

Description

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.

Usage

MCMCDepGammaFirst(
  current,
  next.haz,
  failure,
  exposure,
  alpha.dep = 1,
  alpha0.dep = 1.5,
  beta0.dep = 1
)

Arguments

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 α\alpha for the dependent Gamma prior, as described in the documentation for BayesSurv. It is recommended to take alpha.dep smaller than alpha0.dep.

alpha0.dep

The shape parameter for the Gamma prior on the histogram height for the first interval. It is recommended to take alpha.dep smaller than alpha0.dep.

beta0.dep

The rate parameter for the Gamma prior on the histogram height for the first interval.

Value

res

A new sample of the histogram height of the first interval.

References

Castillo and Van der Pas (2020). Multiscale Bayesian survival analysis. <arXiv:2005.02889>.

See Also

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.


Sampler for the intermediate intervals for the piecewise exponential prior with dependent Gamma heights.

Description

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.

Usage

MCMCDepGammaIntermediate(
  current,
  prev.haz,
  next.haz,
  failure,
  exposure,
  alpha.dep
)

Arguments

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 α\alpha for the dependent Gamma prior, as described in the documentation for BayesSurv. It is recommended to take alpha.dep smaller than alpha0.dep.

Value

res

A new sample of the histogram height of the selected interval.

References

Castillo and Van der Pas (2020). Multiscale Bayesian survival analysis. <arXiv:2005.02889>.

See Also

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.


Plot the posterior mean with credible band for the survival function or cumulative hazard, or the posterior mean for the hazard

Description

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).

Usage

PlotBayesSurv(
  bayes.surv.object,
  object = c("survival", "cumhaz", "hazard"),
  band = TRUE,
  color = "darkblue",
  plot.title = "",
  xlab = "time",
  ylab = "",
  legend = TRUE,
  alpha.band = 0.4
)

Arguments

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.

Details

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.

Value

gg

The plot, which may be edited further by adding ggplot2 syntax.

References

Castillo and Van der Pas (2020). Multiscale Bayesian survival analysis. <arXiv:2005.02889>.

See Also

BayesSurv to create the required object for this plotting function.

Examples

#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")

Computes the radius of a fixed width credible set for the survival or the cumulative hazard

Description

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.

Usage

RadiusCredibleSet(draws, post.mean, alpha = 0.05)

Arguments

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.

Value

radius

The radius of the credible set.

References

Castillo and Van der Pas (2020). Multiscale Bayesian survival analysis. <arXiv:2005.02889>.

See Also

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.


Reshape right censored data to be used with a piecewise exponential prior.

Description

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.

Usage

ReshapeData(
  df,
  time = "time",
  event = "event",
  K = ceiling((dim(df)[1]/log(dim(df)[1]))^(1/2)),
  time.max = max(df[[time]])
)

Arguments

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/logn)1/2K = (n / \log{n})^{1/2}, with nn 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 tautau in Castillo and Van der Pas (2020).

Value

failures

A vector of length KK, containing for each interval the number of individuals who had an event during that interval.

exposures

A vector of length KK, containing for each interval the total amount of time all individuals together were under follow-up during that interval.

References

Castillo and Van der Pas (2020). Multiscale Bayesian survival analysis. <arXiv:2005.02889>.

See Also

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.


Draw samples from the posterior for the hazard, using the piecewise exponential (histogram) prior with dependent Gamma heights

Description

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.

Usage

SamplePosteriorDepGamma(
  failures,
  exposures,
  N = 1000,
  alpha.dep = 1,
  alpha0.dep = 1.5,
  beta0.dep = 1
)

Arguments

failures

A vector of length KK (the total number of intervals), containing for each interval the number of individuals who had an event during that interval.

exposures

A vector of length KK (the total number of intervals), containing for each interval the total amount of time all individuals together were under follow-up during that interval.

N

The number of draws to take.

alpha.dep

The main parameter α\alpha for the dependent Gamma prior, as described in the documentation for BayesSurv. It is recommended to take alpha.dep smaller than alpha0.dep.

alpha0.dep

The shape parameter for the Gamma prior on the histogram height for the first interval. It is recommended to take alpha.dep smaller than alpha0.dep.

beta0.dep

The rate parameter for the Gamma prior on the histogram height for the first interval.

Details

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.

Value

samples

A NN by KK (the number of draws by the number of intervals) matrix, with each row containing a draw from the posterior for the hazard, based on a histogram prior with dependent Gamma heights.

References

Castillo and Van der Pas (2020). Multiscale Bayesian survival analysis. <arXiv:2005.02889>.

See Also

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.


Draw samples from the posterior for the hazard, using the piecewise exponential (histogram) prior with independent Gamma heights

Description

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.

Usage

SamplePosteriorIndepGamma(
  failures,
  exposures,
  N = 1000,
  alpha.indep = 1.5,
  beta.indep = 1
)

Arguments

failures

A vector of length KK (the total number of intervals), containing for each interval the number of individuals who had an event during that interval.

exposures

A vector of length KK (the total number of intervals), containing for each interval the total amount of time all individuals together were under follow-up during that interval.

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.

Details

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.

Value

samples

A NN by KK (the number of draws by the number of intervals) matrix, with each row containing a draw from the posterior for the hazard, based on a histogram prior with independent Gamma heights.

References

Castillo and Van der Pas (2020). Multiscale Bayesian survival analysis. <arXiv:2005.02889>.

See Also

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.


Evaluate whether a true survival function is contained in the credible set.

Description

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.

Usage

SurvEval(time.grid, true.surv, post.mean, radius)

Arguments

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

Value

covered

Indicator whether the true survival function is completely covered by the credible set on the times contained in time.grid. 0 = not completely covered, 1 = completely covered.

References

Castillo and Van der Pas (2020). Multiscale Bayesian survival analysis. <arXiv:2005.02889>.

See Also

BayesSurv, which computes the posterior mean of the survival function as well as the radius for its credible set.

Examples

#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)

Transform posterior draws from the cumulative hazard into posterior draws from the survival.

Description

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.

Usage

SurvivalFromCumhaz(cumhaz, time.max, surv.factor = 10, surv.epsilon = 1e-10)

Arguments

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 τ\tau in Castillo and Van der Pas (2020).

surv.factor

The survival function is computed on an equispaced grid consisting of K x surv.factor (the number of intervals times this factor).

surv.epsilon

The survival function is computed on the interval [0, time.max - surv.epsilon].

Value

surv(eval.vec)

A numeric vector containing the posterior mean of the survival function, evaluated at K x surv.factor (where K is the number of intervals used in the prior) equidistant time points on the interval [0, time.max - surv.epsilon].

References

Castillo and Van der Pas (2020). Multiscale Bayesian survival analysis. <arXiv:2005.02889>.

See Also

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.