The function UPHN() defines the Unit-Power Half-Normal distribution, a two parameter distribution, for a gamlss.family object to be used in GAMLSS fitting using the function gamlss().

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

Arguments

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

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 COMPO distribution in the gamlss() function.

Details

The UPHN distribution with parameters \(\mu\) and \(\sigma\) has a support in \((0, 1)\) and density given by

\(f(x| \mu, \sigma) = \frac{2\mu}{\sigma x^2} \phi(\frac{1-x}{\sigma x}) (2 \Phi(\frac{1-x}{\sigma x})-1)^{\mu-1}\)

for \(0 < x < 1\), \(\mu > 0\) and \(\sigma > 0\).

References

Santoro, K. I., Gómez, Y. M., Soto, D., & Barranco-Chamorro, I. (2024). Unit-Power Half-Normal Distribution Including Quantile Regression with Applications to Medical Data. Axioms, 13(9), 599.

See also

Author

Juan Diego Suarez Hernandez, jsuarezhe@unal.edu.co

Examples

# Example 1
# Generating random values with
# known mu and sigma
require(gamlss)
mu <- 1.5
sigma <- 4.0

y <- rUPHN(1000, mu, sigma)

mod1 <- gamlss(y~1, sigma.fo=~1,  family=UPHN,
               control=gamlss.control(n.cyc=5000, trace=TRUE))
#> GAMLSS-RS iteration 1: Global Deviance = 1111.564 
#> GAMLSS-RS iteration 2: Global Deviance = -1163.97 
#> GAMLSS-RS iteration 3: Global Deviance = -1411.934 
#> GAMLSS-RS iteration 4: Global Deviance = -1443.037 
#> GAMLSS-RS iteration 5: Global Deviance = -1447.353 
#> GAMLSS-RS iteration 6: Global Deviance = -1447.915 
#> GAMLSS-RS iteration 7: Global Deviance = -1448.02 
#> GAMLSS-RS iteration 8: Global Deviance = -1448.031 
#> GAMLSS-RS iteration 9: Global Deviance = -1448.028 
#> GAMLSS-RS iteration 10: Global Deviance = -1448.025 
#> GAMLSS-RS iteration 11: Global Deviance = -1448.024 
#> GAMLSS-RS iteration 12: Global Deviance = -1448.024 

exp(coef(mod1, what="mu"))
#> (Intercept) 
#>    1.455427 
exp(coef(mod1, what="sigma"))
#> (Intercept) 
#>    4.000252 

# Example 2
# Generating random values under some model

# A function to simulate a data set with Y ~ UPHN
gendat <- function(n) {
  x1 <- runif(n)
  x2 <- runif(n)
  mu <- exp(0.75 - 0.69 * x1)   # Approx 1.5
  sigma <- exp(0.5 - 0.64 * x2) # Approx 1.20
  y <- rUPHN(n, mu, sigma)
  data.frame(y=y, x1=x1, x2=x2)
}

dat <- gendat(n=2000)

mod2 <- gamlss(y~x1, sigma.fo=~x2, family=UPHN, data=dat,
               control=gamlss.control(n.cyc=5000, trace=TRUE))
#> GAMLSS-RS iteration 1: Global Deviance = -1750.84 
#> GAMLSS-RS iteration 2: Global Deviance = -1788.458 
#> GAMLSS-RS iteration 3: Global Deviance = -1794.222 
#> GAMLSS-RS iteration 4: Global Deviance = -1795.388 
#> GAMLSS-RS iteration 5: Global Deviance = -1795.593 
#> GAMLSS-RS iteration 6: Global Deviance = -1795.631 
#> GAMLSS-RS iteration 7: Global Deviance = -1795.638 
#> GAMLSS-RS iteration 8: Global Deviance = -1795.641 
#> GAMLSS-RS iteration 9: Global Deviance = -1795.641 

summary(mod2)
#> Warning: summary: vcov has failed, option qr is used instead
#> ******************************************************************
#> Family:  c("UPHN", "Unit-Power Half-Normal") 
#> 
#> Call:  gamlss(formula = y ~ x1, sigma.formula = ~x2, family = UPHN,  
#>     data = dat, control = gamlss.control(n.cyc = 5000, trace = TRUE)) 
#> 
#> Fitting method: RS() 
#> 
#> ------------------------------------------------------------------
#> Mu link function:  log
#> Mu Coefficients:
#>             Estimate Std. Error t value Pr(>|t|)    
#> (Intercept)  0.77875    0.04598   16.94   <2e-16 ***
#> x1          -0.81858    0.07739  -10.58   <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)  0.51302    0.02703   18.98   <2e-16 ***
#> x2          -0.65168    0.04496  -14.49   <2e-16 ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> ------------------------------------------------------------------
#> No. of observations in the fit:  2000 
#> Degrees of Freedom for the fit:  4
#>       Residual Deg. of Freedom:  1996 
#>                       at cycle:  9 
#>  
#> Global Deviance:     -1795.641 
#>             AIC:     -1787.641 
#>             SBC:     -1765.238 
#> ******************************************************************