Learn R Programming

RelDists (version 1.0.2)

BS5: The Birnbaum-Saunders family - Santos-Neto et al. (2012) (P3 Based on GLM)

Description

The function BS5() defines the Birnbaum-Saunders distribution, a two-parameter distribution, for a gamlss.family object to be used in GAMLSS fitting using the function gamlss().

Usage

BS5(mu.link = "log", sigma.link = "log")

Value

Returns a gamlss.family object which can be used to fit a BS5 distribution in the gamlss() function.

Arguments

mu.link

defines the mu.link, with "log" link as the default for the mu parameter.

sigma.link

defines the sigma.link, with "log" link as the default for the sigma parameter.

Author

David Villegas Ceballos, david.villegas1@udea.edu.co

Details

The Birnbaum-Saunders distribution with parameters mu and sigma (where sigma represents the precision parameter \(\delta\)) has density given by

\(f(x|\mu,\sigma) = \frac{\exp(\sigma/2)\sqrt{\sigma+1}}{4\sqrt{\pi\mu}x^{3/2}} \left[ x + \frac{\sigma\mu}{\sigma+1} \right] \exp\left( -\frac{\sigma}{4} \left[ \frac{x(\sigma+1)}{\sigma\mu} + \frac{\sigma\mu}{x(\sigma+1)} \right] \right)\)

for \(x>0\), \(\mu>0\) and \(\sigma>0\). In this parameterization, \(E(X) = \mu\) and \(Var(X) = \mu^2 \left[ \frac{2\sigma+5}{(\sigma+1)^2} \right]\).

References

Santos-Neto, M., Cysneiros, F. J. A., Leiva, V., & Ahmed, S. E. (2012). On new parameterizations of the Birnbaum-Saunders distribution. Pakistan Journal of Statistics, 28(1), 1-26.

See Also

dBS5.

Examples

Run this code
# Example 1
# Generating some random values with
# known mu and sigma
set.seed(123)
y <- rBS5(n=50, mu=1, sigma=25)

# Fitting the model
require(gamlss)
mod1 <- gamlss(y~1, sigma.fo=~1, family=BS5)

# Extracting the fitted values for mu and sigma
# using the inverse link function
exp(coef(mod1, what="mu"))
exp(coef(mod1, what="sigma"))

# Example 2
# Generating random values for a regression model

# A function to simulate a data set with Y ~ BS5
gendat <- function(n) {
  x1 <- runif(n)
  x2 <- runif(n)
  mu <- exp(1.5 - 3 * x1)        # Aprox 1
  sigma <- exp(2.4 + 1.7 * x2)   # Aprox 25
  y <- rBS5(n=n, mu=mu, sigma=sigma)
  data.frame(y=y, x1=x1, x2=x2)
}

dat <- gendat(n=100)

mod2 <- gamlss(y~x1, sigma.fo=~x2, 
               family=BS5, data=dat)

summary(mod2)

Run the code above in your browser using DataLab