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 UPHN 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., Gomez, 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 = 1518.492 
#> GAMLSS-RS iteration 2: Global Deviance = -1065.72 
#> GAMLSS-RS iteration 3: Global Deviance = -1364.303 
#> GAMLSS-RS iteration 4: Global Deviance = -1402.888 
#> GAMLSS-RS iteration 5: Global Deviance = -1407.975 
#> GAMLSS-RS iteration 6: Global Deviance = -1408.601 
#> GAMLSS-RS iteration 7: Global Deviance = -1408.668 
#> GAMLSS-RS iteration 8: Global Deviance = -1408.668 

exp(coef(mod1, what="mu"))
#> (Intercept) 
#>    1.434425 
exp(coef(mod1, what="sigma"))
#> (Intercept) 
#>    4.099077 

# 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 = -1778.125 
#> GAMLSS-RS iteration 2: Global Deviance = -1815.53 
#> GAMLSS-RS iteration 3: Global Deviance = -1821.038 
#> GAMLSS-RS iteration 4: Global Deviance = -1821.863 
#> GAMLSS-RS iteration 5: Global Deviance = -1822.034 
#> GAMLSS-RS iteration 6: Global Deviance = -1822.07 
#> GAMLSS-RS iteration 7: Global Deviance = -1822.078 
#> GAMLSS-RS iteration 8: Global Deviance = -1822.08 
#> GAMLSS-RS iteration 9: Global Deviance = -1822.081 

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.75098    0.04428  16.960   <2e-16 ***
#> x1          -0.74147    0.07808  -9.497   <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.49618    0.02720   18.24   <2e-16 ***
#> x2          -0.61927    0.04498  -13.77   <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:     -1822.081 
#>             AIC:     -1814.081 
#>             SBC:     -1791.677 
#> ******************************************************************