Package 'bibs'

Title: Bayesian Inference for the Birnbaum-Saunders Distribution
Description: Developed for the following tasks. 1- Simulating and computing the maximum likelihood estimator for the Birnbaum-Saunders (BS) distribution, 2- Computing the Bayesian estimator for the parameters of the BS distribution based on reference prior proposed by Xu and Tang (2010) <doi:10.1016/j.csda.2009.08.004> and conjugate prior. 3- Computing the Bayesian estimator for the BS distribution based on conjugate prior. 4- Computing the Bayesian estimator for the BS distribution based on Jeffrey prior given by Achcar (1993) <doi:10.1016/0167-9473(93)90170-X> 5- Computing the Bayesian estimator for the BS distribution under progressive type-II censoring scheme.
Authors: Mahdi Teimouri
Maintainer: Mahdi Teimouri <[email protected]>
License: GPL (>= 2)
Version: 1.1.1
Built: 2025-02-20 02:58:07 UTC
Source: https://github.com/cran/bibs

Help Index


Bone mineral content data

Description

The mineral density of three dominant and nondominant of bones measured in g/cm2g/cm^2 johnson1999.

Usage

data(bone)

Format

A text file with 6 columns.

References

R. A. ArnoldJohnson and D. W. Wichern 1999. Applied Multivariate Analysis, Prentice-Hall, New Jersey.

Examples

data(bone)

Computing the Bayesian estimators of the Birnbaum-Saunders (BS) distribution.

Description

Computing the Bayesian estimators of the BS distribution using conjugate prior, that is, conjugate and reference priors. The probability density function of generalized inverse Gaussian (GIG) distribution is given by good1953population

fGIG(xλ,χ,ψ)=12Kλ(ψχ)(ψλ)λ/2xλ1exp{χ2xψx2},f_{{GIG}}(x|\lambda,\chi,\psi)=\frac{1}{2{K}_{\lambda}(\sqrt{\psi \chi})}\Bigl(\frac{\psi}{\lambda}\Bigr)^{\lambda/2}x^{\lambda-1}\exp\biggl\{-\frac{\chi}{2x}-\frac{\psi x}{2}\biggr\},

where x>0x>0, <λ<+-\infty<\lambda <+\infty, ψ>0\psi>0, and χ>0\chi>0 are parameters of this family. The pdf of a inverse gamma (IG) distribution denoted as IG(γ,θ){IG}(\gamma,\theta) is given by

fIG(xγ,θ)=θγxγ1Γ(γ)exp{θx},f_{{IG}}(x|\gamma,\theta)=\frac{\theta^{\gamma} x^{-\gamma-1}}{\Gamma(\gamma)}\exp\left\{-\frac{\theta}{x}\right\},

where x>0x>0, γ>0\gamma>0, and θ>0\theta>0 are the shape and scale parameters, respectively.

Usage

conjugatebs(x,gamma0=1,theta0=1,lambda0=0.001,chi0=0.001,psi0=0.001,CI=0.95,M0=800,M=1000)

Arguments

x

Vector of observations.

gamma0

The first hyperparameter of the IG conjugate prior.

theta0

The second hyperparameter of the IG conjugate prior.

lambda0

The first hyperparameter of the GIG conjugate prior.

chi0

The second hyperparameter of the GIG conjugate prior.

psi0

The third hyperparameter of the GIG conjugate prior.

CI

Confidence level for constructing percentile and asymptotic confidence intervals. That is 0.95 by default.

M0

The number of sampler runs considered as burn-in.

M

The number of total sampler runs.

Value

A list including summary statistics of a Gibbs sampler for Bayesian inference including point estimation for the parameter, its standard error, and the corresponding 100(1α)%100(1-\alpha)\% credible interval, goodness-of-fit measures, asymptotic 100(1α)%100(1-\alpha)\% confidence interval (CI) and corresponding standard errors, and Fisher information matix.

Author(s)

Mahdi Teimouri

References

I. J. Good 1953. The population frequencies of species and the estimation of population parameters. Biometrika, 40(3-4):237-264.

Examples

data(fatigue)
x <- fatigue
conjugatebs(x,gamma0=1,theta0=1,lambda0=0.001,chi0=0.001,psi0=0.001,CI=0.95,M0=800,M=1000)

Fatigue data

Description

A set of 101 observations obtained by Birnbaum and Saunders(1969) from fatigue life of 6061-T6 aluminum coupons cut parallel to the direction of rolling and oscillated at 18 cycles per second (cps).

Usage

data(fatigue)

Format

A text file with 1 column.

References

Z. W. Birnbaum and S. C. Saunders 1969. Estimation for a family of life distributions with applications to fatigue. Journal of Applied Probability, 328-347.

