The Unit Half Logistic-Geometry family
UHLG(mu.link = "log")
Returns a gamlss.family object which can be used to fit a UHLG distribution in the gamlss()
function.
The Unit Half Logistic-Geometry distribution with parameter mu
,
has density given by
\(f(x| \mu) = \frac{2 \mu}{(\mu+(2-\mu)x)^2} \)
for \(0 < x < 1\) and \(\mu > 0\).
Ramadan, A. T., Tolba, A. H., & El-Desouky, B. S. (2022). A unit half-logistic geometric distribution and its application in insurance. Axioms, 11(12), 676.
# Example 1
# Generating some random values with
# known mu
y <- rUHLG(n=500, mu=7)
# Fitting the model
library(gamlss)
mod1 <- gamlss(y~1, family=UHLG,
control=gamlss.control(n.cyc=500, trace=FALSE))
# Extracting the fitted values for mu, sigma and nu
# using the inverse link function
exp(coef(mod1, what="mu"))
#> (Intercept)
#> 7.12861
# Example 2
# Generating random values under some model
# A function to simulate a data set with Y ~ UHLG
gendat <- function(n) {
x1 <- runif(n, min=0.4, max=0.6)
x2 <- runif(n, min=0.4, max=0.6)
mu <- exp(-0.5 + 3*x1 - 2.5*x2)
y <- rUHLG(n=n, mu=mu)
data.frame(y=y, x1=x1, x2=x2)
}
datos <- gendat(n=5000)
mod2 <- gamlss(y~x1+x2,
family=UHLG, data=datos,
control=gamlss.control(n.cyc=500, trace=TRUE))
#> GAMLSS-RS iteration 1: Global Deviance = -1653.112
#> GAMLSS-RS iteration 2: Global Deviance = -1653.112
summary(mod2)
#> Warning: summary: vcov has failed, option qr is used instead
#> ******************************************************************
#> Family: c("UHLG", "Unit Half Logistic-Geometry")
#>
#> Call:
#> gamlss(formula = y ~ x1 + x2, family = UHLG, data = datos, control = gamlss.control(n.cyc = 500,
#> trace = TRUE))
#>
#> Fitting method: RS()
#>
#> ------------------------------------------------------------------
#> Mu link function: log
#> Mu Coefficients:
#> Estimate Std. Error t value Pr(>|t|)
#> (Intercept) -0.3844 0.2954 -1.301 0.193
#> x1 3.0058 0.4186 7.180 8.01e-13 ***
#> x2 -2.8201 0.4187 -6.735 1.83e-11 ***
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#>
#> ------------------------------------------------------------------
#> No. of observations in the fit: 5000
#> Degrees of Freedom for the fit: 3
#> Residual Deg. of Freedom: 4997
#> at cycle: 2
#>
#> Global Deviance: -1653.112
#> AIC: -1647.112
#> SBC: -1627.56
#> ******************************************************************