Title: | Estimation and Use of the Generalised (Tukey) Lambda Distribution |
---|---|
Description: | The generalised lambda distribution, or Tukey lambda distribution, provides a wide variety of shapes with one functional form. This package provides random numbers, quantiles, probabilities, densities and density quantiles for four different types of the distribution, the FKML (Freimer et al 1988), RS (Ramberg and Schmeiser 1974), GPD (van Staden and Loots 2009) and FM5 - see documentation for details. It provides the density function, distribution function, and Quantile-Quantile plots. It implements a variety of estimation methods for the distribution, including diagnostic plots. Estimation methods include the starship (all 4 types), method of L-Moments for the GPD and FKML types, and a number of methods for only the FKML type. These include maximum likelihood, maximum product of spacings, Titterington's method, Moments, Trimmed L-Moments and Distributional Least Absolutes. |
Authors: | Robert King [aut, cre] , Benjamin Dean [aut], Sigbert Klinke [aut], Paul van Staden [aut] |
Maintainer: | Robert King <[email protected]> |
License: | GPL (>= 2) |
Version: | 2.6.6 |
Built: | 2024-11-04 05:34:11 UTC |
Source: | https://github.com/newystats/gld |
By defining the Beta Function in terms of the Gamma Function,
the function can be defined for non-integer negative values of
a and b. The special case of this where is needed
to calculate the standard errors of the L Moment estimates of the
gpd type of the generalised lambda distribution, so this function
carries out that calculation.
BetaLambdaLambda(lambda)
BetaLambdaLambda(lambda)
lambda |
A vector, each element of which is used for both arguments of the Beta function. |
NaN
is returned for any negative integer elements of lambda
.
A vector the same length as lambda
, containing
Beta(lambda,lambda)
Robert King, [email protected], https://github.com/newystats/
Paul van Staden
https://github.com/newystats/gld/
beta
gamma
fit.gpd
GeneralisedLambdaDistribution
BetaLambdaLambda(-0.3)
BetaLambdaLambda(-0.3)
Estimates parameters of the FKML parameterisation of the Generalised Distribution. Five estimation methods are available;
Numerical Maximum Likelihood,
Maximum Product of Spacings, Titterington's Method,
the Starship (also available in the
starship
function, which uses the same underlying code as this for the fkml parameterisation),
Trimmed L-Moments, L-Moments, Distributional Least Absolutes, and Method of Moments.
fit.fkml(x, method = "ML", t1 = 0, t2 = 0, l3.grid = c(-0.9, -0.5, -0.1, 0, 0.1, 0.2, 0.4, 0.8, 1, 1.5), l4.grid = l3.grid, record.cpu.time = TRUE, optim.method = "Nelder-Mead", inverse.eps = .Machine$double.eps, optim.control=list(maxit=10000), optim.penalty=1e20, return.data=FALSE)
fit.fkml(x, method = "ML", t1 = 0, t2 = 0, l3.grid = c(-0.9, -0.5, -0.1, 0, 0.1, 0.2, 0.4, 0.8, 1, 1.5), l4.grid = l3.grid, record.cpu.time = TRUE, optim.method = "Nelder-Mead", inverse.eps = .Machine$double.eps, optim.control=list(maxit=10000), optim.penalty=1e20, return.data=FALSE)
x |
Data to be fitted, as a vector |
method |
A character string, to select the estimation method. One of: |
t1 |
Number of observations to be trimmed from the left in the conceptual sample, |
t2 |
Number of observations to be trimmed from the right in the conceptual sample, |
l3.grid |
A vector of values to form the grid of values of |
l4.grid |
A vector of values to form the grid of values of |
record.cpu.time |
Boolean — should the CPU time used in fitting be recorded in the fitted model object? |
optim.method |
Optimisation method, use any of the options available under |
inverse.eps |
Accuracy of calculation for the numerical determination of |
optim.control |
List of options for the optimisation step. See
|
optim.penalty |
The penalty to be added to the objective function if parameter values are proposed outside the allowed region |
return.data |
Logical: Should the function return the data (from the argument |
Maximum Likelihood Estimation of the generalised lambda distribution (gld
) proceeds by calculating the density of the data for candidate values of the parameters. Because the
gld is defined by its quantile function, the method first numerically
obtains F(x) by inverting Q(u), then obtains the density for that observation.
Maximum Product of Spacings estimation (sometimes referred to as Maximum
Spacing Estimation, or Maximum Spacings Product) finds the
parameter values that
maximise the product of the spacings (the difference between successive
depths, , where
is the distribution
function for the candidate values of the parameters). See
Dean (2013) and Cheng & Amin (1981) for details.
Titterington (1985) remarked that MPS effectively added
an “extra observation”; there are N data points in the original
sample, but N + 1 spacings in the expression maximised in MPS.
Instead of using spacings between transformed data points, so method TM
uses spacings between transformed, adjacently-averaged, data points.
The spacings are given by ,
where
and
for i = 1,2, ... n-1
(where
and
are the lower and upper bounds on the support of the distribution).
This reduces the number of spacings to
and achieves concordance
with the original sample size. See Titterington (1985) and
Dean (2013) for details.
The starship is built on the fact that the
is a transformation of the uniform distribution. Thus the inverse of
this transformation is the distribution function for the gld. The
starship method applies different values of the parameters of the distribution to
the distribution function, calculates the depths q corresponding to
the data and chooses the parameters that make these calculated depths
closest (as measured by the Anderson-Darling statistic) to a uniform distribution.
See King & MacGillivray (1999) for details.
TL-Moment estimation chooses the values of the parameters that minimise the
difference between the sample Trimmed L-Moments of the data and the Trimmed
L-Moments of the fitted distribution.
TL-Moments are based on inflating the conceptual sample size used in the definition of L-Moments. The t1
and t2
arguments to the
function define the extent of trimming of the conceptual sample. Thus,
the default values of t1=0
and t2=0
reduce the TL-Moment
method to L-Moment estimation. t1
and t2
give the number of
observations to be trimmed (from the left and right respectively) from
the conceptual sample of size . These two
arguments should be non-negative integers, and
, where n is the sample size.
See Elamir and Seheult (2003) for more on
TL-Moments in general, Asquith, (2007) for TL-Moments of the RS parameterisation of the gld and Dean (2013) for more details on TL-Moment estimation of the gld.
The method of distributional least absolutes (DLA) minimises the sum of absolute deviations between the order statistics and their medians (based on the candidate parameters). See Dean (2013) for more information.
Moment estimation chooses the values of the parameters that minimise the (sum of the squared) difference between the first four sample moments of the data and the first four moments of the fitted distribution.
fit.fkml
returns an object of class
"starship"
(regardless of the estimation method used).
print
prints the estimated values of the parameters, while
summary.starship
prints these by default, but can also provide
details of the estimation process (from the components grid.results
,
data
and optim
detailed below).
The value of fit.fkml
is a list containing the
following components:
lambda |
A vector of length 4, giving
the estimated parameters, in order,
|
grid.results |
output from the grid search |
optim |
output from the optim search,
|
cpu |
A vector showing the computing time used, returned if
|
data |
The data, if |
Robert King, [email protected], https://github.com/newystats/
Ben Dean, University of Newcastle [email protected]
Asquith, W. H. (2007), L-Moments and TL-Moments of the Generalized Lambda Distribution, Computational Statistics & Data Analysis, 51, 4484–4496.
Cheng, R.C.H. & Amin, N.A.K. (1981), Maximum Likelihood Estimation of Parameters in the Inverse Gaussian Distribution, with Unknown Origin, Technometrics, 23(3), 257–263. https://www.jstor.org/stable/1267789
Dean, B. (2013) Improved Estimation and Regression Techniques with the Generalised Lambda Distribution, PhD Thesis, University of Newcastle https://nova.newcastle.edu.au/vital/access/manager/Repository/uon:13503
Elamir, E. A. H., and Seheult, A. H. (2003), Trimmed L-Moments, Computational Statistics & Data Analysis, 43, 299–314.
King, R.A.R. & MacGillivray, H. L. (1999), A starship method for
fitting the generalised distributions,
Australian and New Zealand Journal of
Statistics 41, 353–374.
Titterington, D. M. (1985), Comment on ‘Estimating Parameters in Continuous Univariate Distributions’, Journal of the Royal Statistical Society, Series B, 47, 115–116.
starship
GeneralisedLambdaDistribution
example.data <- rgl(200,c(3,1,.4,-0.1),param="fkml") example.fit <- fit.fkml(example.data,"MSP",return.data=TRUE) print(example.fit) summary(example.fit) plot(example.fit,one.page=FALSE)
example.data <- rgl(200,c(3,1,.4,-0.1),param="fkml") example.fit <- fit.fkml(example.data,"MSP",return.data=TRUE) print(example.fit) summary(example.fit) plot(example.fit,one.page=FALSE)
Estimates parameters of the generalised lambda distribution (FKML type) using the Method of Moments, on the basis of moments calculated from data, or moment values (mean, variance, skewness ratio and kurtosis ratio (note, not the excess kurtosis)).
fit.fkml.moments(data,na.rm=TRUE, optim.method="Nelder-Mead", optim.control= list(), starting.point = c(0,0)) fit.fkml.moments.val(moments=c(mean=0, variance=1, skewness=0, kurtosis=3), optim.method="Nelder-Mead", optim.control= list(), starting.point = c(0,0))
fit.fkml.moments(data,na.rm=TRUE, optim.method="Nelder-Mead", optim.control= list(), starting.point = c(0,0)) fit.fkml.moments.val(moments=c(mean=0, variance=1, skewness=0, kurtosis=3), optim.method="Nelder-Mead", optim.control= list(), starting.point = c(0,0))
data |
A vector of data |
na.rm |
Logical - should NAs be removed from the data - if FALSE, any NAs in the data will cause an error |
moments |
A vector of length 4, consisting of the mean, variance and moment ratios for skewness and kurtosis (do not subtract 3 from the kurtosis ratio) |
optim.method |
Optimisation method for |
optim.control |
argument |
starting.point |
a vector of length 2, giving the starting value
for |
Estimates parameters of the generalised lambda distribution
(FKML type) using Method of Moments on the basis of moment values (mean,
variance, skewness ratio and kurtosis ratio). Note this is the fourth
central moment divided by the second central moment, without subtracting 3.
fit.fkml.moments
will estimates
using the method of moments for a dataset, including calculating the
sample moments.
This function uses optim
to find the parameters that
minimise the sum of squared differences between the skewness and kurtosis
sample ratios and their counterpart expressions for those ratios on the
basis of the parameters and
.
On the basis of these estimates (and the mean and variance), this function
then estimates
and then
.
Note that the first 4 moments don't uniquely identify members of the
generalised distribution. Typically,
for a set of moments that correspond to a unimodal gld, there is
another set of parameters that give a distrbution with the same first
4 moments. This other distribution has a truncated appearance
(that is, the distribution has finite support and the density is non-zero
at the end points). See the examples below.
A vector containing the parameters of the FKML type generalised lambda;
- location parameter
- scale parameter
- first shape parameter
- second shape parameter
(See
gld
for more details)
Robert King, [email protected], https://github.com/newystats/
Sigbert Klinke
Paul van Staden
Au-Yeung, Susanna W. M. (2003) Finding Probability Distributions From Moments, Masters thesis, Imperial College of Science, Technology and Medicine (University of London), Department of Computing
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.
Lakhany, Asif and Mausser, Helmut (2000) Estimating the parameters of the generalized lambda distribution, Algo Research Quarterly, 3(3):47–58
van Staden, Paul (2013) Modeling of generalized families of probability distributions inthe quantile statistical universe, PhD thesis, University of Pretoria. https://repository.up.ac.za/handle/2263/40265
https://github.com/newystats/gld/
# Moment estimate example.data = rgl(n=400,lambda1=c(0,1,0.4,0), param="fkml") fit.fkml.moments(example.data) # Approximation to the standard normal distribution norm.approx <- fit.fkml.moments.val(c(0,1,0,3)) norm.approx # Another distribution with the same moments another <- fit.fkml.moments.val(c(0,1,0,3),start=c(2,2)) another # Compared plotgld(norm.approx$lambda,ylim=c(0,0.75),main="Approximation to the standard normal", sub="and another GLD with the same first 4 moments") plotgld(another$lambda,add=TRUE,col=2)
# Moment estimate example.data = rgl(n=400,lambda1=c(0,1,0.4,0), param="fkml") fit.fkml.moments(example.data) # Approximation to the standard normal distribution norm.approx <- fit.fkml.moments.val(c(0,1,0,3)) norm.approx # Another distribution with the same moments another <- fit.fkml.moments.val(c(0,1,0,3),start=c(2,2)) another # Compared plotgld(norm.approx$lambda,ylim=c(0,0.75),main="Approximation to the standard normal", sub="and another GLD with the same first 4 moments") plotgld(another$lambda,add=TRUE,col=2)
Estimates parameters of the GPD type generalised Distribution. Estimation is via method of L moments or the starship method.
The Method of L-Moments estimates for the GPD type are the only estimates for any generalised lambda distribution type with closed form expressions, and the only with algebraic results for standard errors of the estimates.
For further details on the starship method, see starship
.
fit.gpd(x, method = "LM", na.rm = TRUE, record.cpu.time = TRUE, return.data = FALSE, LambdaZeroEpsilon=1e-15) fit.gpd.lmom(data, na.rm = TRUE,LambdaZeroEpsilon=1e-15) fit.gpd.lmom.given(lmoms, n = NULL,LambdaZeroEpsilon=1e-15)
fit.gpd(x, method = "LM", na.rm = TRUE, record.cpu.time = TRUE, return.data = FALSE, LambdaZeroEpsilon=1e-15) fit.gpd.lmom(data, na.rm = TRUE,LambdaZeroEpsilon=1e-15) fit.gpd.lmom.given(lmoms, n = NULL,LambdaZeroEpsilon=1e-15)
x |
Data to be fitted, as a vector |
method |
A character string, to select the estimation method. The available methods are 1. "LM" for Method of L-Moments, 2. "SM" or "starship" for the Starship method. |
na.rm |
Logical: Should missing values be removed? |
record.cpu.time |
Logical: should the CPU time used in fitting be recorded in the fitted model object? |
return.data |
Logical: Should the function return the data (from the argument |
data |
Data to be fitted, as a vector |
lmoms |
A numeric vector containing two L-moments and two L-moment ratios, in the order |
n |
the sample size, defaults to NULL |
LambdaZeroEpsilon |
tolerance for lambda estimate of zero |
The starship method calls the starship
function - see its help for more details.
The method of L-Moments equates sample L-Moments with expressions for the L-Moments of the GPD type GLD. Closed form expressions exist to give these estimates.
For many values there are two possible estimates for the same L Moment values, one in each of two regions of the GPD GLD parameter space, denoted region A and region B in van Staden (2013). More details on these regions can be found on page 154 of van Staden (2013).
If the 4th L-Moment ratio, is less than the minimum
value that
can obtain for the GPD generalised lambda
distribution;
there is no possible L-Moment estimate (from either region A or B), and this function returns NA for the estimates.
When estimating from data, or for given L-Moments with given,
standard errors of the estimates are calculated if possible (standard errors are only finite if
).
If is zero, the GPD gld is a special case
the Quantile Based Skew Logistic Distribution. If the estimated
is within
LambdaZeroEpsilon
of zero, standard errors for alpha, beta and delta are calculated for the Quantile Based Skew Logistic Distribution and NA is returned as the standard error of .
These functions return an object of class
"GldGPDFit
". It is a list, containing these components (optional components noted here);
estA |
The estimate in region A. This will be NULL if there is no estimate in region A |
estB |
The estimate in region B. This will be NULL if there is no estimate in region B |
warn |
(only if estA and estB are both NULL), the reason there are no
estimates. If this is the case, the function also issues a |
cpu |
A vector showing the computing time used, returned if
|
data |
The data, if |
param |
The character |
starship |
The value returned by |
Each of the estimate elements (if they are not NULL) are either a vector of length 4, or a 4 by 2 matrix if standard errors are calculated. The elements of the vector, or rows of the matrix are the estimated parameters, in order;
alpha |
location parameter |
beta |
scale parameter |
delta |
skewness parameter |
lambda |
kurtosis parameter |
The columns of the matrix are the parameter, and its standard error.
Robert King, [email protected], https://github.com/newystats/
Paul van Staden
Van Staden, Paul J., & M.T. Loots. (2009), Method of L-moment Estimation for the Generalized Lambda Distribution. In Proceedings of the Third Annual ASEARC Conference. Callaghan, NSW 2308 Australia: School of Mathematical and Physical Sciences, University of Newcastle.
fit.gpd.lmom.given(c(1,.3,.6,.8)) example.data = rgl(n=300,c(5,2,0.8,-0.1),param="gpd") fit.gpd(example.data) fit.gpd(example.data,method="starship")
fit.gpd.lmom.given(c(1,.3,.6,.8)) example.data = rgl(n=300,c(5,2,0.8,-0.1),param="gpd") fit.gpd(example.data) fit.gpd(example.data,method="starship")
Density, density quantile, distribution function, quantile
function and random generation for the generalised lambda distribution
(also known as the asymmetric lambda, or Tukey lambda). Provides for four
different parameterisations, the fmkl
(recommended), the rs
, the gpd
and
a five parameter version of the FMKL, the fm5
.
dgl(x, lambda1 = 0, lambda2 = NULL, lambda3 = NULL, lambda4 = NULL, param = "fkml", lambda5 = NULL, inverse.eps = .Machine$double.eps, max.iterations = 500) dqgl(p, lambda1, lambda2 = NULL, lambda3 = NULL, lambda4 = NULL, param = "fkml", lambda5 = NULL) pgl(q, lambda1 = 0, lambda2 = NULL, lambda3 = NULL, lambda4 = NULL, param = "fkml", lambda5 = NULL, inverse.eps = .Machine$double.eps, max.iterations = 500) qgl(p, lambda1, lambda2 = NULL, lambda3 = NULL, lambda4 = NULL, param = "fkml", lambda5 = NULL) rgl(n, lambda1=0, lambda2 = NULL, lambda3 = NULL, lambda4 = NULL, param = "fkml", lambda5 = NULL)
dgl(x, lambda1 = 0, lambda2 = NULL, lambda3 = NULL, lambda4 = NULL, param = "fkml", lambda5 = NULL, inverse.eps = .Machine$double.eps, max.iterations = 500) dqgl(p, lambda1, lambda2 = NULL, lambda3 = NULL, lambda4 = NULL, param = "fkml", lambda5 = NULL) pgl(q, lambda1 = 0, lambda2 = NULL, lambda3 = NULL, lambda4 = NULL, param = "fkml", lambda5 = NULL, inverse.eps = .Machine$double.eps, max.iterations = 500) qgl(p, lambda1, lambda2 = NULL, lambda3 = NULL, lambda4 = NULL, param = "fkml", lambda5 = NULL) rgl(n, lambda1=0, lambda2 = NULL, lambda3 = NULL, lambda4 = NULL, param = "fkml", lambda5 = NULL)
x , q
|
vector of quantiles. |
p |
vector of probabilities. |
n |
number of observations. |
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 (see below for details)
|
inverse.eps |
Accuracy of calculation for the numerical determination of
|
max.iterations |
Maximum number of iterations in the numerical
determination of |
The generalised lambda distribution, also known as the asymmetric lambda,
or Tukey lambda distribution, is a distribution with a wide range of shapes.
The distribution is defined by its quantile function (Q(u)), the inverse of the
distribution function. The gld
package implements three parameterisations of the distribution.
The default parameterisation (the FMKL) is that due to Freimer
Mudholkar, Kollia and Lin (1988) (see references below), with a quantile
function:
for .
A second parameterisation, the RS, chosen by setting param="rs"
is
that due to Ramberg and Schmeiser (1974), with the quantile function:
This parameterisation has a complex series of rules determining which values of the parameters produce valid statistical distributions. See gl.check.lambda for details.
Another parameterisation, the GPD, chosen by setting param="gpd"
is
due to van Staden and Loots (2009), with a quantile function:
for
and
.
(where the parameters appear in the
par
argument to the function in the order ). This parameterisation has simpler
L-moments than other parameterisations and
is a skewness parameter
and
is a tailweight parameter.
Another parameterisation, the FM5, chosen by setting param="fm5"
adds an additional skewing parameter to the FMKL parameterisation.
This uses the same approach as that used by
Gilchrist (2000)
for the RS parameterisation. The quantile function is
for
and
.
The distribution is defined by its quantile function and its distribution and
density functions do not exist in closed form. Accordingly, the results
from pgl
and dgl
are the result of numerical solutions to the
quantile function, using the Newton-Raphson method. Since the density
quantile function, , does exist, an additional
function,
dqgl
, computes this.
The functions qdgl.fmkl
, qdgl.rs
, qdgl.fm5
,
qgl.fmkl
, qgl.rs
and qgl.fm5
from versions 1.5 and
earlier of the gld
package have been renamed (and hidden) to .qdgl.fmkl
,
.qdgl.rs
, ..qdgl.fm5
, .qgl.fmkl
, .qgl.rs
and .qgl.fm5
respectively. See the code for more details
dgl
gives the density (based on the quantile density and a
numerical solution to ),
qdgl
gives the quantile density,
pgl
gives the distribution function (based on a numerical
solution to ),
qgl
gives the quantile function, and
rgl
generates random deviates.
Robert King, [email protected], https://github.com/newystats/
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.
Gilchrist, Warren G. (2000), Statistical Modelling with Quantile Functions, Chapman and Hall
Karian, Z.A., Dudewicz, E.J., and McDonald, P. (1996), The extended generalized lambda distribution system for fitting distributions to data: history, completion of theory, tables, applications, the “Final Word” on Moment fi ts, Communications in Statistics - Simulation and Computation 25, 611–642.
Karian, Zaven A. and Dudewicz, Edward J. (2000), Fitting statistical distributions: the Generalized Lambda Distribution and Generalized Bootstrap methods, Chapman & Hall
Ramberg, J. S. & Schmeiser, B. W. (1974), An approximate method for generating asymmetric random variables, Communications of the ACM 17, 78–82.
Van Staden, Paul J., & M.T. Loots. (2009), Method of L-moment Estimation for the Generalized Lambda Distribution. In Proceedings of the Third Annual ASEARC Conference. Callaghan, NSW 2308 Australia: School of Mathematical and Physical Sciences, University of Newcastle.
https://github.com/newystats/gld/
qgl(seq(0,1,0.02),0,1,0.123,-4.3) pgl(seq(-2,2,0.2),0,1,-.1,-.2,param="fmkl")
qgl(seq(0,1,0.02),0,1,0.123,-4.3) pgl(seq(-2,2,0.2),0,1,-.1,-.2,param="fmkl")
Checks the validity of parameters of the generalized lambda. The tests are simple for the FMKL, FM5 and GPD types, and much more complex for the RS parameterisation.
gl.check.lambda(lambdas, lambda2 = NULL, lambda3 = NULL, lambda4 = NULL, param = "fkml", lambda5 = NULL, vect = FALSE)
gl.check.lambda(lambdas, lambda2 = NULL, lambda3 = NULL, lambda4 = NULL, param = "fkml", lambda5 = NULL, vect = FALSE)
lambdas |
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:
|
vect |
A logical, set this to TRUE if the parameters are given in the
vector form (it turns off checking of the format of |
See GeneralisedLambdaDistribution
for details on the
generalised lambda distribution. This function determines the validity of
parameters of the distribution.
The FMKL parameterisation gives a valid
statistical distribution for any real values of ,
,
and any positive real
values of
.
The FM5 parameterisation gives statistical distribution for any real
values of ,
,
, any positive real values of
and values of
that
satisfy
.
For the RS parameterisation, the combinations of parameters value that give valid distributions are the following (the region numbers in the table correspond to the labelling of the regions in Ramberg and Schmeiser (1974) and Karian, Dudewicz and McDonald (1996)):
region | |
|
|
|
note |
1 | all | |
|
|
|
2 | all | |
|
|
|
3 | all | |
|
|
one of and must be non-zero |
4 | all | |
|
|
one of and must be non-zero |
5 | all | |
and |
|
equation 1 below must also be satisfied |
6 | all | |
|
and
|
equation 2 below must also be satisfied |
Equation 1
Equation 2
The GPD type gives a valid distribution provided is
positive and
.
This logical function takes on a value of TRUE if the parameter values given produce a valid statistical distribution and FALSE if they don't
The complex nature of the rules in this function for the RS parameterisation are the reason for the invention of the FMKL parameterisation and its status as the default parameterisation in the other generalized lambda functions.
Robert King, [email protected], https://github.com/newystats/
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.
Karian, Z.E., Dudewicz, E.J., and McDonald, P. (1996), The extended generalized lambda distribution system for fitting distributions to data: history, completion of theory, tables, applications, the “Final Word” on Moment fits, Communications in Statistics - Simulation and Computation 25, 611–642.
Ramberg, J. S. & Schmeiser, B. W. (1974), An approximate method for generating asymmetric random variables, Communications of the ACM 17, 78–82.
https://github.com/newystats/gld/
The generalized lambda functions GeneralisedLambdaDistribution
gl.check.lambda(c(0,1,.23,4.5),vect=TRUE) ## TRUE gl.check.lambda(c(0,-1,.23,4.5),vect=TRUE) ## FALSE gl.check.lambda(c(0,1,0.5,-0.5),param="rs",vect=TRUE) ## FALSE gl.check.lambda(c(0,2,1,3.4,1.2),param="fm5",vect=TRUE) ## FALSE
gl.check.lambda(c(0,1,.23,4.5),vect=TRUE) ## TRUE gl.check.lambda(c(0,-1,.23,4.5),vect=TRUE) ## FALSE gl.check.lambda(c(0,1,0.5,-0.5),param="rs",vect=TRUE) ## FALSE gl.check.lambda(c(0,2,1,3.4,1.2),param="fm5",vect=TRUE) ## FALSE
qdgl
: This calculates the density quantile function of
the GLD, so it has been renamed dqgl
.
Calculates the first four L-Moments of the GPD type
generalised distribution for given parameter
values.
gld.lmoments(pars,order=1:4,ratios=TRUE,type="GPD",param=NULL)
gld.lmoments(pars,order=1:4,ratios=TRUE,type="GPD",param=NULL)
pars |
A vector of length 4, giving the parameters of the GPD type generalised lambda distribution, consisting of;
|
order |
Integers to select the orders of L-moments to calculate. Currently this function only calculates for orders 1 to 4. |
type |
choose the type of generalised lambda distribution. Currently |
ratios |
Logical. TRUE gives L-moment ratios for skewness and
kurtosis ( |
param |
alias for the type argument. The |
The GPD type generalised distribution was
introduced by van Staden and Loots (2009). It has explicit parameters
for skewness and kurtosis, and closed form estimates for L-moment
estimates of the parameters.
In the limit, as the kurtosis parameter, , goes
to zero, the distribution approaches the skew logistic distribution of
van Staden and King (2013). See the
sld
package for this
distribution.
A vector containing the selected L-moments of the GPD type generalised
lambda. If ratio
is true, the vector contains L-Moment ratios for orders 3 and over, otherwise all values are L-Moments.
Robert King, [email protected], https://github.com/newystats/
Paul van Staden
van Staden, P.J. and King, Robert A.R. (2015) The quantile-based skew logistic distribution, Statistics and Probability Letters 96 109–116. doi:10.1016/j.spl.2014.09.001
van Staden, Paul J. 2013 Modeling of generalized families of probability distribution in the quantile statistical universe. PhD thesis, University of Pretoria. https://repository.up.ac.za/handle/2263/40265
Van Staden, Paul J., & M.T. Loots. (2009), Method of L-moment Estimation for the Generalized Lambda Distribution. In Proceedings of the Third Annual ASEARC Conference. Callaghan, NSW 2308 Australia: School of Mathematical and Physical Sciences, University of Newcastle.
Quantile based Skew logistic distribution
Generalised Lambda Distribution
https://github.com/newystats/gld/
sld
package
gld.lmoments(c(0,1,0.5,0.23)) gld.lmoments(c(0,1,0,0.23)) gld.lmoments(c(0,1,0.5,0.7))
gld.lmoments(c(0,1,0.5,0.23)) gld.lmoments(c(0,1,0,0.23)) gld.lmoments(c(0,1,0.5,0.7))
Calculates the mean, variance, skewness ratio and kurtosis ratio of the generalised distribution for
given parameter values.
gld.moments(par,type="fkml",ratios=TRUE)
gld.moments(par,type="fkml",ratios=TRUE)
par |
A vector of length 4, giving the parameters of the
generalised lambda distribution, consisting of;
|
type |
choose the type of generalised lambda distribution. Currently |
ratios |
Logical. TRUE to give moment ratios for skewness and kurtosis, FALSE to give the third and fourth central moments instead. |
The FKML type of the generalised distribution was
introduced by Freimer et al (1988) who gave expressions for the moments.
In the limit, as the shape parameters (
and
) go to zero, the distribution is defined using
limit results. The moments in these limiting cases were given by
van Staden (2013). This function calculates the first 4 moments.
See pages 96–97 of van Staden (2013) for the full expressions for these moments.
A vector containing the first four moments of the FKML type generalized
lambda. If ratio
is true, the vector contains the mean,
variance, skewness ratio and kurtosis ratio. If ratio
is false,
the vector contains the mean, variance, third central moment and fourth
central moment.
Robert King, [email protected], https://github.com/newystats/
Sigbert Klinke
Paul van Staden
Au-Yeung, Susanna W. M. (2003) Finding Probability Distributions From Moments, Masters thesis, Imperial College of Science, Technology and Medicine (University of London), Department of Computing
Freimer, M., Kollia, G., Mudholkar, G. S., & Lin, C. T. (1988), A study of the generalized tukey lambda family, Communications in Statistics - Theory and Methods 17, 3547–3567.
Lakhany, Asif and Mausser, Helmut (2000) Estimating the parameters of the generalized lambda distribution, Algo Research Quarterly, 3(3):47–58
van Staden, Paul J. (2013) Modeling of generalized families of probability distributions inthe quantile statistical universe, PhD thesis, University of Pretoria. https://repository.up.ac.za/handle/2263/40265
https://github.com/newystats/gld/
gld.moments(c(0,1.463551,0.1349124,0.1349124)) gld.moments(c(0,1.813799,0,0)) gld.moments(c(0,1,0,3))
gld.moments(c(0,1.463551,0.1349124,0.1349124)) gld.moments(c(0,1.813799,0,0)) gld.moments(c(0,1,0,3))
Plots to compare a fitted Generalised Lambda Distribution to data. This works with fitted gld objects from starship
or fit.fkml
.
## S3 method for class 'starship' plot(x, data, ask = NULL, one.page = FALSE, breaks = "Sturges", plot.title = "default",...)
## S3 method for class 'starship' plot(x, data, ask = NULL, one.page = FALSE, breaks = "Sturges", plot.title = "default",...)
x |
An object of class |
data |
Data to which the gld was fitted. Leave this as NULL if the return.data argument was TRUE in the call that created ( |
ask |
Ask for user input before next plot. The default of NULL changes to TRUE if one.page is FALSE and |
one.page |
If TRUE, put the two plots on one page using |
breaks |
Control the number of histogram bins — passed to |
plot.title |
Main title for histogram and QQ — passed
to |
... |
This function produces a Q-Q plot of the data against the fitted generalised lambda distribution and a histogram of the data overlaid with the fitted probability density function.
Robert King, [email protected], https://github.com/newystats/
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.
King, R.A.R. & MacGillivray, H. L. (1999), A starship method for
fitting the generalised distributions,
Australian and New Zealand Journal of
Statistics 41, 353–374
https://github.com/newystats/gld/
data <- rgl(100,0,1,.2,.2) starship.result <- starship(data,optim.method="Nelder-Mead",initgrid=list(lcvect=(0:4)/10, ldvect=(0:4)/10),return.data=TRUE) plot(starship.result)
data <- rgl(100,0,1,.2,.2) starship.result <- starship(data,optim.method="Nelder-Mead",initgrid=list(lcvect=(0:4)/10, ldvect=(0:4)/10),return.data=TRUE) plot(starship.result)
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, , means that a seperate function that
uses the depths to produce the values to plot is more efficient
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, ...)
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, ...)
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 |
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, , but not explicitly available as a function of
. 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.
A number of quantiles from the distribution, the default being the minimum, maximum and quartiles.
Robert King, [email protected], https://github.com/newystats/
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/
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
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
Print (or summarise) the results of a starship
estimation
of the parameters of the Generalised Lambda Distribution
## S3 method for class 'starship' summary(object, ...) ## S3 method for class 'starship' print(x, digits = max(3, getOption("digits") - 3), ...)
## S3 method for class 'starship' summary(object, ...) ## S3 method for class 'starship' print(x, digits = max(3, getOption("digits") - 3), ...)
x |
An object of class |
object |
An object of class |
digits |
minimal number of significant digits, see
|
... |
arguments passed to |
summary
Gives the details of the starship.adaptivegrid
and optim
steps.
Robert King, [email protected], https://github.com/newystats/
Darren Wraith
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.
King, R.A.R. & MacGillivray, H. L. (1999), A starship method for
fitting the generalised distributions,
Australian and New Zealand Journal of
Statistics 41, 353–374
Owen, D. B. (1988), The starship, Communications in Statistics - Computation and Simulation 17, 315–323.
https://github.com/newystats/gld/
starship
,
starship.adaptivegrid
,
starship.obj
data <- rgl(100,0,1,.2,.2) starship.result <- starship(data,optim.method="Nelder-Mead",initgrid=list(lcvect=(0:4)/10, ldvect=(0:4)/10)) print(starship.result) summary(starship.result,estimation.details=TRUE)
data <- rgl(100,0,1,.2,.2) starship.result <- starship(data,optim.method="Nelder-Mead",initgrid=list(lcvect=(0:4)/10, ldvect=(0:4)/10)) print(starship.result) summary(starship.result,estimation.details=TRUE)
See qdgl help instead.
qdgl(p, lambda1, lambda2 = NULL, lambda3 = NULL, lambda4 = NULL, param = "fkml", lambda5 = NULL)
qdgl(p, lambda1, lambda2 = NULL, lambda3 = NULL, lambda4 = NULL, param = "fkml", lambda5 = NULL)
p |
See qdgl help instead. |
lambda1 |
See qdgl help instead. |
lambda2 |
See qdgl help instead. |
lambda3 |
See qdgl help instead. |
lambda4 |
See qdgl help instead. |
param |
See qdgl help instead. |
lambda5 |
See qdgl help instead. |
See qdgl help instead.
qqgl
produces a Quantile-Quantile plot of data against the
generalised lambda distribution, or a Q-Q plot to compare two sets of parameter values
for the generalised lambda distribution. It does for the generalised lambda
distribution what qqnorm
does for the normal.
qqgl(y = NULL, lambda1 = 0, lambda2 = NULL, lambda3 = NULL, lambda4 = NULL, param = "fkml", lambda5 = NULL, abline = TRUE, lambda.pars1 = NULL, lambda.pars2 = NULL, param2 = "fkml", points.for.2.param.sets = 4000, ...)
qqgl(y = NULL, lambda1 = 0, lambda2 = NULL, lambda3 = NULL, lambda4 = NULL, param = "fkml", lambda5 = NULL, abline = TRUE, lambda.pars1 = NULL, lambda.pars2 = NULL, param2 = "fkml", points.for.2.param.sets = 4000, ...)
y |
The data sample |
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
Alternatively, leave If it is a a single value, it is Note that the numbering of the |
lambda2 |
|
lambda3 |
|
lambda4 |
|
lambda5 |
|
param |
choose parameterisation:
|
abline |
A logical value, TRUE adds a line through the origian with a slope of 1 to the plot |
lambda.pars1 |
Parameters of the generalised lambda
distribution (see |
lambda.pars2 |
Second set of parameters of the generalised lambda
distribution (see |
param2 |
parameterisation to use for the second set of parameter values |
points.for.2.param.sets |
Number of quantiles to use in a Q-Q plot comparing two sets of parameter values |
... |
graphical parameters, passed to |
See gld
for more details on the Generalised Lambda
Distribution. A Q-Q plot provides a way to visually assess the
correspondence between a dataset and a particular distribution, or between two
distributions.
A list of the same form as that returned by qqline
x |
The x coordinates of the points that were/would be plotted,
corresponding to a generalised lambda distibution with parameters
|
y |
The original |
Robert King, [email protected], https://github.com/newystats/
King, R.A.R. & MacGillivray, H. L. (1999), A starship method for
fitting the generalised distributions,
Australian and New Zealand Journal of
Statistics 41, 353–374
https://github.com/newystats/gld/
qqgl(rgl(100,0,1,0,-.1),0,1,0,-.1) qqgl(lambda1=c(0,1,0.01,0.01),lambda.pars2=c(0,.01,0.01,0.01),param2="rs",pch=".")
qqgl(rgl(100,0,1,0,-.1),0,1,0,-.1) qqgl(lambda1=c(0,1,0.01,0.01),lambda.pars2=c(0,.01,0.01,0.01),param2="rs",pch=".")
Estimates parameters of the generalised lambda
distribution on the basis of data, using the starship method.
The starship method is built on the fact that the
generalised lambda distribution (gld
)
is a transformation of the uniform distribution. This method finds the
parameters that transform the data closest to the uniform distribution.
This function uses a grid-based search to find a suitable starting point (using
starship.adaptivegrid
) then uses optim
to find
the parameters that do this.
starship(data, optim.method = "Nelder-Mead", initgrid = NULL, inverse.eps = .Machine$double.eps, param="FMKL", optim.control=NULL, return.data=FALSE)
starship(data, optim.method = "Nelder-Mead", initgrid = NULL, inverse.eps = .Machine$double.eps, param="FMKL", optim.control=NULL, return.data=FALSE)
data |
Data to be fitted, as a vector |
||||||||||||||||||||||||||||||||||||||||||||
optim.method |
Optimisation method for |
||||||||||||||||||||||||||||||||||||||||||||
initgrid |
Grid of values of If it is left as NULL, the default grid depends on the parameterisation.
For
( For
( For
and
For
and
|
||||||||||||||||||||||||||||||||||||||||||||
inverse.eps |
Accuracy of calculation for the numerical determination of
|
||||||||||||||||||||||||||||||||||||||||||||
param |
choose parameterisation:
|
||||||||||||||||||||||||||||||||||||||||||||
optim.control |
List of options for the optimisation step. See
|
||||||||||||||||||||||||||||||||||||||||||||
return.data |
Logical: Should the function return the data (from the argument |
The starship method is described in King & MacGillivray, 1999 (see
references). It is built on the fact that the
generalised lambda distribution (gld
)
is a transformation of the uniform distribution. Thus the inverse of this
transformation is the distribution function for the gld. The starship method
applies different values of the parameters of the distribution to the
distribution function, calculates the depths q corresponding to the data
and chooses the parameters that make the depths closest to a uniform
distribution.
The closeness to the uniform is assessed by calculating the Anderson-Darling
goodness-of-fit test on the transformed data against the uniform, for a
sample of size length(data)
.
This is implemented in 2 stages in this function. First a grid search is
carried out, over a small number of possible parameter values
(see starship.adaptivegrid
for details). Then the minimum from
this search is given as a starting point for an optimisation of the
Anderson-Darling value using optim, with method given by optim.method
See GeneralisedLambdaDistribution
for details on
parameterisations.
starship
returns an object of class
"starship"
.
print
prints the estimated values of the parameters, while
summary.starship
prints these by default, but can also provide
details of the estimation process (from the components grid.results
and
optim
detailed below).
An object of class "starship"
is a list containing at least the
following components:
lambda |
A vector of length 4 (or 5, for the fm5 parameterisation), giving
the estimated parameters, in order,
In the gpd parameterisation, the parameters are labelled:
|
grid.results |
output from the grid search - see
|
optim |
output from the optim search -
|
Robert King, [email protected], https://github.com/newystats/
Darren Wraith
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.
King, R.A.R. & MacGillivray, H. L. (1999), A starship method for
fitting the generalised distributions,
Australian and New Zealand Journal of
Statistics 41, 353–374
Owen, D. B. (1988), The starship, Communications in Statistics - Computation and Simulation 17, 315–323.
https://github.com/newystats/gld/
starship.adaptivegrid
,
starship.obj
exampledata <- rgl(300,c(0,1,0.2,0)) starship(exampledata)
exampledata <- rgl(300,c(0,1,0.2,0)) starship(exampledata)
Calculates estimates for the generalised lambda
distribution on the basis of data, using the starship method.
The starship method is built on the fact that the
generalised lambda distribution (gld
)
is a transformation of the uniform distribution. This method finds the
parameters that transform the data closest to the uniform distribution.
This function uses a grid-based search.
starship.adaptivegrid(data, initgrid,inverse.eps = 1e-08, param="FMKL")
starship.adaptivegrid(data, initgrid,inverse.eps = 1e-08, param="FMKL")
data |
Data to be fitted, as a vector |
initgrid |
A list with elements,
|
inverse.eps |
Accuracy of calculation for the numerical determination of
|
param |
choose parameterisation:
|
The starship method is described in King and MacGillivray, 1999 (see
references). It is built on the fact that the
generalised lambda distribution (gld
)
is a transformation of the uniform distribution. Thus the inverse of this
transformation is the distribution function for the gld. The starship method
applies different values of the parameters of the distribution to the
distribution function, calculates the depths q corresponding to the data
and chooses the parameters that make the depths closest to a uniform
distribution.
The closeness to the uniform is assessed by calculating the Anderson-Darling
goodness-of-fit test on the transformed data against the uniform, for a
sample of size length(data)
.
This function carries out a grid-based search. This was the original method
of King and MacGillivray, 1999, but you are advised to instead use
starship
which uses a grid-based search together with an
optimisation based search.
See GeneralisedLambdaDistribution
for details on
parameterisations.
response |
The minimum “response value” — the result of the internal goodness-of-fit measure. This is the return value of starship.obj. See King and MacGillivray, 1999 for more details |
lambda |
A vector of length 4 giving the values of
|
Robert King, [email protected], https://github.com/newystats/
Darren Wraith
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.
King, R.A.R. & MacGillivray, H. L. (1999), A starship method for
fitting the generalised distributions,
Australian and New Zealand Journal of
Statistics 41, 353–374
Owen, D. B. (1988), The starship, Communications in Statistics - Computation and Simulation 17, 315–323.
https://github.com/newystats/gld/
data <- rgl(100,0,1,.2,.2) starship.adaptivegrid(data,list(lcvect=(0:4)/10,ldvect=(0:4)/10))
data <- rgl(100,0,1,.2,.2) starship.adaptivegrid(data,list(lcvect=(0:4)/10,ldvect=(0:4)/10))
The starship is a method for fitting the generalised lambda distribution.
See starship
for more details.
This function is the objective funciton minimised in the methods. It is a goodness of fit measure carried out on the depths of the data.
starship.obj(par, data, inverse.eps, param = "fmkl")
starship.obj(par, data, inverse.eps, param = "fmkl")
par |
parameters of the generalised lambda distribution, a vector of
length 4, giving |
data |
Data — a vector |
inverse.eps |
Accuracy of calculation for the numerical determination of
|
param |
choose parameterisation:
|
The starship method is described in King and MacGillivray, 1999 (see
references). It is built on the fact that the
generalised lambda distribution (gld
)
is a transformation of the uniform distribution. Thus the inverse of this
transformation is the distribution function for the gld. The starship method
applies different values of the parameters of the distribution to the
distribution function, calculates the depths q corresponding to the data
and chooses the parameters that make the depths closest to a uniform
distribution.
The closeness to the uniform is assessed by calculating the Anderson-Darling
goodness-of-fit test on the transformed data against the uniform, for a
sample of size length(data)
.
This function returns that objective function. It is provided as a seperate
function to allow users to carry out minimisations using optim
or other methods. The recommended method is to use the starship
function.
The Anderson-Darling goodness of fit measure, computed on the transformed data, compared to a uniform distribution. Note that this is NOT the goodness-of-fit measure of the generalised lambda distribution with the given parameter values to the data.
Robert King, [email protected], https://github.com/newystats/ Darren Wraith
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.
King, R.A.R. & MacGillivray, H. L. (1999), A starship method for
fitting the generalised distributions,
Australian and New Zealand Journal of
Statistics 41, 353–374
Owen, D. B. (1988), The starship, Communications in Statistics - Computation and Simulation 17, 315–323.
https://github.com/newystats/gld/
starship
,
starship.adaptivegrid
data <- rgl(100,0,1,.2,.2) starship.obj(c(0,1,.2,.2),data,inverse.eps=1e-10,"fmkl")
data <- rgl(100,0,1,.2,.2) starship.obj(c(0,1,.2,.2),data,inverse.eps=1e-10,"fmkl")