Examples

data(fatigue)

Computing the Bayesian estimators of the Birnbaum-Saunders (BS) distribution.

Description

Computing the Bayesian estimators of the BS distribution based on approximated Jeffreys prior proposed by Achcar (1993). The approximated Jeffreys piors is πj(α,β)1αβ1α2+14\pi_{j}(\alpha,\beta)\propto\frac{1}{\alpha\beta}\sqrt{\frac{1}{\alpha^2}+\frac{1}{4}}.

Usage

Jeffreysbs(x, CI = 0.95, M0 = 800, M = 1000)

Arguments

x

Vector of observations.

CI

Confidence level for constructing percentile and asymptotic confidence intervals. That is 0.95 by default.

M0

The number of sampler runs considered as burn-in.

M

The number of total sampler runs.

Value

A list including summary statistics of a Gibbs sampler for the Bayesian inference including point estimation for the parameter, its standard error, and the corresponding 100(1α)%100(1-\alpha)\% credible interval, goodness-of-fit measures, asymptotic 100(1α)%100(1-\alpha)\% confidence interval (CI) and corresponding standard errors, and Fisher information matix.

Author(s)

Mahdi Teimouri

References

J. A. Achcar 1993. Inferences for the Birnbaum-Saunders fatigue life model using Bayesian methods, Computational Statistics \& Data Analysis, 15 (4), 367-380.

Examples

data(fatigue)
x <- fatigue
Jeffreysbs(x, CI = 0.95, M0 = 800, M = 1000)

Computing the maximum likelihood (ML) estimator for the generalized Birnbaum-Saunders (GBS) distribution.

Description

Computing the ML estimator for the GBS distribution proposed by Owen (2006) whose density function is given by

fGBS(tα,β,ν)=(1ν)t+νβ2παβtν+1exp{(tβ)22α2βt2ν},f_{{GBS}}(t|\alpha,\beta,\nu)=\frac{(1-\nu)t +\nu \beta}{\sqrt{2\pi}\alpha \sqrt{\beta}t^{\nu+1}} \exp\left\{-\frac{(t-\beta)^2}{2\alpha^2\beta t^{2\nu}}\right\},

where t>0t>0. The parameters of GBS distribution are α>0\alpha>0, β>0\beta>0, and 0<ν<10<\nu<1. For ν=0.5\nu=0.5, the GBS distribution turns into the ordinary Birnbaum-Saunders distribution.

Usage

mlebs(x, start, method = "Nelder-Mead", CI = 0.95)

Arguments

x

Vector of observations.

start

Vector of the initial values.

method

The method for the numerically optimization that includes one of CG,Nelder-Mead, BFGS, L-BFGS-B, and SANN.

CI

Confidence level for constructing asymptotic confidence intervals. That is 0.95 by default.

Value

A list including the ML estimator, goodness-of-fit measures, asymptotic 100(1α)%100(1-\alpha)\% confidence interval (CI) and corresponding standard errors, and Fisher information matix.

Author(s)

Mahdi Teimouri

Examples

data(fatigue)
x <- fatigue
mlebs(x, start = c(1, 29), method = "Nelder-Mead", CI = 0.95)

Plasma survival data

Description

The plasma survival data contains the Survival times of plasma cell myeloma for 112 patients, see Carbone et al. (1967).

Usage

data(plasma)

Format

A text file with 4 columns.

References

P. P. Carbone, L. E. Kellerhouse, and E. A. Gehan 1967. Plasmacytic myeloma: A study of the relationship of survival to various clinical manifestations and anomalous protein type in 112 patients. The American Journal of Medicine, 42 (6), 937-48.

Examples

data(plasma)

Simulating from Birnbaum-Saunders (BS) distribution.

Description

Simulating from BS distribution whose density function is given by

fBS(tα,β)=0.5t+0.5β2παβt32exp{(tβ)22α2βt},f_{{BS}}(t|\alpha,\beta)=\frac{0.5t +0.5 \beta}{\sqrt{2\pi}\alpha \sqrt{\beta}t^{\frac{3}{2}}} \exp\left\{-\frac{(t-\beta)^2}{2\alpha^2\beta t}\right\},

where tt>0. The parameters of GBS distribution are α\alpha>0 and β\beta>0.

Usage

rbs(n, alpha, beta)

Arguments

n

Size of required realizations.

alpha

Parameter alphaalpha.

beta

Parameter betabeta.

Value

A vector of nn realizations from distribution.

Author(s)

Mahdi Teimouri

Examples

rbs(n = 100, alpha = 1, beta = 2)

Computing the Bayesian estimators of the Birnbaum-Saunders (BS) distribution.

Description

