Skip to contents

The function BS11() 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

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

Arguments

defines the mu.link, with "log" link as the default for the mu parameter (representing \(\beta\)).

defines the sigma.link, with "log" link as the default for the sigma parameter (representing \(\omega\)).

Value

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

Details

The Birnbaum-Saunders distribution with parameters mu and sigma (where mu represents \(\beta\) and sigma represents \(\omega\)) has density given by

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

for \(x>0\), \(\mu>0\) and \(\sigma>0\). In this parameterization, \(E(X) = \mu + \frac{\mu^2}{2\sigma}\) and \(Var(X) = \frac{\mu^3}{\sigma} + \frac{5\mu^4}{4\sigma^2}\).

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

Author

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

Examples

# Example 1
# Generating some random values with
# known mu and sigma
set.seed(1234)
y <- rBS11(n=100, mu=1, sigma=12)

# Fitting the model
require(gamlss)
mod1 <- gamlss(y~1, sigma.fo=~1, family=BS11)
#> GAMLSS-RS iteration 1: Global Deviance = 88.2762 
#> GAMLSS-RS iteration 2: Global Deviance = 12.0081 
#> GAMLSS-RS iteration 3: Global Deviance = 5.8851 
#> GAMLSS-RS iteration 4: Global Deviance = 5.8531 
#> GAMLSS-RS iteration 5: Global Deviance = 5.8531 

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

# Example 2
# Generating random values for a regression model

# A function to simulate a data set with Y ~ BS11
gendat <- function(n) {
  x1 <- runif(n)
  x2 <- runif(n)
  mu <- exp(0.5 - 1 * x1)      # Aprox 1
  sigma <- exp(1.9 + 1.2 * x2)   # Aprox 12
  y <- rBS11(n=n, mu=mu, sigma=sigma)
  data.frame(y=y, x1=x1, x2=x2)
}

set.seed(123)
dat <- gendat(n=200)

mod2 <- gamlss(y~x1, sigma.fo=~x2, 
               family=BS11, data=dat)
#> GAMLSS-RS iteration 1: Global Deviance = 221.0665 
#> GAMLSS-RS iteration 2: Global Deviance = 77.9203 
#> GAMLSS-RS iteration 3: Global Deviance = 65.961 
#> GAMLSS-RS iteration 4: Global Deviance = 65.8782 
#> GAMLSS-RS iteration 5: Global Deviance = 65.878 

summary(mod2)
#> Warning: summary: vcov has failed, option qr is used instead
#> ******************************************************************
#> Family:  c("BS11", "Birnbaum-Saunders - Eleventh parameterization") 
#> 
#> Call:  gamlss(formula = y ~ x1, sigma.formula = ~x2, family = BS11,  
#>     data = dat) 
#> 
#> Fitting method: RS() 
#> 
#> ------------------------------------------------------------------
#> Mu link function:  log
#> Mu Coefficients:
#>             Estimate Std. Error t value Pr(>|t|)    
#> (Intercept)  0.53209    0.04170   12.76   <2e-16 ***
#> x1          -1.06578    0.06499  -16.40   <2e-16 ***
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> 
#> ------------------------------------------------------------------
#> Sigma link function:  log
#> Sigma Coefficients:
#>             Estimate Std. Error t value Pr(>|t|)    
#> (Intercept)   1.7537     0.1995   8.791 7.15e-16 ***
#> x2            1.4892     0.3554   4.190 4.19e-05 ***
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#> 
#> ------------------------------------------------------------------
#> No. of observations in the fit:  200 
#> Degrees of Freedom for the fit:  4
#>       Residual Deg. of Freedom:  196 
#>                       at cycle:  5 
#>  
#> Global Deviance:     65.87796 
#>             AIC:     73.87796 
#>             SBC:     87.07123 
#> ******************************************************************