Categories &

Functions List

Function Reference: johnsrnd

statistics: r = johnsrnd (quantiles)
statistics: r = johnsrnd (quantiles, m)
statistics: r = johnsrnd (quantiles, m, n, …)
statistics: r = johnsrnd (quantiles, [m, n, …])
statistics: [r, type, coefs] = johnsrnd (…)

Random arrays from the Johnson system of distributions.

r = johnsrnd (quantiles) returns a random value drawn from the distribution in the Johnson system that matches the four values in quantiles. quantiles is a four-element vector of the desired quantiles at the standard normal quantiles [-1.5, -0.5, 0.5, 1.5], and its elements must be strictly increasing. johnsrnd fits the Johnson curve passing through these four points using the quantile method of Slifker and Shapiro.

quantiles may also be a 2-by-4 numeric matrix, whose first row holds four strictly increasing, evenly spaced standard normal quantiles and whose second row holds the corresponding strictly increasing data quantiles.

johnsrnd (quantiles, m, n, …) or johnsrnd (quantiles, [m, n, …]) returns an m-by-n-by-… array of random values, following the size conventions of randn.

[r, type, coefs] = johnsrnd (…) also returns the selected member of the Johnson system in type, one of "SN" (the normal distribution), "SL" (lognormal), "SU" (unbounded), or "SB" (bounded), and the coefficients coefs = [gamma, delta, xi, lambda] of the transform. A value r is generated by transforming a standard normal deviate z as r = xi + lambda * g ((z - gamma) / delta), where g is the identity, exp, sinh, or the logistic function for "SN", "SL", "SU", and "SB", respectively.

See also: pearsrnd, random, randn

Source Code: johnsrnd

Fit a Johnson distribution to four quantiles and identify its type

 rng (42);
 [r, type, coefs] = johnsrnd ([-1, -0.25, 0.75, 3])
r = 0.1645
type = SU
coefs =

  -0.8439   1.0390  -0.5000   0.7416

Draw a sample and check its shape

 rng (42);
 r = johnsrnd ([-1, -0.25, 0.75, 3], 1, 1000);
 hist (r, 50);
plotted figure