Johnson {SuppDists} | R Documentation |
Density, distribution function, quantile function, random generator and summary function for the Johnson distributions.
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(t,moment="quant") moments(x)
x,q |
vector of quantities |
t |
observation vector, t=x, or moment vector, t=[mean,m2,m3,m4] |
p |
vector of probabilities |
n |
vector of numbers of observations |
parms |
list or list of lists each containing output of JohnsonFit() |
moment |
character scalar specifying t: "quant" (default), or "use," or "find" |
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] |
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 |
SU: | f(u)=u+sqrt(1+u^2) an unbounded distribution |
SB: | 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.
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 using 5 order statistics when moment="quant", when moment="find" it does this by using the first four moments of t calculated by the function moments()
, when moment="use" it assumes that the vector t is [mean,m2,m3,m4], where mi is the ith moment about the mean.
Fitting by moments is difficult numerically and often JohnsonFit()
will report an error.
Bob Wheeler bwheelerg@gmail.com
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
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 moment="find" and moment="use" is not always possible, ## and even when possible, may produce odd results. ## parms<-JohnsonFit(x,moment="find") parms<-JohnsonFit(c(0,1,-.5,4),moment="use") 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)