| Type: | Package |
| Title: | Regression Modeling Using Vasicek Distribution |
| Version: | 1.1.0 |
| Date: | 2026-08-09 |
| Description: | Provides density, cumulative distribution, quantile, and random generation functions for Vasicek distributions with standard normal and standard logistic kernels. The normal-kernel distribution is parameterized by either its mean or a fixed quantile, whereas the logistic-kernel distribution uses a fixed-quantile parameterization. Zero-adjusted, one-adjusted, and zero-and-one-adjusted extensions of the normal-kernel mean parameterization are also provided for responses that include boundary values. The corresponding 'NVASIM', 'NVASIQ', 'LVASIQ', 'ZANVASIM', 'OANVASIM', and 'ZOANVASIM' families are available for fitting Generalized Additive Models for Location, Scale and Shape, as 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>). |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| ByteCompile: | yes |
| LazyData: | true |
| Depends: | R (≥ 3.6) |
| Imports: | Rcpp, stats, gamlss, gamlss.dist, mvtnorm |
| LinkingTo: | Rcpp |
| Suggests: | betareg, testthat (≥ 3.0.0) |
| NeedsCompilation: | yes |
| Config/testthat/edition: | 3 |
| Config/roxygen2/version: | 8.1.0 |
| Packaged: | 2026-08-19 22:18:24 UTC; jmazucheli |
| Author: | Josmar Mazucheli [aut, cre], Bruna Alves [ctb] |
| Maintainer: | Josmar Mazucheli <jmazucheli@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-08-20 06:50:02 UTC |
Overview of the vasicekreg package
Description
The vasicekreg package provides distribution functions and GAMLSS families for Vasicek-type distributions on the unit interval. Three base families are available:
-
NVASIM: normal kernel with mean parameterization, where\mu=E(Y). -
NVASIQ: normal kernel with quantile parameterization, where\mu=Q_Y(\tau)for a fixed\tau\in(0,1). -
LVASIQ: logistic kernel with quantile parameterization, where\mu=Q_Y(\tau)for a fixed\tau\in(0,1).
For responses observed at the boundaries, the normal-kernel mean model is also available as:
-
ZANVASIM: point mass at zero and a continuous component on(0,1). -
OANVASIM: point mass at one and a continuous component on(0,1). -
ZOANVASIM: point masses at zero and one and a continuous component on(0,1).
The parameter \sigma\in(0,1) controls dispersion in the continuous
Vasicek component. The corresponding d, p, q, and
r functions provide density or probability mass values, cumulative
probabilities, quantiles, and random observations, respectively.
Details
bodyfat:
Body fat dataset.
NVASIM:
Normal-kernel mean parameterization and GAMLSS family. In regression
models, covariates describe the conditional mean through \mu.
NVASIQ:
Normal-kernel quantile parameterization and GAMLSS family. For a fixed
quantile level \tau, covariates describe the conditional
\tau-th quantile through \mu.
LVASIQ:
Logistic-kernel quantile parameterization and GAMLSS family. For a fixed
quantile level \tau, covariates describe the conditional
\tau-th quantile through \mu. A logistic-kernel mean-regression
family is not provided because the mean has no closed-form expression and
does not equal \mu under this parameterization.
ZANVASIM:
Zero-adjusted normal-kernel mean family. Here
\nu=P(Y=0), \mu=E(Y\mid Y>0), and the marginal mean is
E(Y)=(1-\nu)\mu.
OANVASIM:
One-adjusted normal-kernel mean family. Here
\nu=P(Y=1), \mu=E(Y\mid Y<1), and the marginal mean is
E(Y)=\nu+(1-\nu)\mu. The parameters \mu and \nu
therefore have the same interpretations as their counterparts in the
one-inflated beta family BEOI. The shape
parameter \sigma is distribution-specific and should not be
compared directly between these families.
ZOANVASIM:
Zero-and-one-adjusted normal-kernel mean family. Here
\nu=P(Y=0), \tau=P(Y=1\mid Y>0), and
\mu=E(Y\mid 0<Y<1). Consequently,
P(Y=1)=(1-\nu)\tau and
E(Y)=(1-\nu)[\tau+(1-\tau)\mu].
The distribution functions dNVASIM, pNVASIM,
qNVASIM, dNVASIQ, pNVASIQ, qNVASIQ,
dLVASIQ, pLVASIQ, and qLVASIQ call compiled
C++ routines through Rcpp. The boundary-adjusted
distribution functions are implemented in R and reuse the
compiled NVASIM functions for their continuous component.
Parameter validation, the GAMLSS family definitions, and all
log-likelihood derivatives are implemented in R. The mean and
variance components of the LVASIQ() family object are obtained by
numerical quadrature because these moments have no closed-form
expressions.
For the distribution functions associated with NVASIQ and
LVASIQ, tau is supplied as an argument. For GAMLSS fitting,
NVASIQ() and LVASIQ() require tau to be defined as a
scalar variable in the global environment. The same value must be retained
when residuals or other post-fit quantities are computed. This fixed
quantile level is distinct from the parameter tau in
ZOANVASIM(), which represents the conditional probability at one
among nonzero observations.
Author(s)
Josmar Mazucheli jmazucheli@gmail.com
Bruna Alves pg402900@uem.br
Examples
if (requireNamespace("betareg", quietly = TRUE)) {
data("ReadingSkills", package = "betareg")
ReadingSkills$dyslexia <- stats::relevel(
factor(ReadingSkills$dyslexia), ref = "no"
)
control <- gamlss::gamlss.control(n.cyc = 200, trace = FALSE)
## In both models, mu = E(Y | Y < 1) and nu = P(Y = 1).
fit_oanvasim <- gamlss::gamlss(
accuracy1 ~ dyslexia * iq,
sigma.formula = ~ dyslexia + iq,
nu.formula = ~ 1,
family = OANVASIM(),
data = ReadingSkills,
control = control
)
fit_beoi <- gamlss::gamlss(
accuracy1 ~ dyslexia * iq,
sigma.formula = ~ dyslexia + iq,
nu.formula = ~ 1,
family = gamlss.dist::BEOI(),
data = ReadingSkills,
control = control
)
n <- nrow(ReadingSkills)
comparison <- data.frame(
family = c("OANVASIM", "BEOI"),
logLik = -c(
fit_oanvasim$G.deviance,
fit_beoi$G.deviance
) / 2,
AIC = c(
gamlss::GAIC(fit_oanvasim, k = 2),
gamlss::GAIC(fit_beoi, k = 2)
),
BIC = c(
gamlss::GAIC(fit_oanvasim, k = log(n)),
gamlss::GAIC(fit_beoi, k = log(n))
)
)
comparison
}
L-Vasicek distribution (logistic kernel) with quantile parameterization
Description
The function LVASIQ() defines the logistic-kernel Vasicek
distribution as a gamlss.family object for conditional quantile
regression. The functions dLVASIQ, pLVASIQ,
qLVASIQ, and rLVASIQ give the density, distribution
function, quantile function, and random generation. The parameter
\mu is the conditional \tau-th quantile
(0<\mu<1), \sigma is a dispersion parameter
(0<\sigma<1), and \tau\in(0,1) is fixed by the user.
For GAMLSS fitting, tau must be defined as a scalar variable in
the global environment before LVASIQ() is evaluated.
Usage
dLVASIQ(x, mu, sigma, tau = 0.5, log = FALSE)
pLVASIQ(q, mu, sigma, tau = 0.5, lower.tail = TRUE, log.p = FALSE)
qLVASIQ(p, mu, sigma, tau = 0.5, lower.tail = TRUE, log.p = FALSE)
rLVASIQ(n, mu, sigma, tau = 0.5)
LVASIQ(mu.link = "logit", sigma.link = "logit")
Arguments
x, q |
Vector of quantiles in |
mu |
Vector of |
sigma |
Vector of dispersion values, |
tau |
Scalar in |
log |
Logical; if |
lower.tail |
Logical; if |
log.p |
Logical; if |
p |
Vector of probabilities in |
n |
Number of observations. |
mu.link |
Link function for the |
sigma.link |
Link function for the |
Details
Let
\mathrm{logit}(u)=
\log\left(\frac{u}{1-u}\right) and
\Lambda(z)=\frac{1}{1+e^{-z}},
with
\lambda(z)=
\Lambda(z)\left[1-\Lambda(z)\right].
Define
z =
\sqrt{\frac{1-\sigma}{\sigma}}
\left[\mathrm{logit}(x)-\mathrm{logit}(\mu)\right]
+\mathrm{logit}(\tau).
Cumulative distribution function
F(x\mid\mu,\sigma,\tau)=\Lambda(z).
Probability density function
f(x\mid\mu,\sigma,\tau)=
\sqrt{\frac{1-\sigma}{\sigma}}
\frac{\lambda(z)}{x(1-x)}.
Quantile function
Q(p\mid\mu,\sigma,\tau)=
\Lambda\!\left\{
\mathrm{logit}(\mu)
+\sqrt{\frac{\sigma}{1-\sigma}}
\left[\mathrm{logit}(p)-\mathrm{logit}(\tau)\right]
\right\}.
By construction Q(\tau)=\mu, i.e. \mu is the \tau-th
quantile. Note that, unlike the normal-kernel Vasicek distribution, the
logistic kernel does not yield a closed-form mean; in particular
E(X)\neq\mu in general.
The GAMLSS family uses analytical derivatives. For one observation, let
a=\sqrt{\frac{1-\sigma}{\sigma}},\qquad
d=\mathrm{logit}(y)-\mathrm{logit}(\mu),\qquad
P=\Lambda\left\{ad+\mathrm{logit}(\tau)\right\},
and define
V=P(1-P),\qquad
b=\frac{1}{2\sigma(1-\sigma)},\qquad
g=\frac{1}{\mu(1-\mu)}.
If \ell denotes the individual log-likelihood contribution, the
first derivatives are
\frac{\partial\ell}{\partial\mu}
=-ag(1-2P)
and
\frac{\partial\ell}{\partial\sigma}
=-b\left\{1+ad(1-2P)\right\}.
The second and cross derivatives are
\frac{\partial^2\ell}{\partial\mu^2}
=g^2\left\{
a(1-2\mu)(1-2P)-2a^2V
\right\},
\frac{\partial^2\ell}{\partial\mu\,\partial\sigma}
=abg\left\{
(1-2P)-2adV
\right\},
and
\frac{\partial^2\ell}{\partial\sigma^2}
=b^2\left\{
2(1-2\sigma)
+ad(3-4\sigma)(1-2P)
-2a^2d^2V
\right\}.
These expressions are evaluated directly by LVASIQ(); numerical
differentiation is not used. The mean and variance
components of the family object use numerical quadrature because the
corresponding moments do not have elementary closed forms.
Value
dLVASIQ gives the density, pLVASIQ the distribution function,
qLVASIQ the quantile function, and rLVASIQ generates random
deviates. LVASIQ() returns a gamlss.family object.
Note
The global variable tau must remain equal to the quantile level
associated with a fitted model when residuals or other post-fit quantities
are computed.
Author(s)
Josmar Mazucheli jmazucheli@gmail.com
References
Mazucheli, J., Alves, B., Korkmaz, M. C. and Leiva, V. (2022). Vasicek quantile and mean regression models for bounded data: New formulation, mathematical derivations, and numerical applications. Mathematics, 10, 1389.
Vasicek, O. A. (2002). The distribution of loan portfolio value. Risk, 15(12), 1–10.
Examples
set.seed(123)
x <- rLVASIQ(n = 1000, mu = 0.50, sigma = 0.25, tau = 0.5)
S <- seq(min(x), max(x), length.out = 1000)
hist(x, prob = TRUE, main = "L-Vasicek (logistic kernel)")
lines(S, dLVASIQ(x = S, mu = 0.50, sigma = 0.25, tau = 0.5), col = 2)
plot(ecdf(x))
lines(S, pLVASIQ(q = S, mu = 0.50, sigma = 0.25, tau = 0.5), col = 2)
data <- data.frame(
y = rLVASIQ(n = 100, mu = 0.50, sigma = 0.25, tau = 0.50)
)
tau <- 0.50
fit <- gamlss::gamlss(
y ~ 1,
data = data,
family = LVASIQ(mu.link = "logit", sigma.link = "logit")
)
fitted(fit, what = "mu")[1:5]
rm(tau)
N-Vasicek distribution (normal kernel) with mean parameterization
Description
Defines the normal-kernel Vasicek distribution under a mean
parameterization for use as a gamlss.family. The parameter
\mu represents the mean of the distribution, with
0 < \mu < 1, and \sigma is a shape parameter.
The density, distribution function, quantile function and random
number generation are provided by dNVASIM(), pNVASIM(),
qNVASIM() and rNVASIM(), respectively.
Usage
dNVASIM(x, mu, sigma, log = FALSE)
pNVASIM(q, mu, sigma, lower.tail = TRUE, log.p = FALSE)
qNVASIM(p, mu, sigma, lower.tail = TRUE, log.p = FALSE)
rNVASIM(n, mu, sigma)
NVASIM(mu.link = "logit", sigma.link = "logit")
Arguments
x |
Vector of quantiles in the interval |
mu |
Vector of mean values. |
sigma |
Vector of shape parameter values. |
log |
Logical; if |
q |
Vector of quantiles in the interval |
lower.tail |
Logical; if |
log.p |
Logical; if |
p |
Vector of probabilities. |
n |
Number of observations. If |
mu.link |
Link function for the |
sigma.link |
Link function for the |
Details
Probability density function
f(x\mid \mu ,\sigma )=\sqrt{\frac{1-\sigma }{\sigma }}\exp \left\{ \frac{1}{2}\left[ \Phi ^{-1}\left( x\right) ^{2}-\left( \frac{\Phi ^{-1}\left( x\right) \sqrt{1-\sigma }-\Phi ^{-1}\left( \mu \right) }{\sqrt{\sigma }}\right) ^{2}\right] \right\}
Cumulative distribution function
F(x\mid \mu ,\sigma )=\Phi \left( \frac{\Phi ^{-1}\left( x\right) \sqrt{1-\sigma }-\Phi ^{-1}\left( \mu \right) }{\sqrt{\sigma }}\right)
Quantile function
Q(\tau \mid \mu ,\sigma )=F^{-1}(\tau \mid \mu ,\sigma )=\Phi \left(\frac{\Phi ^{-1}\left(\mu\right) +\Phi ^{-1}\left( \tau \right) \sqrt{\sigma }}{\sqrt{1-\sigma }}\right)
Expected value
E(X) = \mu
Variance
Var(X) = \Phi_2\left ( \Phi^{-1}(\mu),\Phi^{-1}(\mu),\sigma \right )-\mu^2
where (x, \mu, \sigma, \tau) \in (0,1) and \Phi_2(\cdot) is the probability distribution function for the standard bivariate normal distribution with correlation \sigma.
Value
NVASIM() returns a gamlss.family object.
Note
In the NVASIM() parameterization, \mu corresponds to the
mean of the distribution and \sigma is a shape parameter.
Author(s)
Josmar Mazucheli jmazucheli@gmail.com Bruna Alves pg402900@uem.br
References
Hastie, T. J. and Tibshirani, R. J. (1990). Generalized Additive Models. Chapman and Hall, London.
Mazucheli, J., Alves, B., Korkmaz, M. C., 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.
See Also
Examples
set.seed(123)
x <- rNVASIM(n = 1000, mu = 0.50, sigma = 0.69)
R <- range(x)
S <- seq(from = R[1], to = R[2], length.out = 1000)
hist(x, prob = TRUE, main = 'Vasicek')
lines(S, dNVASIM(x = S, mu = 0.50, sigma = 0.69), col = 2)
plot(ecdf(x))
lines(S, pNVASIM(q = S, mu = 0.50, sigma = 0.69), col = 2)
plot(quantile(x, probs = S), type = "l")
lines(qNVASIM(p = S, mu = 0.50, sigma = 0.69), col = 2)
library(gamlss)
set.seed(123)
data <- data.frame(y = rNVASIM(n = 100, mu = 0.5, sigma = 0.69))
fit <- gamlss(y ~ 1, data = data, mu.link = 'logit', sigma.link = 'logit', family = NVASIM)
1 /(1 + exp(-fit$mu.coefficients))
1 /(1 + exp(-fit$sigma.coefficients))
## Not run:
library(gamlss)
set.seed(123)
n <- 1000
x <- rbinom(n, size = 1, prob = 0.5)
eta <- 0.5 + 1 * x;
mu <- 1 / (1 + exp(-eta));
sigma <- 0.5;
y <- rNVASIM(n, mu, sigma)
data <- data.frame(y, x)
fit <- gamlss(y ~ x, data = data, family = NVASIM, mu.link = 'logit', sigma.link = 'logit',
control = gamlss.control(n.cyc = 200))
summary(fit)
## End(Not run)
N-Vasicek distribution (normal kernel) with quantile parameterization
Description
The function NVASIQ() defines the normal-kernel Vasicek
distribution as a gamlss.family object. In this parameterization,
\mu corresponds to the fixed \tau-th quantile and
\sigma is a shape parameter. For GAMLSS fitting, tau must
be defined as a scalar variable in the global environment before
NVASIQ() is evaluated. The functions
dNVASIQ, pNVASIQ, qNVASIQ, and rNVASIQ define
the density, distribution function, quantile function, and random
generation for the Vasicek distribution, respectively.
Usage
dNVASIQ(x, mu, sigma, tau = 0.5, log = FALSE)
pNVASIQ(q, mu, sigma, tau = 0.5, lower.tail = TRUE, log.p = FALSE)
qNVASIQ(p, mu, sigma, tau = 0.5, lower.tail = TRUE, log.p = FALSE)
rNVASIQ(n, mu, sigma, tau = 0.5)
NVASIQ(mu.link = "logit", sigma.link = "logit")
Arguments
x, q |
Vector of quantiles in the interval |
mu |
Vector of |
sigma |
Vector of shape parameter values. |
tau |
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 |
Details
Probability density function:
f\left(x \mid \mu, \sigma, \tau\right) =
\sqrt{\frac{1-\sigma}{\sigma}}
\exp\left\{\frac{1}{2}\left[\Phi^{-1}(x)^2 -
\left(\frac{\sqrt{1-\sigma}\left(\Phi^{-1}(x)-\Phi^{-1}(\mu)\right)
- \sqrt{\sigma}\,\Phi^{-1}(\tau)}{\sqrt{\sigma}}\right)^2\right]\right\}.
Cumulative distribution function:
F\left(x \mid \mu, \sigma, \tau\right) =
\Phi\left(\frac{\sqrt{1-\sigma}\left(\Phi^{-1}(x)-\Phi^{-1}(\mu)\right)
- \sqrt{\sigma}\,\Phi^{-1}(\tau)}{\sqrt{\sigma}}\right).
where 0 < (x, \mu, \tau, \sigma) < 1, \mu is the
\tau-th quantile, and \sigma is the shape parameter.
Value
NVASIQ() returns a gamlss.family object that can be used
to fit a Vasicek distribution using the gamlss
function.
Note
For NVASIQ(), \mu corresponds to the \tau-th quantile
and \sigma is a shape parameter. The global variable tau
must remain set to the quantile level associated with a fitted model
when residuals or other post-fit quantities are computed.
Author(s)
Josmar Mazucheli jmazucheli@gmail.com
Bruna Alves pg402900@uem.br
References
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.
See Also
Examples
set.seed(123)
x <- rNVASIQ(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, dNVASIQ(x = S, mu = 0.50, sigma = 0.69, tau = 0.50), col = 2)
plot(ecdf(x))
lines(S, pNVASIQ(q = S, mu = 0.50, sigma = 0.69, tau = 0.50), col = 2)
plot(quantile(x, probs = S), type = "l")
lines(qNVASIQ(p = S, mu = 0.50, sigma = 0.69, tau = 0.50), col = 2)
library(gamlss)
set.seed(123)
data <- data.frame(y = rNVASIQ(n = 100, mu = 0.50, sigma = 0.69, tau = 0.50))
tau <- 0.5
fit <- gamlss(y ~ 1, data = data,
family = NVASIQ(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 <- rNVASIQ(n, mu, sigma, tau = 0.5)
data <- data.frame(y, x)
tau <- 0.5
fit <- gamlss(y ~ x, data = data, family = NVASIQ)
fittaus <- lapply(c(0.10, 0.25, 0.50, 0.75, 0.90), function(Tau) {
tau <<- Tau
gamlss(y ~ x, data = data, family = NVASIQ)
})
sapply(fittaus, summary)
One-adjusted N-Vasicek distribution with mean parameterization
Description
Defines a one-adjusted normal-kernel Vasicek distribution for responses
in (0,1]. The parameter \nu is the probability at one.
Conditional on an observation in (0,1), the distribution is
NVASIM with mean \mu and shape parameter \sigma.
Usage
d1NVASIM(x, mu = 0.5, sigma = 0.5, nu = 0.1, log = FALSE)
p1NVASIM(q, mu = 0.5, sigma = 0.5, nu = 0.1, lower.tail = TRUE, log.p = FALSE)
q1NVASIM(p, mu = 0.5, sigma = 0.5, nu = 0.1, lower.tail = TRUE, log.p = FALSE)
r1NVASIM(n, mu = 0.5, sigma = 0.5, nu = 0.1)
dOANVASIM(x, mu = 0.5, sigma = 0.5, nu = 0.1, log = FALSE)
pOANVASIM(q, mu = 0.5, sigma = 0.5, nu = 0.1, lower.tail = TRUE, log.p = FALSE)
qOANVASIM(p, mu = 0.5, sigma = 0.5, nu = 0.1, lower.tail = TRUE, log.p = FALSE)
rOANVASIM(n, mu = 0.5, sigma = 0.5, nu = 0.1)
OANVASIM(mu.link = "logit", sigma.link = "logit", nu.link = "logit")
Arguments
x |
Vector of values in |
mu |
Mean of the continuous Vasicek component, in |
sigma |
Shape parameter of the continuous Vasicek component, in
|
nu |
Probability at one, in |
log |
Logical; if |
q |
Vector of values in |
lower.tail |
Logical; if |
log.p |
Logical; if |
p |
Vector of probabilities. |
n |
Number of observations. If |
mu.link |
Link function for |
sigma.link |
Link function for |
nu.link |
Link function for |
Details
Let Y_c\sim\mathrm{NVASIM}(\mu,\sigma) and let
0<\nu<1. The BEOI-type one-adjusted distribution is defined by
P(Y=1)=\nu
and
f_Y(y)=(1-\nu)f_{Y_c}(y\mid\mu,\sigma),\quad 0<y<1.
Consequently,
E(Y)=\nu+(1-\nu)\mu
and
\mathrm{Var}(Y)=(1-\nu)\mathrm{Var}(Y_c)+
\nu(1-\nu)(1-\mu)^2.
Thus, \mu=E(Y\mid 0<Y<1) is the mean of the continuous component,
whereas \nu+(1-\nu)\mu is the marginal mean.
Value
OANVASIM() returns a gamlss.family object. The functions
d1NVASIM(), p1NVASIM(), q1NVASIM(), and
r1NVASIM() return probability mass or density values, cumulative
probabilities, quantiles, and random observations, respectively.
dOANVASIM(), pOANVASIM(), qOANVASIM(), and
rOANVASIM() are equivalent names following the GAMLSS family-name
convention.
References
Ospina, R. and Ferrari, S. L. P. (2010). Inflated beta distributions. Statistical Papers, 51, 111–126.
Rigby, R. A. and Stasinopoulos, D. M. (2005). Generalized additive models for location, scale and shape. Applied Statistics, 54(3), 507–554.
See Also
Examples
set.seed(123)
y <- r1NVASIM(1000, mu = 0.60, sigma = 0.30, nu = 0.20)
mean(y == 1)
mean(y)
0.20 + (1 - 0.20) * 0.60
## Not run:
library(gamlss)
fit <- gamlss(
y ~ 1,
sigma.formula = ~ 1,
nu.formula = ~ 1,
family = OANVASIM(),
control = gamlss.control(trace = FALSE)
)
## End(Not run)
Zero-adjusted N-Vasicek distribution with mean parameterization
Description
Defines a zero-adjusted normal-kernel Vasicek distribution for responses
in [0,1). The parameter \nu is the probability of a structural
zero. Conditional on a positive response, the distribution is
NVASIM with mean \mu and shape parameter \sigma.
Usage
d0NVASIM(x, mu = 0.5, sigma = 0.5, nu = 0.1, log = FALSE)
p0NVASIM(q, mu = 0.5, sigma = 0.5, nu = 0.1, lower.tail = TRUE, log.p = FALSE)
q0NVASIM(p, mu = 0.5, sigma = 0.5, nu = 0.1, lower.tail = TRUE, log.p = FALSE)
r0NVASIM(n, mu = 0.5, sigma = 0.5, nu = 0.1)
dZANVASIM(x, mu = 0.5, sigma = 0.5, nu = 0.1, log = FALSE)
pZANVASIM(q, mu = 0.5, sigma = 0.5, nu = 0.1, lower.tail = TRUE, log.p = FALSE)
qZANVASIM(p, mu = 0.5, sigma = 0.5, nu = 0.1, lower.tail = TRUE, log.p = FALSE)
rZANVASIM(n, mu = 0.5, sigma = 0.5, nu = 0.1)
ZANVASIM(mu.link = "logit", sigma.link = "logit", nu.link = "logit")
Arguments
x |
Vector of values in |
mu |
Mean of the positive Vasicek component, in |
sigma |
Shape parameter of the positive Vasicek component, in
|
nu |
Probability of a structural zero, in |
log |
Logical; if |
q |
Vector of values in |
lower.tail |
Logical; if |
log.p |
Logical; if |
p |
Vector of probabilities. |
n |
Number of observations. If |
mu.link |
Link function for |
sigma.link |
Link function for |
nu.link |
Link function for |
Details
Let Y_+\sim\mathrm{NVASIM}(\mu,\sigma) and let
0<\nu<1. The zero-adjusted distribution is defined by
P(Y=0)=\nu
and
f_Y(y)=(1-\nu)f_{Y_+}(y\mid\mu,\sigma),\quad 0<y<1.
Its cumulative distribution function is
F_Y(y)=\nu+(1-\nu)F_{Y_+}(y\mid\mu,\sigma),\quad 0<y<1.
Consequently,
E(Y)=(1-\nu)\mu
and
\mathrm{Var}(Y)=(1-\nu)\mathrm{Var}(Y_+)+
\nu(1-\nu)\mu^2.
Thus, \mu is the mean conditional on Y>0; it is not the
marginal mean when \nu>0. The marginal mean is
(1-\nu)\mu.
Value
ZANVASIM() returns a gamlss.family object. The functions
d0NVASIM(), p0NVASIM(), q0NVASIM(), and
r0NVASIM() return density or probability mass values, cumulative
probabilities, quantiles, and random observations, respectively.
dZANVASIM(), pZANVASIM(), qZANVASIM(), and
rZANVASIM() are equivalent names following the GAMLSS family-name
convention.
References
Mazucheli, J., Alves, B., Korkmaz, M. C., 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
Ospina, R. and Ferrari, S. L. P. (2010). Inflated beta distributions. Statistical Papers, 51, 111–126.
Rigby, R. A. and Stasinopoulos, D. M. (2005). Generalized additive models for location, scale and shape. Applied Statistics, 54(3), 507–554.
See Also
Examples
set.seed(123)
y <- r0NVASIM(1000, mu = 0.60, sigma = 0.30, nu = 0.20)
mean(y == 0)
mean(y)
(1 - 0.20) * 0.60
library(gamlss)
fit <- gamlss(
y ~ 1,
sigma.formula = ~ 1,
nu.formula = ~ 1,
family = ZANVASIM(),
control = gamlss.control(trace = FALSE)
)
fitted(fit, what = "mu")[1]
fitted(fit, what = "sigma")[1]
fitted(fit, what = "nu")[1]
Zero-and-one-adjusted N-Vasicek distribution
Description
Defines a normal-kernel Vasicek distribution augmented by point masses at
zero and one. Conditional on an observation in (0,1), the continuous
component is NVASIM with mean \mu and shape parameter
\sigma.
Usage
d01NVASIM(x, mu = 0.5, sigma = 0.5, nu = 0.1, tau = 0.1, log = FALSE)
p01NVASIM(
q,
mu = 0.5,
sigma = 0.5,
nu = 0.1,
tau = 0.1,
lower.tail = TRUE,
log.p = FALSE
)
q01NVASIM(
p,
mu = 0.5,
sigma = 0.5,
nu = 0.1,
tau = 0.1,
lower.tail = TRUE,
log.p = FALSE
)
r01NVASIM(n, mu = 0.5, sigma = 0.5, nu = 0.1, tau = 0.1)
dZOANVASIM(x, mu = 0.5, sigma = 0.5, nu = 0.1, tau = 0.1, log = FALSE)
pZOANVASIM(
q,
mu = 0.5,
sigma = 0.5,
nu = 0.1,
tau = 0.1,
lower.tail = TRUE,
log.p = FALSE
)
qZOANVASIM(
p,
mu = 0.5,
sigma = 0.5,
nu = 0.1,
tau = 0.1,
lower.tail = TRUE,
log.p = FALSE
)
rZOANVASIM(n, mu = 0.5, sigma = 0.5, nu = 0.1, tau = 0.1)
ZOANVASIM(
mu.link = "logit",
sigma.link = "logit",
nu.link = "logit",
tau.link = "logit"
)
Arguments
x |
Vector of values in |
mu |
Mean of the continuous Vasicek component, in |
sigma |
Shape parameter of the continuous Vasicek component, in
|
nu |
Probability at zero, |
tau |
Conditional probability at one among nonzero observations,
|
log |
Logical; if |
q |
Vector of values in |
lower.tail |
Logical; if |
log.p |
Logical; if |
p |
Vector of probabilities. |
n |
Number of observations. If |
mu.link |
Link function for |
sigma.link |
Link function for |
nu.link |
Link function for |
tau.link |
Link function for |
Details
Let Y_c\sim\mathrm{NVASIM}(\mu,\sigma). Write p_0, p_1,
and p_c for the probabilities of zero, one, and the continuous
component. The sequential BEOI-type parameterization is
\nu=P(Y=0),\qquad \tau=P(Y=1\mid Y>0).
Hence,
p_0=\nu,\qquad
p_1=(1-\nu)\tau,\qquad
p_c=(1-\nu)(1-\tau).
The distribution is
P(Y=0)=p_0,\qquad P(Y=1)=p_1
and
f_Y(y)=p_c f_{Y_c}(y\mid\mu,\sigma),\quad 0<y<1.
Its marginal mean and variance are
E(Y)=(1-\nu)\left[\tau+(1-\tau)\mu\right]
and
\mathrm{Var}(Y)=
(1-\nu)\left[(1-\tau)\left\{\mathrm{Var}(Y_c)+\mu^2\right\}
+\tau\right]
-\left\{(1-\nu)\left[\tau+(1-\tau)\mu\right]\right\}^2.
Logit links for \nu and \tau guarantee valid probabilities.
If \nu=0, the model reduces to the BEOI-type one-adjusted model; if
\tau=0, it reduces to the zero-adjusted model.
Value
ZOANVASIM() returns a four-parameter gamlss.family object.
The functions d01NVASIM(), p01NVASIM(),
q01NVASIM(), and r01NVASIM() return probability mass or
density values, cumulative probabilities, quantiles, and random
observations, respectively. dZOANVASIM(), pZOANVASIM(),
qZOANVASIM(), and rZOANVASIM() are equivalent names
following the GAMLSS family-name convention.
References
Ospina, R. and Ferrari, S. L. P. (2010). Inflated beta distributions. Statistical Papers, 51, 111–126.
Rigby, R. A. and Stasinopoulos, D. M. (2005). Generalized additive models for location, scale and shape. Applied Statistics, 54(3), 507–554.
See Also
NVASIM,
ZANVASIM,
OANVASIM,
BEOI
Examples
set.seed(123)
y <- r01NVASIM(
1000, mu = 0.60, sigma = 0.30, nu = 0.20, tau = 0.25
)
c(zero = mean(y == 0), one = mean(y == 1))
mean(y)
(1 - 0.20) * (0.25 + (1 - 0.25) * 0.60)
## Not run:
library(gamlss)
fit <- gamlss(
y ~ 1,
sigma.formula = ~ 1,
nu.formula = ~ 1,
tau.formula = ~ 1,
family = ZOANVASIM(),
control = gamlss.control(trace = FALSE)
)
## End(Not run)
Percentage of Body Fat Dataset
Description
Percentage of body fat measurements from individuals assisted in a public hospital in Curitiba, Paraná, Brazil.
Usage
bodyfat
Format
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).
Author(s)
Josmar Mazucheli jmazucheli@gmail.com
Bruna Alves pg402900@uem.br
References
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.
Examples
data(bodyfat, package = "vasicekreg")
bodyfat$AGE <- bodyfat$AGE - 46.00
bodyfat$BMI <- bodyfat$BMI - 24.72
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 = NVASIM(mu.link = "logit", sigma.link = "logit")
)
## Not run:
tau_levels <- c(0.10, 0.25, 0.50, 0.75, 0.90)
## Quantile regression models with the normal kernel
fit_normal <- lapply(tau_levels, function(Tau) {
tau <<- Tau
gamlss(
ARMS ~ AGE + BMI + SEX + IPAQ,
data = bodyfat,
family = NVASIQ(
mu.link = "logit",
sigma.link = "logit"
)
)
})
## Quantile regression models with the logistic kernel
fit_logistic <- lapply(tau_levels, function(Tau) {
tau <<- Tau
gamlss(
ARMS ~ AGE + BMI + SEX + IPAQ,
data = bodyfat,
family = LVASIQ(
mu.link = "logit",
sigma.link = "logit"
)
)
})
lapply(fit_normal, summary)
lapply(fit_logistic, summary)
## End(Not run)