VASIQ: The Vasicek distribution - quantile parameterization

Description Usage Arguments Details Value Note Author(s) References See Also Examples

Description

The function VASIQ() define the Vasicek distribution for a gamlss.family object to be used in GAMLSS fitting. VASIQ() has the τ-th quantile equal to the parameter mu and sigma as shape parameter. The functions dVASIQ, pVASIQ, qVASIQ and rVASIQ define the density, distribution function, quantile function and random generation for Vasicek distribution.

Usage

1
2
3
4
5
6
7
8
9
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")

Arguments

x, q

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

mu

vector of the τ-th quantile parameter values.

sigma

vector of shape parameter values.

tau

the τ-th fixed quantile in [d-p-q-r]-VASIQ function.

log, log.p

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

lower.tail

logical; If TRUE, (default), P(X ≤q{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≤ft( {x\mid μ ,σ ,τ } \right) = √ {{\textstyle{{1 - σ } \over σ }}} \exp ≤ft\{ {\frac{1}{2}≤ft[ {Φ ^{ - 1} ≤ft( x \right)^2 - ≤ft( {\frac{{√ {1 - σ } ≤ft[ {Φ ^{ - 1} ≤ft( x \right) - Φ ^{ - 1} ≤ft( μ \right)} \right] - √ σ \,Φ ^{ - 1} ≤ft( τ \right)}}{{√ σ }}} \right)^2 } \right]} \right\}

Cumulative distribution function

F≤ft({x\mid μ ,σ ,τ } \right) = Φ ≤ft[ {\frac{{√ {1 - σ } ≤ft[ {Φ ^{ - 1} ≤ft( x \right) - Φ ^{ - 1} ≤ft( μ \right)} \right] - √ σ \,Φ ^{ - 1} ≤ft( τ \right)}}{{√ σ }}} \right]

where 0<(x, μ, τ, σ)<1, μ is the τ-th quantile and σ is the shape parameter.

Value

VASIQ() 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 τ-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

VASIM.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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)

vasicekreg documentation built on May 28, 2021, 1:06 a.m.