LVASIQ: L-Vasicek distribution (logistic kernel) with quantile...

View source: R/dpqr-LvasicekQ.R

LVASIQR Documentation

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 (0,1).

mu

Vector of \tau-quantiles, 0<\mu<1.

sigma

Vector of dispersion values, 0<\sigma<1.

tau

Scalar in (0,1) fixing which quantile \mu represents. In the LVASIQ() GAMLSS family, it is not a function argument and must be defined globally.

log

Logical; if TRUE, the log-density is returned.

lower.tail

Logical; if TRUE, probabilities are P(X\le x).

log.p

Logical; if TRUE, probabilities p are given as log(p) or cumulative probabilities are returned on the log scale, as appropriate.

p

Vector of probabilities in (0,1).

n

Number of observations.

mu.link

Link function for the \mu parameter.

sigma.link

Link function for the \sigma parameter.

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)


vasicekreg documentation built on Aug. 20, 2026, 9:08 a.m.