Title: | Quantile Regression Modeling for Unit-Gompertz Responses |
---|---|
Description: | Unit-Gompertz density, cumulative distribution, quantile functions and random deviate generation of the unit-Gompertz distribution. In addition, there are a function for fitting the Generalized Additive Models for Location, Scale and Shape. |
Authors: | Josmar Mazucheli [aut, cre], Bruna Alves [ctb] |
Maintainer: | Josmar Mazucheli <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.0.0 |
Built: | 2025-03-01 03:35:08 UTC |
Source: | https://github.com/cran/ugomquantreg |
The ugomquantreg package implements the probability density function, quantile function, cumulative distribution function and random number generation function for unit-Gompertz distribution parameterized as a function of its -th quantile,
. Some function are written in C++ using Rcpp.
ammonia
: Ammonia oxidized to acid nitric data set.
bodyfat
: Body fat data set.
UGOM
: For quantile modeling (con/in)ditional on covariate(s).
Josmar Mazucheli [email protected]
Bruna Alves [email protected]
The data come from experiments with a plant where ammonia is oxidized to acid nitric.
data(ammonia, package = "ugomquantreg")
data(ammonia, package = "ugomquantreg")
A data-frame with 21 observations and 4 columns:
stackloss
: the percentage of ammonia lost.
airflow
: the air flow to the plant.
watertemp
: the cooling water inlet temperature.
acidconc
: the acid concentration.
Josmar Mazucheli [email protected]
Bruna Alves [email protected]
https://support.sas.com/rnd/app/stat/examples/BayesQuantile/quantile.htm
Brownlee, K. A., (1965). Statistical Theory and Methodology in Science and Engineering. New York: John Wiley & Sons.
Yu, K., and Moyeed, R. A., (2001). Bayesian quantile regression. Statistics and Probability Letters, 54(4) 437–447.
data(ammonia, package = "ugomquantreg") library(gamlss) tau <- 0.50 fit.logit <- gamlss(stackloss ~ airflow + watertemp + acidconc, data = ammonia, family = UGOM(sigma.link="identity")) tau <- 0.50 fit.probit <- gamlss(stackloss ~ airflow + watertemp + acidconc, data = ammonia, family = UGOM(mu.link = "probit", sigma.link = "log")) fittaus <- lapply(c(0.10, 0.25, 0.50, 0.75, 0.90), function(Tau){ tau <<- Tau; gamlss(stackloss ~ airflow + watertemp + acidconc, data = ammonia, family = UGOM(mu.link = "logit", sigma.link = "log")) }) sapply(fittaus, coef)
data(ammonia, package = "ugomquantreg") library(gamlss) tau <- 0.50 fit.logit <- gamlss(stackloss ~ airflow + watertemp + acidconc, data = ammonia, family = UGOM(sigma.link="identity")) tau <- 0.50 fit.probit <- gamlss(stackloss ~ airflow + watertemp + acidconc, data = ammonia, family = UGOM(mu.link = "probit", sigma.link = "log")) fittaus <- lapply(c(0.10, 0.25, 0.50, 0.75, 0.90), function(Tau){ tau <<- Tau; gamlss(stackloss ~ airflow + watertemp + acidconc, data = ammonia, family = UGOM(mu.link = "logit", sigma.link = "log")) }) sapply(fittaus, coef)
The body fat percentage of individuals assisted in a public hospital in Curitiba, Paraná, Brazil.
data(bodyfat, package = "ugomquantreg")
data(bodyfat, package = "ugomquantreg")
A data-frame with 298 observations and 9 columns:
ARMS
: arms fat percentage.
LEGS
: legs fat percentage.
BODY
: body fat percentage.
ANDROID
: android fat percentage.
GYNECOID
: ginecoid fat percentage.
AGE
: age of individuals.
BMI
: body mass index.
SEX
: 1 for female, 2 for male.
IPAQ
: 0 for IPAQ = sedentary, 1 for IPAQ = insufficiently active and 2 for IPAQ = active.
Josmar Mazucheli [email protected]
Bruna Alves [email protected]
http://www.leg.ufpr.br/doku.php/publications:papercompanions:multquasibeta
Mazucheli, J., Leiva, V., Alves, B., and Menezes A. F. B., (2021). A new quantile regression for modeling bounded data under a unit Birnbaum-Saunders distribution with applications in medicine and politics. Symmetry, 13(4) 1–21.
Petterle, R. R., Bonat, W. H., Scarpin, C. T., Jonasson, T., and Borba, V. Z. C., (2020). Multivariate quasi-beta regression models for continuous bounded data. The International Journal of Biostatistics, 1–15, (preprint).
data(bodyfat, package = "ugomquantreg") library(gamlss) tau <- 0.50 fit.logit <- gamlss(ARMS ~ AGE + I(BMI / 100) + as.factor(SEX) + as.factor(IPAQ), data = bodyfat, family = UGOM(mu.link = "logit", sigma.link = "log")) tau <- 0.50; fit.probit <- gamlss(ARMS ~ AGE + I(BMI / 100) + as.factor(SEX) + as.factor(IPAQ), data = bodyfat, family = UGOM(mu.link = "probit", sigma.link = "log"))
data(bodyfat, package = "ugomquantreg") library(gamlss) tau <- 0.50 fit.logit <- gamlss(ARMS ~ AGE + I(BMI / 100) + as.factor(SEX) + as.factor(IPAQ), data = bodyfat, family = UGOM(mu.link = "logit", sigma.link = "log")) tau <- 0.50; fit.probit <- gamlss(ARMS ~ AGE + I(BMI / 100) + as.factor(SEX) + as.factor(IPAQ), data = bodyfat, family = UGOM(mu.link = "probit", sigma.link = "log"))
The function UGOM()
define the unit-Gompertz distribution for a gamlss.family
object to be used in GAMLSS fitting. UGOM()
has the -th quantile equal to the parameter mu and sigma as the shape parameter. The functions
dUGOM
, pUGOM
, qUGOM
and rUGOM
define the density, distribution function, quantile function and random generation for unit-Gompertz distribution.
dUGOM(x, mu, sigma, tau = 0.5, log = FALSE) pUGOM(q, mu, sigma, tau = 0.5, lower.tail = TRUE, log.p = FALSE) qUGOM(p, mu, sigma, tau = 0.5, lower.tail = TRUE, log.p = FALSE) rUGOM(n, mu, sigma, tau = 0.5) UGOM(mu.link = "logit", sigma.link = "log")
dUGOM(x, mu, sigma, tau = 0.5, log = FALSE) pUGOM(q, mu, sigma, tau = 0.5, lower.tail = TRUE, log.p = FALSE) qUGOM(p, mu, sigma, tau = 0.5, lower.tail = TRUE, log.p = FALSE) rUGOM(n, mu, sigma, tau = 0.5) UGOM(mu.link = "logit", sigma.link = "log")
x , q
|
vector of quantiles on the (0,1) interval. |
mu |
vector of quantile parameter values. |
sigma |
vector of shape parameter values. |
tau |
the |
log , log.p
|
logical; If TRUE, probabilities p are given as log(p). |
lower.tail |
logical; If TRUE, (default), |
p |
vector of probabilities. |
n |
the number of observations. If |
mu.link |
the mu link function with default logit. |
sigma.link |
the sigma link function with default logit. |
Probability density function
Cumulative distribution function
Mean
where ,
is, for a fixed and known value of
, the
-th quantile,
is the shape parameter and
is the upper incomplete gamma function.
UGOM()
return a gamlss.family object which can be used to fit a unit-Gompertz distribution by gamlss() function.
Note that for UGOM()
, mu is the -th quantile and sigma a shape parameter. The
gamlss
function is used for parameters estimation.
Josmar Mazucheli [email protected]
Bruna Alves [email protected]
Hastie, T. J. and Tibshirani, R. J. (1990). Generalized Additive Models. Chapman and Hall, London.
Mazucheli, J., Alve, B. (2021). The Unit-Gompertz quantile regression model for bounded responses. preprint, 0(0), 1-20.
Mazucheli, J., Menezes, A. F. and Dey S. (2019). Unit-Gompertz distribution with applications. Statistica, 79(1), 25–43.
Rigby, R. A. and Stasinopoulos, D. M. (2005). Generalized additive models for location, scale and shape (with discussion). Applied. Statistics, 54(3), 507–554.
Rigby, R. A., Stasinopoulos, D. M., Heller, G. Z. and De Bastiani, F. (2019). Distributions for modeling location, scale, and shape: Using GAMLSS in R. Chapman and Hall/CRC.
Stasinopoulos, D. M. and Rigby, R. A. (2007) Generalized additive models for location scale and shape (GAMLSS) in R. Journal of Statistical Software, 23(7), 1–45.
Stasinopoulos, D. M., Rigby, R. A., Heller, G., Voudouris, V. and De Bastiani F. (2017) Flexible Regression and Smoothing: Using GAMLSS in R, Chapman and Hall/CRC.
set.seed(123) x <- rUGOM(n = 1000, mu = 0.50, sigma = 1.69, tau = 0.50) R <- range(x) S <- seq(from = R[1], to = R[2], length.out = 1000) hist(x, prob = TRUE, main = 'unit-Gompertz') lines(S, dUGOM(x = S, mu = 0.50, sigma = 1.69, tau = 0.50), col = 2) plot(ecdf(x)) lines(S, pUGOM(q = S, mu = 0.50, sigma = 1.69, tau = 0.50), col = 2) plot(quantile(x, probs = S), type = "l") lines(qUGOM(p = S, mu = 0.50, sigma = 1.69, tau = 0.50), col = 2) library(gamlss) set.seed(123) data <- data.frame(y = rUGOM(n = 100, mu = 0.5, sigma = 2.0, tau = 0.5)) tau <- 0.50 fit <- gamlss(y ~ 1, data = data, family = UGOM) set.seed(123) n <- 100 x <- rbinom(n, size = 1, prob = 0.5) eta <- 0.5 + 1 * x; mu <- 1 / (1 + exp(-eta)); sigma <- 1.5; y <- rUGOM(n, mu, sigma, tau = 0.5) data <- data.frame(y, x) tau <- 0.50 fit <- gamlss(y ~ x, data = data, family = UGOM(mu.link = "logit", sigma.link = "log"))
set.seed(123) x <- rUGOM(n = 1000, mu = 0.50, sigma = 1.69, tau = 0.50) R <- range(x) S <- seq(from = R[1], to = R[2], length.out = 1000) hist(x, prob = TRUE, main = 'unit-Gompertz') lines(S, dUGOM(x = S, mu = 0.50, sigma = 1.69, tau = 0.50), col = 2) plot(ecdf(x)) lines(S, pUGOM(q = S, mu = 0.50, sigma = 1.69, tau = 0.50), col = 2) plot(quantile(x, probs = S), type = "l") lines(qUGOM(p = S, mu = 0.50, sigma = 1.69, tau = 0.50), col = 2) library(gamlss) set.seed(123) data <- data.frame(y = rUGOM(n = 100, mu = 0.5, sigma = 2.0, tau = 0.5)) tau <- 0.50 fit <- gamlss(y ~ 1, data = data, family = UGOM) set.seed(123) n <- 100 x <- rbinom(n, size = 1, prob = 0.5) eta <- 0.5 + 1 * x; mu <- 1 / (1 + exp(-eta)); sigma <- 1.5; y <- rUGOM(n, mu, sigma, tau = 0.5) data <- data.frame(y, x) tau <- 0.50 fit <- gamlss(y ~ x, data = data, family = UGOM(mu.link = "logit", sigma.link = "log"))