plotgl {gld} | R 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
If it is a a single value, it is Note that the numbering of the |
lambda2 |
|
lambda3 |
|
lambda4 |
|
lambda5 |
|
param |
choose parameterisation:
|
add |
a logical value describing whether this should add to an existing plot (using
|
truncate |
for |
bnw |
a logical value, true for a black and white plot, with different
densities identified using line type ( |
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 |
... |
arguments that get passed to |
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
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