Implements the stable lambda distribution (SLD) and the quartic stable lambda distribution (QSLD). Be aware of the performance concerns: (a) The cumulative density function is implemented by direct integration over the density. (b) The quantile function is implemented by root finding on cumulative density function.
dsl(x, t = 1, nu0 = 0, theta = 1, convo = 1, beta.a = 0, mu = 0, lambda = 4)dqsl(x, t = 1, nu0 = 0, theta = 1, convo = 1, beta.a = 0, mu = 0)
rqsl(n, t = 1, nu0 = 0, theta = 1, convo = 1, beta.a = 0, mu = 0)
rsl(n, t = 1, nu0 = 0, theta = 1, convo = 1, beta.a = 0, mu = 0, lambda = 4)
pqsl(x, t = 1, nu0 = 0, theta = 1, convo = 1, beta.a = 0, mu = 0)
psl(x, t = 1, nu0 = 0, theta = 1, convo = 1, beta.a = 0, mu = 0, lambda = 4)
qqsl(q, t = 1, nu0 = 0, theta = 1, convo = 1, beta.a = 0, mu = 0)
qsl(q, t = 1, nu0 = 0, theta = 1, convo = 1, beta.a = 0, mu = 0, lambda = 4)
kqsl(t = 1, nu0 = 0, theta = 1, convo = 1, beta.a = 0, mu = 0)
ksl(t = 1, nu0 = 0, theta = 1, convo = 1, beta.a = 0, mu = 0, lambda = 4)
cfqsl(
s,
t = 1,
nu0 = 0,
theta = 1,
convo = 1,
beta.a = 0,
mu = 0,
method = "a"
)
cfsl(
s,
t = 1,
nu0 = 0,
theta = 1,
convo = 1,
beta.a = 0,
mu = 0,
lambda = 4,
method = "a"
)
numeric, vector of responses.
numeric, the time parameter, where the variance is t, default is 1.
numeric, the location parameter, default is 0.
numeric, the scale parameter, default is 1.
numeric, the convolution number, default is 1.
numeric, the skewness parameter, default is 0. This number is annualized by sqrt(t).
numeric, the location parameter, default is 0.
numeric, the shape parameter, default is 4.
numeric, number of observations.
numeric, vector of quantiles.
numeric, vector of responses for characteristic function.
character, method of characteristic function (CF) calculation. Default is "a". Method a uses cfstdlap x dstablecnt. Method b uses dstdlap x cfstablecnt. Method c uses direct integration on PDF up to 50 stdev. They should yield the same result.
numeric, standard convention is followed: d* returns the density, p* returns the distribution function, q* returns the quantile function, and r* generates random deviates. The following are our extensions: k* returns the first 4 cumulants, skewness, and kurtosis, cf* returns the characteristic function.
The stable lambda distribution is the stationary distribution for financial asset returns. It is a product of the stable count distribution and the Lihn-Laplace process. The density function is defined as $$ P_{\Lambda}^{\left(m\right)}\left(x;t,\nu_{0},\theta,\beta_{a},\mu\right) \equiv\int_{\nu_{0}}^{\infty} \frac{1}{\nu}\, f_{\mathit{L}}^{\left(m\right)}\left(\frac{x-\mu}{\nu};t,\beta_{a}\sqrt{t}\right)\, \mathit{N}_\alpha\left(\nu;\nu_{0},\theta\right)d\nu $$ where \(f_L^{(m)}(.)\) is the Lihn-Laplace distribution and \(N_\alpha(.)\) is the quartic stable count distribution. \(t\) is the time or sampling period, \(\alpha\) is the stability index which is \(2/\lambda\), \(\nu_0\) is the floor volatility parameter, \(\theta\) is the volatility scale parameter, \(\beta_a\) is the annualized asymmetric parameter, \(\mu\) is the location parameter.
The quartic stable lambda distribution (QSLD) is a specialized distribution with \(\lambda=4\) aka \(\alpha=0.5\). The PDF integrand has closed form, and all the moments have closed forms. Many financial asset returns can be fitted by QSLD precisely up to 4 standard deviations.
For more detail, see Section 8.2 of Stephen Lihn (2017). A Theory of Asset Return and Volatility under Stable Law and Stable Lambda Distribution. SSRN: 3046732, https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3046732.
dstablecnt
for \(N_\alpha(.)\),
and dstdlap
for \(f_L^{(m)}(.)\).
# NOT RUN {
# generate the quartic pdf for SPX 1-day distribution
x <- c(-0.1, 0.1, by=0.001)
pdf <- dqsl(x, t=1/250, nu0=6.92/100, theta=1.17/100, convo=2, beta=-1.31)
# }
Run the code above in your browser using DataLab