Version: | 1.0.5 |
Title: | Stable Distribution Functions...For You |
Description: | Tools for fast and accurate evaluation of skew stable distributions (CDF, PDF and quantile functions), random number generation, and parameter estimation. This is 'libstableR' as per Royuela del Val, Simmross-Wattenberg, and Alberola López (2017) <doi:10.18637/jss.v078.i01> under a new maintainer. |
Author: | Javier Royuela del Val [aut], Federico Simmross-Wattenberg [aut], Carlos Alberola López [aut], Bob Rudis [ctb] (Several bugs fixed and added macOS compatibility), Bruce Swihart [ctb, cre] (Several bugs fixed and added macOS compatibility) |
License: | GPL-3 |
Imports: | Rcpp (≥ 0.12.9) |
LinkingTo: | Rcpp, RcppGSL |
SystemRequirements: | GNU GSL |
Encoding: | UTF-8 |
NeedsCompilation: | yes |
Maintainer: | Bruce Swihart <bruce.swihart@gmail.com> |
Repository: | CRAN |
RoxygenNote: | 7.2.1 |
Suggests: | testthat |
Packaged: | 2025-05-05 20:19:36 UTC; bruce |
Date/Publication: | 2025-05-05 20:40:02 UTC |
libstable4u: Fast and accurate evaluation, random number generation and parameter estimation of skew stable distributions.
Description
libstable4u provides functions to work with skew stable distributions in a fast and accurate way [1]. It performs:
Details
Fast and accurate evaluation of the probability density function (PDF) and cumulative density function (CDF).
Fast and accurate evaluation of the quantile function (inverse CDF).
Random numbers generation [2].
Skew stable parameter estimation with:
McCulloch's method of quantiles [3].
Koutrouvellis' method based on the characteristic function [4].
Maximum likelihood estimation.
Modified maximum likelihood estimation as described in [1]. *The evaluation of the PDF and CDF is based on the formulas provided by John P Nolan in [5].
Author(s)
Javier Royuela del Val, Federico Simmross Wattenberg and Carlos Alberola López;
Maintainer: Javier Royuela del Val jroyval@lpi.tel.uva.es
References
[1] Royuela-del-Val J, Simmross-Wattenberg F, Alberola López C (2017). libstable: Fast, Parallel and High-Precision Computation of alpha-stable Distributions in R, C/C++ and MATLAB. Journal of Statistical Software, 78(1), 1-25. doi:10.18637/jss.v078.i01
[2] Chambers JM, Mallows CL, Stuck BW (1976). A Method for Simulating Stable Random Variables. Journal of the American Statistical Association, 71(354), 340-344. doi:10.1080/01621459.1976.10480344
[3] McCulloch JH (1986). Simple Consistent Estimators of Stable Distribution Parameters. Communications in Statistics - Simulation and Computation, 15(4), 1109-1136. doi:10.1080/03610918608812563
[4] Koutrouvelis IA (1981). An Iterative Procedure for the Estimation of the Parameters of Stable Laws. Communications in Statistics - Simulation and Computation, 10(1), 17-28. doi:10.1080/03610918108812189
[5] Nolan JP (1997). Numerical Calculation of Stable Densities and Distribution Functions. Stochastic Models, 13(4), 759-774. doi:10.1080/15326349708807450
Examples
# Set alpha, beta, sigma and mu stable parameters in a vector
pars <- c(1.5, 0.9, 1, 0)
# Generate an abscissas axis and probabilities vector
x <- seq(-5, 10, 0.05)
p <- seq(0.01, 0.99, 0.01)
# Calculate pdf, cdf and quantiles
pdf <- stable_pdf(x, pars)
cdf <- stable_cdf(x, pars)
xq <- stable_q(p, pars)
# Generate random values
set.seed(1)
rnd <- stable_rnd(100, pars)
head(rnd)
# Estimate the parameters of the skew stable distribution given
# the generated sample:
# Using the McCulloch's estimator:
pars_init <- stable_fit_init(rnd)
# Using the Koutrouvelis' estimator, with McCulloch estimation
# as a starting point:
pars_est_K <- stable_fit_koutrouvelis(rnd, pars_init)
# Using maximum likelihood estimator:
pars_est_ML <- stable_fit_mle(rnd, pars_est_K)
# Using modified maximum likelihood estimator (see [1]):
pars_est_ML2 <- stable_fit_mle2d(rnd, pars_est_K)
Methods for parameter estimation of skew stable distributions.
Description
A set of functions are provided that perform the parameter estimation of skew stable distributions with different methods.
Usage
stable_fit_init(rnd, parametrization = 0L)
stable_fit_koutrouvelis(rnd, pars_init = as.numeric(c()), parametrization = 0L)
Arguments
rnd |
Random sample |
parametrization |
Parametrization used for the skew stable distribution, as defined by JP Nolan (1997). By default, parametrization = 0. |
pars_init |
Vector with an initial estimation of the parameters.
|
Details
-
stable_fit_init()
uses McCulloch's method of quantiles [3]. This is usually a good initialization for the rest of the methods. -
stable_fit_koutrouvelis()
implements Koutrouvellis' method based on the characteristic function [4]. -
stable_fit_mle()
implements a Maximum likelihood estimation. -
stable_fit_mle2()
implements a modified maximum likelihood estimation as described in [1].
Value
A numeric vector.
Author(s)
Javier Royuela del Val, Federico Simmross Wattenberg and Carlos Alberola López
Maintainer: Javier Royuela del Val jroyval@lpi.tel.uva.es
References
[1] Royuela-del-Val J, Simmross-Wattenberg F, Alberola López C (2017). libstable: Fast, Parallel and High-Precision Computation of alpha-stable Distributions in R, C/C++ and MATLAB. Journal of Statistical Software, 78(1), 1-25. doi:10.18637/jss.v078.i01
[2] Chambers JM, Mallows CL, Stuck BW (1976). A Method for Simulating Stable Random Variables. Journal of the American Statistical Association, 71(354), 340-344. doi:10.1080/01621459.1976.10480344.
[3] McCulloch JH (1986). Simple Consistent Estimators of Stable Distribution Parameters. Communications in Statistics - Simulation and Computation, 15(4), 1109-1136. doi:10.1080/03610918608812563.
[4] Koutrouvelis IA (1981). An Iterative Procedure for the Estimation of the Parameters of Stable Laws. Communications in Statistics - Simulation and Computation, 10(1), 17-28. doi:10.1080/03610918108812189.
[5] Nolan JP (1997). Numerical Calculation of Stable Densities and Distribution Functions. Stochastic Models, 13(4) 759-774. doi:10.1080/15326349708807450.
Examples
# Set alpha, beta, sigma and mu stable parameters in a vector
pars <- c(1.5, 0.9, 1, 0)
# Generate random values
set.seed(1)
rnd <- stable_rnd(100, pars)
head(rnd)
# Estimate the parameters of the skew stable distribution given
# the generated sample:
# Using the McCulloch's estimator:
pars_init <- stable_fit_init(rnd)
# Using the Koutrouvelis' estimator, with McCulloch estimation
# as a starting point:
pars_est_K <- stable_fit_koutrouvelis(rnd, pars_init)
# Using maximum likelihood estimator:
pars_est_ML <- stable_fit_mle(rnd, pars_est_K)
# Using modified maximum likelihood estimator (see [1]):
pars_est_ML2 <- stable_fit_mle2d(rnd, pars_est_K)
PDF and CDF of a skew stable distribution.
Description
Evaluate the PDF or the CDF of the skew stable distribution with parameters
pars = c(alpha, beta, sigma, mu) at the points given in x.
parametrization argument specifies the parametrization used for the distribution
as described by JP Nolan (1997). The default value is parametrization = 0.
tol sets the relative error tolerance (precision) to tol. The default value is tol = 1e-12.
Usage
stable_pdf(x, pars, parametrization = 0L, tol = 1e-12)
Arguments
x |
Vector of points where the pdf will be evaluated. |
pars |
Vector with an initial estimation of the parameters.
|
parametrization |
Parametrization used for the skew stable distribution, as defined by JP Nolan (1997). By default, parametrization = 0. |
tol |
Relative error tolerance (precission) of the calculated values. By default, tol = 1e-12. |
Value
A numeric vector.
Author(s)
Javier Royuela del Val, Federico Simmross Wattenberg and Carlos Alberola López
Maintainer: Javier Royuela del Val jroyval@lpi.tel.uva.es
References
Nolan JP (1997). Numerical Calculation of Stable Densities and Distribution Functions. Stochastic Models, 13(4) 759-774.
Examples
pars <- c(1.5, 0.9, 1, 0)
x <- seq(-5, 10, 0.001)
pdf <- stable_pdf(x, pars)
cdf <- stable_cdf(x, pars)
plot(x, pdf, type = "l")
Quantile function of skew stable distributions
Description
Evaluate the quantile function (CDF^-1) of the skew stable distribution
with parameters pars = c(alpha, beta, sigma, mu) at the points given in p.
parametrization argument specifies the parametrization used for the distribution
as described by JP Nolan (1997). The default value is parametrization = 0.
tol sets the relative error tolerance (precission) to tol. The default value is tol = 1e-12.
Usage
stable_q(p, pars, parametrization = 0L, tol = 1e-12)
Arguments
p |
Vector of points where the quantile function will be evaluated, with 0 < p[i] < 1.0 |
pars |
Vector with an initial estimation of the parameters.
|
parametrization |
Parametrization used for the skew stable distribution, as defined by JP Nolan (1997). By default, parametrization = 0. |
tol |
Relative error tolerance (precission) of the calculated values. By default, tol = 1e-12. |
Value
A numeric vector.
Author(s)
Javier Royuela del Val, Federico Simmross Wattenberg and Carlos Alberola López
Maintainer: Javier Royuela del Val jroyval@lpi.tel.uva.es
Skew stable distribution random sample generation.
Description
stable_rnd(N, pars)
generates N random samples of a skew stable distribuiton
with parameters pars = c(alpha, beta, sigma, mu) using the Chambers, Mallows,
and Stuck (1976) method.
Usage
stable_rnd(N, pars, parametrization = 0L)
Arguments
N |
Number of values to generate. |
pars |
Vector with an initial estimation of the parameters.
|
parametrization |
Parametrization used for the skew stable distribution, as defined by JP Nolan (1997). By default, parametrization = 0. |
Value
A numeric vector.
Author(s)
Javier Royuela del Val, Federico Simmross Wattenberg and Carlos Alberola López
Maintainer: Javier Royuela del Val jroyval@lpi.tel.uva.es
References
Chambers JM, Mallows CL, Stuck BW (1976). A Method for Simulating Stable Random Variables. Journal of the American Statistical Association, 71(354), 340-344. doi:10.1080/01621459.1976.10480344.
Examples
N <- 1000
pars <- c(1.25, 0.95, 1.0, 0.0)
rnd <- stable_rnd(N, pars)
hist(rnd)