Johnson {SuppDists}R Documentation

The Johnson distributions

Description

Density, distribution function, quantile function, random generator and summary function for the Johnson distributions.

Usage

dJohnson(x, parms, log=FALSE)
pJohnson(q, parms, lower.tail=TRUE, log.p=FALSE)
qJohnson(p, parms, lower.tail=TRUE, log.p=FALSE)
rJohnson(n, parms)
sJohnson(parms)
JohnsonFit(x,moment=FALSE) 
moments(x)

Arguments

x,q vector of quantities
p vector of probabilities
n vector of numbers of observations
parms list or list of lists each containing output of JohnsonFit()
moment logical scalar; if TRUE, fit will be done using the moments of x, otherwise quantiles are used
log, log.p logical vector; if TRUE, probabilities p are given as log(p)
lower.tail logical vector; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]

Details

The Johnson system (Johnson 1949) is a very flexible system for describing statistical distributions. It is defined by

z=gamma+delta log(f(u)), with u=(x-xi)/lambda

and where f( ) has four possible forms:

SL: f(u)=u the log normal
SB: f(u)=u+sqrt(1+u^2) an unbounded distribution
SU: f(u)=u/(1-u) a bounded distribution
SN: exp(u) the normal

Estimation of the Johnson parameters may be done from quantiles. The procedure of Wheeler (1980) is used.

They may also be estimated from the moments. Applied Statistics algorithm 99, due to Hill, Hill, and Holder (1976) has been translated into C for this implementation.

Value

The output values conform to the output from other such functions in R. dJohnson() gives the density, pJohnson() the distribution function and qJohnson() its inverse. rJohnson() generates random numbers. sJohnson() produces a list containing parameters corresponding to the arguments – mean, median, mode, variance, sd, third cental moment, fourth central moment, Pearson's skewness, skewness, and kurtosis.

moments() calculates the moment statistics of x as a vector with elements (mu, sigma, skew, kurt), where mu is the mean of x, sigma the SD of x with divisor length(x), skew is the skewness and kurt the kurtosis.

JohnsonFit() outputs a list containing the Johnson parameters (gamma, delta, xi, lambda, type), where type is one of the Johnson types: "SN", "SL", "SB", or "SU". JohnsonFit() does this by default using 5 order statistics, but when moment=TRUE it does this by using the first four moments of x calculated by the function moments().

Fitting by moments is difficult numerically and often JohnsonFit() will report an error.

Author(s)

Bob Wheeler bwheeler@echip.com

References

Hill, I.D., Hill, R., and Holder, R.L. (1976). Fitting Johnson curves by moments. Applied Statistics. AS99.

Johnson, N.L. (1949). Systems of frequency curves generated by methods of translation. Biometrika, 36. 149-176.

Wheeler, R.E. (1980). Quantile estimators of Johnson curve parameters. Biometrika. 67-3 725-728

Examples


xx<-rnorm(500)
parms<-JohnsonFit(xx)
sJohnson(parms)
plot(function(xx)dJohnson(xx,parms),-2,2)
pJohnson(1,parms)
parms2<-JohnsonFit(rexp(50))
qJohnson(p=0.5,list(parms,parms2))

## JohnsonFit with moments=TRUE is not always possible, and even
## when possible, may produce odd results.

## parms<-JohnsonFit(x,moment=TRUE)
sJohnson(parms) 

# Fit illustration
data(cars)
xx<-cars$speed
parms<-JohnsonFit(xx)
hist(xx,freq=FALSE)
plot(function(x)dJohnson(x,parms),0,25,add=TRUE)