VASIM {vasicekreg}R Documentation

The Vasicek distribution - mean parameterization

Description

The function VASIM() define the Vasicek distribution for a gamlss.family object to be used in GAMLSS fitting. VASIM() has mean equal to the parameter mu and sigma as shape parameter. The functions dVASIM, pVASIM, qVASIM and rVASIM define the density, distribution function, quantile function and random generation for Vasicek distribution.

Usage

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")

Arguments

x, q

vector of quantiles on the (0,1) interval.

mu

vector of the mean parameter values.

sigma

vector of shape parameter values.

log, log.p

logical; If TRUE, probabilities p are given as log(p).

lower.tail

logical; If TRUE, (default), P(X \leq{x}) are returned, otherwise P(X > x).

p

vector of probabilities.

n

number of observations. If length(n) > 1, the length is taken to be the number required.

mu.link

the mu link function with default logit.

sigma.link

the sigma link function with default logit.

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 0<(x, \mu, \tau, \sigma)<1 and \Phi_2(\cdot) is the probability distribution function for the standard bivariate normal distribution with correlation \sigma.

Value

VASIM() return a gamlss.family object which can be used to fit a Vasicek distribution by gamlss() function.

Note

Note that for VASIQ(), mu is the \tau-th quantile and sigma a shape parameter. The gamlss function is used for parameters estimation.

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. and Korkmaz, M. C. (2021). The Vasicek quantile regression model. (under review).

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

VASIQ, pmvnorm.

Examples


set.seed(123)
x <- rVASIM(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, dVASIM(x = S, mu = 0.50, sigma = 0.69), col = 2)

plot(ecdf(x))
lines(S, pVASIM(q = S, mu = 0.50, sigma = 0.69), col = 2)

plot(quantile(x, probs = S), type = "l")
lines(qVASIM(p = S, mu = 0.50, sigma = 0.69), col = 2)

library(gamlss)
set.seed(123)
data <- data.frame(y =  rVASIM(n = 100, mu = 0.5, sigma = 0.69))

fit <- gamlss(y ~ 1, data = data, mu.link = 'logit', sigma.link = 'logit', family = VASIM)
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.1;
y <- rVASIM(n, mu, sigma)
data <- data.frame(y, x)

fit <- gamlss(y ~ x, data = data, family = VASIM, mu.link = 'logit', sigma.link = 'logit');


[Package vasicekreg version 1.0.1 Index]