Main Content

pearsrnd

Pearson system random numbers

Syntax

r = pearsrnd(mu,sigma,skew,kurt,m,n)
r = pearsrnd(mu,sigma,skew,kurt)
r = pearsrnd(mu,sigma,skew,kurt,m,n,...)
r = pearsrnd(mu,sigma,skew,kurt,[m,n,...])
[r,type] = pearsrnd(...)
[r,type,coefs] = pearsrnd(...)

Description

r = pearsrnd(mu,sigma,skew,kurt,m,n) returns an m-by-n matrix of random numbers drawn from the distribution in the Pearson system with mean mu, standard deviation sigma, skewness skew, and kurtosis kurt. skew and kurt must be scalars. mu and sigma must be scalars or m-by-n arrays. pearsrnd expands each scalar input into a constant array of the same size as the array inputs.

Note

Because r is a random sample, its sample moments, especially the skewness and kurtosis, typically differ somewhat from the specified distribution moments.

pearsrnd uses the definition of kurtosis for which a normal distribution has a kurtosis of 3. Some definitions of kurtosis subtract 3, so that a normal distribution has a kurtosis of 0. The pearsrnd function does not use this convention.

Some combinations of moments are not valid; in particular, the kurtosis must be greater than the square of the skewness plus 1. The kurtosis of the normal distribution is defined to be 3.

r = pearsrnd(mu,sigma,skew,kurt) returns a scalar value.

r = pearsrnd(mu,sigma,skew,kurt,m,n,...) or r = pearsrnd(mu,sigma,skew,kurt,[m,n,...]) returns an m-by-n-by-... array.

[r,type] = pearsrnd(...) returns the type of the specified distribution within the Pearson system. type is a scalar integer from 0 to 7. Set m and n to 0 to identify the distribution type without generating any random values.

The seven distribution types in the Pearson system correspond to the following distributions:

  • 0Normal distribution

  • 1 — Four-parameter beta distribution

  • 2 — Symmetric four-parameter beta distribution

  • 3 — Three-parameter gamma distribution

  • 4 — Not related to any standard distribution. The density is proportional to:

    (1 + ((xa)/b)2)c exp(–d arctan((xa)/b)).

  • 5 — Inverse gamma location-scale distribution

  • 6F location-scale distribution

  • 7 — Student's t location-scale distribution

[r,type,coefs] = pearsrnd(...) returns the coefficients coefs of the quadratic polynomial that defines the distribution via the differential equation

ddxlog(p(x))=(a+x)c(0)+c(1)x+c(2)x2.

Examples

Generate random values from the standard normal distribution:

r = pearsrnd(0,1,0,3,100,1);  % Equivalent to randn(100,1)
Determine the distribution type:
[r,type] = pearsrnd(0,1,1,4,0,0);
r =
     []
type =
     1

References

[1] Johnson, N.L., S. Kotz, and N. Balakrishnan (1994) Continuous Univariate Distributions, Volume 1, Wiley-Interscience, Pg 15, Eqn 12.33.

Extended Capabilities

Version History

Introduced in R2006a