stableDistribution {fBasics} | R Documentation |
A collection of functions to Compute density, distribution function,
quantile function and to generate random variates from the stable
distribution. Two different algorithms are used for the symmetric
and skewed distribution.
The functions are:
1 | [dpqr]symstb | The symmetric stable distribution, |
2 | [dpqr]stable | The skewed stable distribution using parametrizition 0. |
dsymstb(x, alpha) psymstb(q, alpha) qsymstb(p, alpha) rsymstb(n, alpha) dstable(x, alpha, beta, gamma=1, delta=0, pm = 0) pstable(q, alpha, beta, gamma=1, delta=0, pm = 0) qstable(p, alpha, beta, gamma=1, delta=0, pm = 0) rstable(n, alpha, beta, gamma=1, delta=0, pm = 0)
alpha, beta, gamma, delta |
value of the index parameter alpha with alpha = (0,2] ;
skewness parameter beta , in the range [-1, 1];
scale parameter gamma ; and
shift parameter delta .
|
n |
number of observations, an integer value. |
p |
a numeric vector of probabilities. |
pm |
parameterization, at the moment only the 0-th parameterization is supported. |
x, q |
a numeric vector of quantiles. |
Symmetric Stable Distribution:
For the density and probability the approach of McCulloch is
implemented. Note, that McCulloch's approach has a density
precision of 0.000066 and a distribution precision of 0.000022
for alpha
in the range [0.84, 2.00].
Quantiles are evaluated from a root finding process via the
probability function. Thus, this leads to nonnegligible
errors for small quantiles, since the quantile evaluation
depends on the quality of the probability function.To achieve
higher precisions use the function stable
with argument
beta=0
.
For generation of random deviates the results of Chambers,
Mallows, and Stuck are used.
Skew Stable Distribution:
The function uses the approach of J.P. Nolan for general
stable distributions. Nolan derived expressions in form of
integrals based on the charcteristic function for standardized
stable random variables. These integrals are numerically
evaluated using R's function integrate
.
"S0" parameterization: based on the (M) representation
of Zolotarev for an alpha stable distribution with skewness
beta. Unlike the Zolotarev (M) parameterization, gamma and
delta are straightforward scale and shift parameters. This
representation is continuous in all 4 parameters, and gives
an intuitive meaning to gamma and delta that is lacking in
other parameterizations.
All values are numeric vectors:
d*
returns the density,
p*
returns the distribution function,
q*
returns the quantile function, and
r*
generates random deviates.
McCulloch for the Fortran program, and
Diethelm Wuertz for this R-port.
Chambers J.M., Mallows, C.L. and Stuck, B.W. (1976); A Method for Simulating Stable Random Variables, J. Amer. Statist. Assoc. 71, 340–344.
Nolan J.P. (1999); Stable Distributions, Preprint, University Washington DC, 30 pages.
Nolan J.P. (1999); Numerical Calculation of Stable Densities and Distribution Functions, Preprint, University Washington DC, 16 pages.
Samoridnitsky G., Taqqu M.S. (1994); Stable Non-Gaussian Random Processes, Stochastic Models with Infinite Variance, Chapman and Hall, New York, 632 pages.
Weron, A., Weron R. (1999); Computer Simulation of Levy alpha-Stable Variables and Processes, Preprint Technical Univeristy of Wroclaw, 13 pages.
## rsymstb - xmpBasics("\nStart: Symmetric Stable Distribuion: > ") par(mfcol = c(3, 2), cex = 0.5) set.seed(1953) r = rsymstb(n = 1000, alpha = 1.85) plot(r, type = "l", main = "symstb: alpha = 1.85") # Plot empirical density and compare with true density: hist(r, n = 25, probability = TRUE, border = "white", col = "steelblue4") x = seq(-10, 10, 0.1) lines(x, dsymstb(x = x, alpha = 1.85)) # Plot df and compare with true df: plot(sort(r), (1:1000/1000), main = "Probability", col = "steelblue4") lines(x, psymstb(x, alpha = 1.85)) # Compute quantiles: qsymstb(psymstb(q = seq(-10, 10, 1), alpha = 1.85), alpha = 1.85) ## stable - set.seed(1953) r = rstable(n = 1000, alpha = 1.85, beta = 0.3) plot(r, type = "l", main = "stable: alpha = 1,85 beta = 0.3") # Plot empirical density and compare with true density: hist(r, n = 25, probability = TRUE, border = "white", col = "steelblue4") x = seq(-10, 10, 0.1) lines(x, dstable(x = x, alpha = 1.85, beta = 0.3)) # Plot df and compare with true df: plot(sort(r), (1:1000/1000), main = "Probability", col = "steelblue4") lines(x, pstable(q = x, alpha = 1.85, beta = 0.3)) # Compute quantiles: qstable(pstable(seq(-10, 10, 1), alpha = 1.85, beta = 0.3), alpha = 1.85, beta = 0.3)