R: Random Generator for Stable Family of Distributions
rstable
R Documentation
Random Generator for Stable Family of Distributions
Description
Returns random deviates from the stable family of probability distributions.
Usage
rstable(n, scale = 1, index = stop("no index arg"), skewness = 0)
Arguments
n
sample size
index
number from the interval (0, 2]. An index of 2 corresponds to the normal, 1 to the Cauchy. Smaller values mean longer tails.
skewness
number giving the modified skewness (see Chambers et al., 1976). Negative values correspond to skewness to the left (the median is smaller than the mean, if it exists), and positive values correspond to skewness to the right (the median is larger than the mean). The absolute value of skewness should not exceed 1.
scale
the scale of the distribution.
Details
This function returns a random variate from the Levy skew stable
distribution with index=alpha, scale=c and skewness=beta. The skewness parameter must lie in the range [-1,1] while the index parameter must lie in the range (0,2]. The Levy skew stable probability distribution is defined by a fourier transform,
p(x) = {1 over 2 π} int_{-∞}^{+∞} dt exp(-it x - |c t|^α (1-i β sign(t) \tan(πα/2)))
When alpha=1 the term tan(pi alpha/2) is replaced by -(2/pi) log|t|. For alpha=2 the distribution reduces to a Gaussian distribution with sigma = sqrt(2) scale and the skewness parameter has no effect. For alpha < 1 the tails of the distribution become extremely
wide. The symmetric distribution corresponds to beta=0.
The Levy alpha-stable distributions have the property that if N alpha-stable variates are drawn from the distribution p(c, alpha, beta) then the sum $Y = X_1 + X_2 + ... + X_N$ will also be distributed as an alpha-stable variate, p(N^{1/alpha} c, alpha, beta).
There is no explicit solution for the form of p(x) and there are no density, probability or quantile functions supplied for this distribution.
Value
random sample from the specified stable distribution.
References
Chambers, J. M., Mallows, C. L. and Stuck, B. W. (1976). A Method for Simulating Stable Random Variables. Journal of the American Statistical Association 71, 340-344.
Lo"gae"ve, M. (1977). Probability Theory I. (fourth edition) Springer-Verlag, New York.
See Also
rnorm, rcauchy.
Examples
hist(rstable(200, 1.5, .5)) #fairly long tails, skewed right
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(CircStats)
Loading required package: MASS
Loading required package: boot
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/CircStats/rstable.Rd_%03d_medium.png", width=480, height=480)
> ### Name: rstable
> ### Title: Random Generator for Stable Family of Distributions
> ### Aliases: rstable
> ### Keywords: distribution
>
> ### ** Examples
>
> hist(rstable(200, 1.5, .5)) #fairly long tails, skewed right
>
>
>
>
>
> dev.off()
null device
1
>