| Title: | Regression Modeling Using Vasicek Distribution |
|---|---|
| Description: | Provides probability density, cumulative distribution, quantile, and random number generation functions for the Vasicek distribution. In addition, two functions are available for fitting Generalized Additive Models for Location, Scale and Shape introduced by Rigby and Stasinopoulos (2005, <doi:10.1111/j.1467-9876.2005.00510.x>). Some functions are written in 'C++' using 'Rcpp', developed by Eddelbuettel and Francois (2011, <doi:10.18637/jss.v040.i08>). |
| Authors: | Josmar Mazucheli [aut, cre], Bruna Alves [ctb] |
| Maintainer: | Josmar Mazucheli <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.0.2 |
| Built: | 2026-05-14 08:29:42 UTC |
| Source: | https://github.com/jmazucheli/vasicekreg |
The vasicekreg package implements probability density, cumulative
distribution, quantile, and random number generation functions for the
Vasicek distribution parameterized either by its mean or by its
-th quantile, with . In addition, two GAMLSS
frameworks for regression analysis are provided. Some functions are
written in C++ using Rcpp.
bodyfat: Body fat dataset.
VASIM: Mean modeling conditional or
unconditional on covariates.
VASIQ: Quantile modeling conditional or
unconditional on covariates.
Josmar Mazucheli [email protected]
Bruna Alves [email protected]
Percentage of body fat measurements from individuals assisted in a public hospital in Curitiba, Paraná, Brazil.
bodyfatbodyfat
A data frame with 298 observations and 9 variables:
ARMS: arms fat percentage.
LEGS: legs fat percentage.
BODY: body fat percentage.
ANDROID: android fat percentage.
GYNECOID: gynoid fat percentage.
AGE: age of individuals.
BMI: body mass index.
SEX: 1 for female and 2 for male.
IPAQ: physical activity level according to IPAQ
(0 = sedentary, 1 = insufficiently active, 2 = active).
Josmar Mazucheli [email protected]
Bruna Alves [email protected]
Mazucheli, J., Alves, B., Korkmaz, M. Ç., and Leiva, V. (2022). Vasicek quantile and mean regression models for bounded data: New formulation, mathematical derivations, and numerical applications. Mathematics, 10, 1389.
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, 17(1), 39–53.
data(bodyfat, package = "vasicekreg") bodyfat$BMI <- bodyfat$BMI / 100 bodyfat$SEX <- as.factor(bodyfat$SEX) bodyfat$IPAQ <- as.factor(bodyfat$IPAQ) library(gamlss) ## Mean regression model fitmean <- gamlss( ARMS ~ AGE + BMI + SEX + IPAQ, data = bodyfat, family = VASIM(mu.link = "logit", sigma.link = "logit") ) ## Not run: ## Quantile regression models for different tau levels fittaus <- lapply(c(0.10, 0.25, 0.50, 0.75, 0.90), function(Tau) { tau <<- Tau gamlss( ARMS ~ AGE + BMI + SEX + IPAQ, data = bodyfat, family = VASIQ(mu.link = "logit", sigma.link = "logit") ) }) sapply(fittaus, summary) ## End(Not run)data(bodyfat, package = "vasicekreg") bodyfat$BMI <- bodyfat$BMI / 100 bodyfat$SEX <- as.factor(bodyfat$SEX) bodyfat$IPAQ <- as.factor(bodyfat$IPAQ) library(gamlss) ## Mean regression model fitmean <- gamlss( ARMS ~ AGE + BMI + SEX + IPAQ, data = bodyfat, family = VASIM(mu.link = "logit", sigma.link = "logit") ) ## Not run: ## Quantile regression models for different tau levels fittaus <- lapply(c(0.10, 0.25, 0.50, 0.75, 0.90), function(Tau) { tau <<- Tau gamlss( ARMS ~ AGE + BMI + SEX + IPAQ, data = bodyfat, family = VASIQ(mu.link = "logit", sigma.link = "logit") ) }) sapply(fittaus, summary) ## End(Not run)
The function VASIM() defines the Vasicek distribution under
a mean-based parameterization for use as a
gamlss.family object in GAMLSS models. In this formulation,
represents the mean of the distribution and
is a shape parameter. The functions dVASIM,
pVASIM, qVASIM, and rVASIM provide the density,
distribution, quantile, and random generation functions,
respectively.
dVASIM(x, mu, sigma, log = FALSE) pVASIM(q, mu, sigma, lower.tail = TRUE, log.p = FALSE) qVASIM(p, mu, sigma, lower.tail = TRUE, log.p = FALSE) rVASIM(n, mu, sigma) VASIM(mu.link = "logit", sigma.link = "logit")dVASIM(x, mu, sigma, log = FALSE) pVASIM(q, mu, sigma, lower.tail = TRUE, log.p = FALSE) qVASIM(p, mu, sigma, lower.tail = TRUE, log.p = FALSE) rVASIM(n, mu, sigma) VASIM(mu.link = "logit", sigma.link = "logit")
x, q
|
Vector of quantiles in the interval |
mu |
Vector of mean values. |
sigma |
Vector of shape parameter values. |
log, log.p
|
Logical; if |
lower.tail |
Logical; if |
p |
Vector of probabilities. |
n |
Number of observations. |
mu.link |
Link function for the |
sigma.link |
Link function for the |
The probability density function is given by
The cumulative distribution function is
The quantile function is
VASIM() returns a gamlss.family object.
In the VASIM() parameterization, corresponds to the
mean of the distribution and is a shape parameter.
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., Alves, B., Korkmaz, M.Ç., and Leiva, V. (2022). Vasicek quantile and mean regression models for bounded data: New formulation, mathematical derivations, and numerical applications. Mathematics, 10, 1389. doi:10.3390/math10091389
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.
Vasicek, O. A. (1987). Probability of loss on loan portfolio. KMV Corporation.
Vasicek, O. A. (2002). The distribution of loan portfolio value. Risk, 15(12), 1–10.
set.seed(123) x <- rVASIM(n = 1000, mu = 0.5, sigma = 0.69) hist(x, probability = TRUE, main = "Vasicek distribution") ## Not run: library(gamlss) data <- data.frame(y = x[1:100]) fit <- gamlss(y ~ 1, data = data, family = VASIM(mu.link = "logit", sigma.link = "logit")) summary(fit) ## End(Not run)set.seed(123) x <- rVASIM(n = 1000, mu = 0.5, sigma = 0.69) hist(x, probability = TRUE, main = "Vasicek distribution") ## Not run: library(gamlss) data <- data.frame(y = x[1:100]) fit <- gamlss(y ~ 1, data = data, family = VASIM(mu.link = "logit", sigma.link = "logit")) summary(fit) ## End(Not run)
The function VASIQ() defines the Vasicek distribution as a
gamlss.family object to be used in GAMLSS fitting. In this
parameterization, corresponds to the fixed -th
quantile, and is a shape parameter. The functions
dVASIQ, pVASIQ, qVASIQ, and rVASIQ define
the density, distribution function, quantile function, and random
generation for the Vasicek distribution, respectively.
dVASIQ(x, mu, sigma, tau = 0.5, log = FALSE) pVASIQ(q, mu, sigma, tau = 0.5, lower.tail = TRUE, log.p = FALSE) qVASIQ(p, mu, sigma, tau = 0.5, lower.tail = TRUE, log.p = FALSE) rVASIQ(n, mu, sigma, tau = 0.5) VASIQ(mu.link = "logit", sigma.link = "logit")dVASIQ(x, mu, sigma, tau = 0.5, log = FALSE) pVASIQ(q, mu, sigma, tau = 0.5, lower.tail = TRUE, log.p = FALSE) qVASIQ(p, mu, sigma, tau = 0.5, lower.tail = TRUE, log.p = FALSE) rVASIQ(n, mu, sigma, tau = 0.5) VASIQ(mu.link = "logit", sigma.link = "logit")
x, q
|
Vector of quantiles in the interval |
mu |
Vector of |
sigma |
Vector of shape parameter values. |
tau |
Fixed quantile level |
log, log.p
|
Logical; if |
lower.tail |
Logical; if |
p |
Vector of probabilities. |
n |
Number of observations. If |
mu.link |
Link function for the |
sigma.link |
Link function for the |
Probability density function:
Cumulative distribution function:
where , is the
-th quantile, and is the shape parameter.
VASIQ() returns a gamlss.family object that can be used
to fit a Vasicek distribution using the gamlss
function.
For VASIQ(), corresponds to the -th quantile
and is a shape parameter. Parameter estimation is
performed using the gamlss function.
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., Alves, B., Korkmaz, M. Ç., and Leiva, V. (2022). Vasicek quantile and mean regression models for bounded data: New formulation, mathematical derivations, and numerical applications. Mathematics, 10, 1389.
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.
Vasicek, O. A. (1987). Probability of loss on loan portfolio. KMV Corporation.
Vasicek, O. A. (2002). The distribution of loan portfolio value. Risk, 15(12), 1–10.
set.seed(123) x <- rVASIQ(n = 1000, mu = 0.50, sigma = 0.69, tau = 0.50) R <- range(x) S <- seq(from = R[1], to = R[2], length.out = 1000) hist(x, prob = TRUE, main = "Vasicek") lines(S, dVASIQ(x = S, mu = 0.50, sigma = 0.69, tau = 0.50), col = 2) plot(ecdf(x)) lines(S, pVASIQ(q = S, mu = 0.50, sigma = 0.69, tau = 0.50), col = 2) plot(quantile(x, probs = S), type = "l") lines(qVASIQ(p = S, mu = 0.50, sigma = 0.69, tau = 0.50), col = 2) library(gamlss) set.seed(123) data <- data.frame(y = rVASIQ(n = 100, mu = 0.50, sigma = 0.69, tau = 0.50)) tau <- 0.5 fit <- gamlss(y ~ 1, data = data, family = VASIQ(mu.link = "logit", sigma.link = "logit")) 1 / (1 + exp(-fit$mu.coefficients)) 1 / (1 + exp(-fit$sigma.coefficients)) set.seed(123) n <- 100 x <- rbinom(n, size = 1, prob = 0.5) eta <- 0.5 + 1 * x mu <- 1 / (1 + exp(-eta)) sigma <- 0.5 y <- rVASIQ(n, mu, sigma, tau = 0.5) data <- data.frame(y, x, tau = 0.5) tau <- 0.5 fit <- gamlss(y ~ x, data = data, family = VASIQ) fittaus <- lapply(c(0.10, 0.25, 0.50, 0.75, 0.90), function(Tau) { tau <<- Tau gamlss(y ~ x, data = data, family = VASIQ) }) sapply(fittaus, summary)set.seed(123) x <- rVASIQ(n = 1000, mu = 0.50, sigma = 0.69, tau = 0.50) R <- range(x) S <- seq(from = R[1], to = R[2], length.out = 1000) hist(x, prob = TRUE, main = "Vasicek") lines(S, dVASIQ(x = S, mu = 0.50, sigma = 0.69, tau = 0.50), col = 2) plot(ecdf(x)) lines(S, pVASIQ(q = S, mu = 0.50, sigma = 0.69, tau = 0.50), col = 2) plot(quantile(x, probs = S), type = "l") lines(qVASIQ(p = S, mu = 0.50, sigma = 0.69, tau = 0.50), col = 2) library(gamlss) set.seed(123) data <- data.frame(y = rVASIQ(n = 100, mu = 0.50, sigma = 0.69, tau = 0.50)) tau <- 0.5 fit <- gamlss(y ~ 1, data = data, family = VASIQ(mu.link = "logit", sigma.link = "logit")) 1 / (1 + exp(-fit$mu.coefficients)) 1 / (1 + exp(-fit$sigma.coefficients)) set.seed(123) n <- 100 x <- rbinom(n, size = 1, prob = 0.5) eta <- 0.5 + 1 * x mu <- 1 / (1 + exp(-eta)) sigma <- 0.5 y <- rVASIQ(n, mu, sigma, tau = 0.5) data <- data.frame(y, x, tau = 0.5) tau <- 0.5 fit <- gamlss(y ~ x, data = data, family = VASIQ) fittaus <- lapply(c(0.10, 0.25, 0.50, 0.75, 0.90), function(Tau) { tau <<- Tau gamlss(y ~ x, data = data, family = VASIQ) }) sapply(fittaus, summary)