plotgl: Plots of density and distribution function for the...

plotglR Documentation

Plots of density and distribution function for the generalised lambda distribution

Description

Produces plots of density and distribution function for the generalised lambda distribution. Although you could use plot(function(x)dgl(x)) to do this, the fact that the density and quantiles of the generalised lambda are defined in terms of the depth, u, means that a seperate function that uses the depths to produce the values to plot is more efficient

Usage

plotgld(lambda1 = 0, lambda2 = NULL, lambda3 = NULL, lambda4 = NULL, 
  param = "fmkl", lambda5 = NULL, add = NULL, truncate = 0, 
  bnw = FALSE, col.or.type = 1, granularity = 10000, xlab = "x", 
  ylab = NULL, quant.probs = seq(0,1,.25), new.plot = NULL,  ...)
plotglc(lambda1 = 0, lambda2 = NULL, lambda3 = NULL, lambda4 = NULL, 
  param = "fmkl", lambda5 = NULL, granularity = 10000, xlab = "x", 
  ylab = "cumulative probability", add = FALSE, ...)

Arguments

lambda1

This can be either a single numeric value or a vector.

If it is a vector, it must be of length 4 for parameterisations fmkl or rs and of length 5 for parameterisation fm5. If it is a vector, it gives all the parameters of the generalised lambda distribution (see below for details) and the other lambda arguments must be left as NULL.

If it is a a single value, it is lambda 1, the location parameter of the distribution and the other parameters are given by the following arguments

Note that the numbering of the lambda parameters for the fmkl parameterisation is different to that used by Freimer, Mudholkar, Kollia and Lin.

lambda2

lambda 2 - scale parameter

lambda3

lambda 3 - first shape parameter

lambda4

lambda 4 - second shape parameter

lambda5

lambda 5 - a skewing parameter, in the fm5 parameterisation

param

choose parameterisation: fmkl uses Freimer, Mudholkar, Kollia and Lin (1988) (default). rs uses Ramberg and Schmeiser (1974) fm5 uses the 5 parameter version of the FMKL parameterisation (paper to appear)

add

a logical value describing whether this should add to an existing plot (using lines) or produce a new plot (using plot). Defaults to FALSE (new plot) if both add and new.plot are NULL.

truncate

for plotgld, a minimum density value at which the plot should be truncated.

bnw

a logical value, true for a black and white plot, with different densities identified using line type (lty), false for a colour plot, with different densities identified using line colour (col)

col.or.type

Colour or type of line to use

granularity

Number of points to calculate quantiles and density at — see details

xlab

X axis label

ylab

Y axis label

quant.probs

Quantiles of distribution to return (see value below). Set to NULL to suppress this return entirely.

new.plot

a logical value describing whether this should produce a new plot (using plot), or add to an existing plot (using lines). Ignored if add is set.

...

arguments that get passed to plot if this is a new plot

Details

The generalised lambda distribution is defined in terms of its quantile function. The density of the distribution is available explicitly as a function of depths, u, but not explicitly available as a function of x. This function calculates quantiles and depths as a function of depths to produce a density plot plotgld or cumulative probability plot plotglc.

The plot can be truncated, either by restricting the values using xlim — see par for details, or by the truncate argument, which specifies a minimum density. This is recommended for graphs of densities where the tail is very long.

Value

A number of quantiles from the distribution, the default being the minimum, maximum and quartiles.

Author(s)

Robert King, robert.king.newcastle@gmail.com, https://github.com/newystats/

References

Freimer, M., Mudholkar, G. S., Kollia, G. & Lin, C. T. (1988), A study of the generalized tukey lambda family, Communications in Statistics - Theory and Methods 17, 3547–3567.

Ramberg, J. S. & Schmeiser, B. W. (1974), An approximate method for generating asymmetric random variables, Communications of the ACM 17, 78–82.

Karian, Z.E. & Dudewicz, E.J. (2000), Fitting Statistical Distributions to Data: The generalised Lambda Distribution and the Generalised Bootstrap Methods, CRC Press.

https://github.com/newystats/gld/

See Also

GeneralisedLambdaDistribution

Examples

plotgld(0,1.4640474,.1349,.1349,main="Approximation to Standard Normal", 
sub="But you can see this isn't on infinite support")

plotgld(1.42857143,1,.7,.3,main="The whale")
plotglc(1.42857143,1,.7,.3)
plotgld(0,-1,5,-0.3,param="rs")
plotgld(0,-1,5,-0.3,param="rs",xlim=c(1,2))
# A bizarre shape from the RS paramterisation
plotgld(0,1,5,-0.3,param="fmkl")
plotgld(10/3,1,.3,-1,truncate=1e-3)

plotgld(0,1,.0742,.0742,col.or.type=2,param="rs",
main="All distributions have the same moments",
sub="The full Range of all distributions is shown")
plotgld(0,1,6.026,6.026,col.or.type=3,new.plot=FALSE,param="rs")
plotgld(0,1,35.498,2.297,col.or.type=4,new.plot=FALSE,param="rs")
legend(0.25,3.5,lty=1,col=c(2,3,4),legend=c("(0,1,.0742,.0742)",
"(0,1,6.026,6.026)","(0,1,35.498,2.297)"),cex=0.9)
# An illustration of problems with moments as a method of characterising shape


gld documentation built on Oct. 23, 2022, 5:05 p.m.

Related to plotgl in gld...