We are hiring ! See our job offers.
Revision 161411bb86f97e5a8bd89091cd61d03a33c2761a authored by Martin Maechler on 06 February 2012, 00:00:00 UTC, committed by Gabor Csardi on 06 February 2012, 00:00:00 UTC
1 parent 5bc804b
Raw File
Tip revision: 161411bb86f97e5a8bd89091cd61d03a33c2761a authored by Martin Maechler on 06 February 2012, 00:00:00 UTC
version 0.8-0
Tip revision: 161411b
\title{Random Numbers from (Skew) Stable Distributions}
  Generate random numbers of the stable distribution
  \deqn{S(\alpha, \beta, \gamma, \delta; k)} with characteristic
  exponent \eqn{\alpha\in(0,2]}{alpha in (0,2]},
  skewness \eqn{\beta\in[-1,1]}{beta in [-1,1]},
  scale    \eqn{\gamma\in[0,\infty)}{gamma in [0,Inf)}, and
  location \eqn{\delta\in\mathbf{R}}{delta in IR}; see Nolan (2010) for
  the parameterization \eqn{k\in\{0,1\}}{k in {0,1}}.  The case
  \eqn{\gamma=0} is understood as the unit jump at \eqn{\delta}.
rstable1(n, alpha, beta, gamma = 1, delta = 0, pm = 1)
  \item{n}{an \code{\link{integer}}, the number of observations to generate.}
    \item{alpha}{characteristic exponent \eqn{\alpha\in(0,2]}{alpha in (0,2]}.}
    \item{beta}{skewness \eqn{\beta\in[-1,1]}{beta in [-1,1]}.}
    \item{gamma}{scale \eqn{\gamma\in[0,\infty)}{gamma in [0,Inf)}.}
    \item{delta}{location \eqn{\delta\in\mathbf{R}}{delta in IR}.}
    \item{pm}{0 or 1, denoting which parametrization (as by Nolan) is used.}
  A \code{\link{numeric}} vector of length \code{n} containing the
  generated random variates.
  We use the approach of John Nolan for generating random variates of
  stable distributions.  The function \code{rstable1} provides two basic
  parametrizations, by default,

  \code{pm = 1}, the so called \dQuote{S}, \dQuote{S1}, or \dQuote{1}
  parameterization.  This is the parameterization used by Samorodnitsky and
  Taqqu (1994), and is a slight modification of Zolotarev's (A)
  parameterization.  It is the form with the most simple form of the
  characteristic function; see Nolan (2010, p. 8).

  \code{pm = 0} is the \dQuote{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.
  Diethelm Wuertz wrote \code{\link[fBasics]{rstable}} for Rmetrics;
  Martin Maechler vectorized it (also in \code{alpha},\dots), fixed it
  for \eqn{\alpha=1,\beta\ne 0}{alpha = 1, beta != 0} and sped it up.
\seealso{\code{\link[fBasics]{rstable}} which also allows the
  2-parametrization and provides further functionality for
  stable distributions.
  Chambers, J. M., Mallows, C. L., and Stuck, B. W. (1976),
  \emph{A Method for Simulating Stable Random Variables},
  J.  Amer.  Statist.  Assoc. \bold{71}, 340--344.

  Nolan, J. P. (2010),
  \emph{Stable Distributions---Models for Heavy Tailed Data},

  Samoridnitsky, G. and Taqqu, M. S. (1994),
  \emph{Stable Non-Gaussian Random Processes, Stochastic Models
    with Infinite Variance},
  Chapman and Hall, New York.

% Nolan, J.P. (1999),
% \emph{Stable Distributions},
% Preprint, University Washington DC, 30 pages.

% Nolan, J.P. (1999),
%     \emph{Numerical Calculation of Stable Densities and Distribution
%     Functions},
%     Preprint, University Washington DC, 16 pages.

% Weron, A., Weron R. (1999),
%     \emph{Computer Simulation of Levy alpha-Stable Variables and
%     Processes},
%     Preprint Technical Univeristy of Wroclaw, 13 pages.
   # Generate and plot a series of stable random variates
   r <- rstable1(n = 1000, alpha = 1.9, beta = 0.3)
   plot(r, type = "l", main = "stable: alpha=1.9 beta=0.3",
        col = "steelblue"); grid()

   hist(r, "Scott", prob = TRUE, ylim = c(0,0.3),
        main = "Stable S(1.9, 0.3; 1)")
   lines(density(r), col="red2", lwd = 2)
back to top