Learn R Programming

TBSSurvival (version 1.3)

tbs.survreg.be: Bayesian Estimation of the TBS Model for Survival Data

Description

This function performs the Bayesian estimation of the Transform-Both-Sides (TBS) model. The priors for the parameters `lambda' and `xi' are uniform-exponential mixtures and, if not specified, for parameter beta is a normal with mean 5 and sd 5. The estimations are done by Metropolis-Hasting (using the function `metrop' availible with the package `mcmc').

Usage

tbs.survreg.be(formula, dist=dist.error("norm"),max.time = -1, guess.beta = NULL, guess.lambda = 1, guess.xi = 1, burn = 1000, jump = 2, size = 500, scale = 0.1, prior.mean = NULL, prior.sd = NULL, seed = 1234)

Arguments

formula
A formula specification containing a Surv model with right-censored (or no censored) data as in the package survival.
dist
Error distribution; dist can be given by name ("norm", "doubexp", "t", "cauchy" or "logistic") or by dist.error.
max.time
Maximum time (in minutes) to run the optimization (
guess.beta
Initial value of the Markov Chain for the vector `beta'. Default will fill it with zeros.
guess.lambda
Initial value of the Markov Chain for the parameter `lambda'.
guess.xi
Initial value of the Markov Chain for the parameter `xi'.
burn
Burn-in: number of initial samples of the posterior not to use.
jump
Number of jumps between each sample of the posterior to avoid the problem of auto-correlation between the samples.
size
Size of final sample of the posterior.
scale
Parameter of `metrop' function. Controls the acceptance rate.
prior.mean
Prior Mean for the MCMC.
prior.sd
Prior std deviation for the MCMC.
seed
The number that is used to initialize the seed for random number generation.

Value

An element of the class tbs.survreg.be, with the components:

Details

This function performs the Bayesian estimation of the Transform-Both-Sides (TBS) model. The priors for the parameters `lambda' and `xi' are uniform-exponential mixtures and, if not specified, for parameter beta is a normal with mean 5 and sd 5. The estimations are done by Metropolis-Hasting (using the function `metrop' availible with the package `mcmc').

References

Meeker, W. and Escobar, L. (1998) Statistical Methods for Reliability Data. Willey, ISBN 0-471-14328-6.

See Also

dist.error,tbs.survreg.mle,dtbs,ptbs,qtbs,rtbs.

Examples

Run this code
# set.seed is used to produce the same results all times.
set.seed(1234)

# Alloy - T7987: data extracted from Meeker and Escobar (1998), pp. 131)
data(alloyT7987)
alloyT7987$time  <- as.double(alloyT7987$time)
alloyT7987$delta <- as.double(alloyT7987$delta)

# Bayesian estimation with logistic error
formula <- survival::Surv(alloyT7987$time,alloyT7987$delta == 1) ~ 1
tbs.be <- tbs.survreg.be(formula,guess.lambda=1,guess.xi=1,guess.beta=5,
                         dist=dist.error("logistic"),burn=1000,jump=10,size=500,scale=0.06)

# Kapan-Meier estimator
km <- survival::survfit(formula = survival::Surv(alloyT7987$time, alloyT7987$delta == 1) ~ 1)

# Plot survival function
plot(tbs.be,lwd=2,HPD=TRUE,HPD.alpha=0.95,col.HPD=2,lty.HPD=1,lwd.HPD=2)
lines(km)

# Plot survival function
plot(tbs.be,plot.type="hazard",lwd=2,HPD=TRUE,HPD.alpha=0.95,col.HPD=2,lty.HPD=1,lwd.HPD=2)

# Plot auto-correlation of the posterior sample
plot(tbs.be,plot.type="auto")

# Plot "time-series" of the posterior sample
plot(tbs.be,plot.type="ts")

Run the code above in your browser using DataLab