The function DGEII() defines the Discrete generalized exponential distribution of a Second type a two parameter distribution, for a gamlss.family object to be used in GAMLSS fitting using the function gamlss().

DGEII(mu.link = "logit", sigma.link = "log")

Arguments

defines the mu.link, with "logit" link as the default for the mu parameter. Other links are "probit" and "cloglog"'(complementary log-log).

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

Value

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

Details

The DGEII distribution with parameters \(\mu\) and \(\sigma\) has a support 0, 1, 2, ... and mass function given by

\(f(x | \mu, \sigma) = (1-\mu^{x+1})^{\sigma}-(1-\mu^x)^{\sigma}\)

with \(0 < \mu < 1\) and \(\sigma > 0\). If \(\sigma=1\), the DGEII distribution reduces to the geometric distribution with success probability \(1-\mu\).

Note: in this implementation we changed the original parameters \(p\) to \(\mu\) and \(\alpha\) to \(\sigma\), we did it to implement this distribution within gamlss framework.

References

Nekoukhou, V., Alamatsaz, M. H., & Bidram, H. (2013). Discrete generalized exponential distribution of a second type. Statistics, 47(4), 876-887.

See also

Author

Valentina Hurtado Sepúlveda, vhurtados@unal.edu.co

Examples

# Example 1
# Generating some random values with
# known mu and sigma

y <- rDGEII(n=100, mu=0.75, sigma=0.5)

# Fitting the model
library(gamlss)
mod1 <- gamlss(y~1, family=DGEII,
               control=gamlss.control(n.cyc=500, trace=TRUE))
#> GAMLSS-RS iteration 1: Global Deviance = 307.696 

# Extracting the fitted values for mu and sigma
# using the inverse link function
inv_logit <- function(x) 1/(1 + exp(-x))

inv_logit(coef(mod1, what="mu"))
#> (Intercept) 
#>   0.7643695 
exp(coef(mod1, what="sigma"))
#> (Intercept) 
#>   0.3699622 

# Example 2
# Generating random values under some model

# A function to simulate a data set with Y ~ DGEII
gendat <- function(n) {
  x1 <- runif(n)
  x2 <- runif(n)
  mu    <- inv_logit(1.7 - 2.8*x1)
  sigma <- exp(0.73 + 1*x2)
  y <- rDGEII(n=n, mu=mu, sigma=sigma)
  data.frame(y=y, x1=x1, x2=x2)
}

datos <- gendat(n=100)

mod2 <- gamlss(y~x1, sigma.fo=~x2, family=DGEII, data=datos,
               control=gamlss.control(n.cyc=500, trace=TRUE))
#> GAMLSS-RS iteration 1: Global Deviance = 416.673 
#> GAMLSS-RS iteration 2: Global Deviance = 413.3592 
#> GAMLSS-RS iteration 3: Global Deviance = 411.8426 
#> GAMLSS-RS iteration 4: Global Deviance = 411.1347 
#> GAMLSS-RS iteration 5: Global Deviance = 410.7915 
#> GAMLSS-RS iteration 6: Global Deviance = 410.6304 
#> GAMLSS-RS iteration 7: Global Deviance = 410.5605 
#> GAMLSS-RS iteration 8: Global Deviance = 410.5297 
#> GAMLSS-RS iteration 9: Global Deviance = 410.5144 
#> GAMLSS-RS iteration 10: Global Deviance = 410.5065 
#> GAMLSS-RS iteration 11: Global Deviance = 410.5024 
#> GAMLSS-RS iteration 12: Global Deviance = 410.5004 
#> GAMLSS-RS iteration 13: Global Deviance = 410.4987 
#> GAMLSS-RS iteration 14: Global Deviance = 410.4983 

summary(mod2)
#> Warning: summary: vcov has failed, option qr is used instead
#> ******************************************************************
#> Family:  c("DGEII", "Discrete generalized exponential distribution of a second type II" ) 
#> 
#> Call:  gamlss(formula = y ~ x1, sigma.formula = ~x2, family = DGEII,  
#>     data = datos, control = gamlss.control(n.cyc = 500, trace = TRUE)) 
#> 
#> Fitting method: RS() 
#> 
#> ------------------------------------------------------------------
#> Mu link function:  logit
#> Mu Coefficients:
#>             Estimate Std. Error t value Pr(>|t|)    
#> (Intercept)   1.3507     0.1669   8.092 1.62e-12 ***
#> x1           -2.0884     0.3075  -6.791 8.64e-10 ***
#> ---
#> 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)   0.8633     0.2664   3.241  0.00163 **
#> x2            0.9069     0.5552   1.633  0.10558   
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> ------------------------------------------------------------------
#> No. of observations in the fit:  100 
#> Degrees of Freedom for the fit:  4
#>       Residual Deg. of Freedom:  96 
#>                       at cycle:  14 
#>  
#> Global Deviance:     410.4983 
#>             AIC:     418.4983 
#>             SBC:     428.9189 
#> ******************************************************************

# Example 3
# Number of accidents to 647 women working on H. E. Shells
# for 5 weeks. Taken from
# Nekoukhou V, Alamatsaz MH, Bidram H (2013) page 886.

y <- rep(x=0:5, times=c(447, 132, 42, 21, 3, 2))

mod3 <- gamlss(y~1, family=DGEII,
               control=gamlss.control(n.cyc=500, trace=TRUE))
#> GAMLSS-RS iteration 1: Global Deviance = 1184.367 

# Extracting the fitted values for mu and sigma
# using the inverse link function
inv_logit <- function(x) 1/(1 + exp(-x))
inv_logit(coef(mod3, what="mu"))
#> (Intercept) 
#>   0.3378512 
exp(coef(mod3, what="sigma"))
#> (Intercept) 
#>   0.8985223