Description Usage Arguments Details Value References See Also Examples
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’).
1 2 3 | 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)
|
formula |
A formula specification containing a Surv model with right-censored (or no censored) data as in the package survival. |
dist |
Error distribution; |
max.time |
Maximum time (in minutes) to run the optimization (<= 0 means no limit). |
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. |
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’).
An element of the class tbs.survreg.be, with the components:
call |
function evaluated. |
x |
co-variable matrix used. |
time |
survival time. |
delta |
censor status. |
post |
posterior sample of the parameters. |
lambda |
posterior mean of lambda. |
xi |
posterior mean of xi. |
beta |
vector with posterior mean of beta. |
lamda.sd |
standard deviation for lambda. |
xi.sd |
standard deviation of for xi. |
beta.sd |
standard deviation of for beta. |
lambda.HPD |
95% high posterior density credal interval of lambda. |
xi.HPD |
95% high posterior density credal interval of xi. |
beta.HPD |
95% high posterior density credal interval vector of beta. |
DIC |
Deviance Information Criterion. |
error |
summary statistics for the posterior of error of TBS model. |
error.dist |
error distribution. |
run.time |
Time spent with the function. |
Meeker, W. and Escobar, L. (1998) Statistical Methods for Reliability Data. Willey, ISBN 0-471-14328-6.
dist.error,tbs.survreg.mle,dtbs,ptbs,qtbs,rtbs
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | # 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")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.