Computing the Bayesian estimators of the BS distribution using reference prior proposed by Berger and Bernardo(1989). The joint distribution of the priors is π(α,β)=1/(α,β)\pi(\alpha,\beta)=1/(\alpha,\beta).

Usage

referencebs(x, CI = 0.95, M0 = 800, M = 1000)

Arguments

x

Vector of observations.

CI

Confidence level for constructing percentile and asymptotic confidence intervals. That is 0.95 by default.

M0

The number of sampler runs considered as burn-in.

M

The number of total sampler runs.

Value

A list including summary statistics of a Gibbs sampler for Bayesian inference including point estimation for the parameter, its standard error, and the corresponding 100(1α)%100(1-\alpha)\% credible interval, goodness-of-fit measures, asymptotic 100(1α)%100(1-\alpha)\% confidence interval (CI) and corresponding standard errors, and Fisher information matix.

Author(s)

Mahdi Teimouri

References

J. O. Berger and J. M. Bernardo 1989. Estimating a product of means: Bayesian analysis with reference priors. Journal of the American Statistical Association, 84(405), 200-207.

Examples

data(fatigue)
x <- fatigue
referencebs(x, CI = 0.95, M0 = 800, M = 1000)

Bayesian estimator for the Birnbaum-Saunders family under progressive type-II censoring scheme.

Description

Estimates parameters of the Birnbaum-Saunders family in a Bayesian framework through the Metropolis-Hasting algorithm when subjects are placed on progressive type-II censoring scheme with likelihood function

l(α,βx1:m:n,,xm:m:n)=logL(Θ)Ci=1mlogf(xi:m:n;α,β)+i=1mRilog[1F(xi:m:n;α,β)],l(\alpha,\beta|x_{1:m:n},\dots,x_{m:m:n})=\log L(\Theta) \propto C \sum_{i=1}^{m} \log f(x_{i:m:n}{{;}}|\alpha,\beta) + \sum_{i=1}^{m} R_i \log \bigl[1-F(x_{i:m:n}{{;}}|\alpha,\beta)\bigr],

in which F(.α,β)F(.|\alpha,\beta) is cumulative distribution function of the Birnbaum-Saunders family with C=n(nR11)(nR1R22)(nR1R2Rm1m+1)C=n(n-R_1-1)(n-R_1-R_2-2)\dots (n-R_1-R_2-\dots-R_{m-1}-m+1). The acceptance for each new sample of α\alpha and β\beta, respectively, becomes

Aα=min{1,i=1m[1FBS(ti:m:n1/(αnew)2,β)]Ri[1FBS(ti:m:n1/(αold)2,β)]Ri}A_{\alpha}=\min \left\{1,\prod_{i=1}^{m}\frac{\bigl[1-F_{BS}(t_{i:m:n}|1/(\alpha^{new})^2,\beta)\bigr]^{R_{i}}}{\bigl[1-F_{BS}(t_{i:m:n}|1/(\alpha_{old})^2,\beta)\bigr]^{R_{i}}}\right\}

,

Aβ=min{1,i=1m[1FBS(ti:m:nα,βnew)]Ri[1FBS(ti:m:nα,βold)]Ri}.A_{\beta}=\min \left\{1,\prod_{i=1}^{m}\frac{\bigl[1-F_{BS}(t_{i:m:n}|\alpha,\beta^{new})\bigr]^{R_{i}}}{\bigl[1-F_{BS}(t_{i:m:n}|\alpha,\beta_{old})\bigr]^{R_{i}}}\right\}.

Usage

typeIIbs(plan, M0 = 4000, M = 6000, CI = 0.95)

Arguments

plan

Censoring plan for progressive type-II censoring scheme. It must be given as a data.frame including: number of item placed on the test at time zero and a vector that contains number R, of the removed alive items.

M0

The number of sampler runs considered as burn-in.

M

The number of total sampler runs.

CI

Confidence or coverage level for constructing percentile confidence interval. That is 0.95 by default.

Value

A list including summary statistics after burn-in point including: mean, median, standard deviation, 100(1 - CI)/2 percentile, 100(1/2 + CI/2) percentile.

Author(s)

Mahdi Teimouri

References

M. Teimouri and S. Nadarajah 2016. Bias corrected MLEs under progressive type-II censoring scheme, Journal of Statistical Computation and Simulation, 86 (14), 2714-2726.

N. Balakrishnan and R. Aggarwala 2000. Progressive Censoring: Theory, Methods, and Applications. Springer Science &\& Business Media, New York.

Examples

data(plasma)
typeIIbs(plan = plasma, M0 = 100, M = 200, CI = 0.95)

Starting message when loading package bibs

Description

It contains a welcome message for user of package bibs.

Value

Welcome message for user of bibs package.