Title: | Estimation and Use of the Quantile-Based Skew Logistic Distribution |
---|---|
Description: | The skew logistic distribution is a quantile-defined generalisation of the logistic distribution (van Staden and King 2015). Provides random numbers, quantiles, probabilities, densities and density quantiles for the distribution. It provides Quantile-Quantile plots and method of L-Moments estimation (including asymptotic standard errors) for the distribution. |
Authors: | Robert King [aut, cre] |
Maintainer: | Robert King <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.0.1 |
Built: | 2025-03-01 03:04:20 UTC |
Source: | https://github.com/newystats/sld |
Fits the quantile-based Skew Logistic Distribution using L-Moments.
fit.sld.lmom
calculates the sample L Moments of a dataset and uses the
method of L Moments to estimate the parameters of the skew logistic distribution.
fit.sld.lmom.given
fits the skew logistic using user-supplied values
of the first three L Moments.
fit.sld.lmom.given(lmoms,n=NULL) fit.sld.lmom(data)
fit.sld.lmom.given(lmoms,n=NULL) fit.sld.lmom(data)
lmoms |
A vector of length 3, containing the first and second (sample)
L Moments and the 3rd (sample) L Moment ratio ( |
n |
The sample size |
data |
A vector containing a dataset |
The method of L-Moments estimates of the parameters of the quantile-based skew logistic distribution are:
Note that in the
estimate is the 3rd L-Moment, not the 3rd L-Moment
ratio (
).
fit.sld.lmom
uses the samlmu
function (from
the lmom
package) to calculate the sample L moments, then
fit.sld.lmom.given
to calculate the estimates.
If the sample size is unknown (via using fit.sld.lmom.given
and not specifying the sample size), a vector of length 3, with the estimated parameters,
,
and
.
If the sample size is known, a 3 by 2 matrix. The first column
contains the estimated parameters,
,
and
,
and the second column provides asymptotic standard errors for these.
Note that if ,
is beyond its allowed value of [0,1]
and the function returns an error.
Values of
, beyond
correspond to distributions with
greater skew than the exponential / reflected exponential,
which form the limiting cases of the skew logistic distribution.
Robert King, [email protected], https://github.com/newystats and 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. http://hdl.handle.net/2263/40265
generated.data <- rsl(300,c(0,1,.4)) estimate1 <- fit.sld.lmom(generated.data) estimate2 <- fit.sld.lmom.given(c(0,1,.3),n=300) data(PCB1) hist(PCB1,prob=TRUE,main="PCB in Pelican Egg Yolk with SLD fit") fit.pcb <- fit.sld.lmom(PCB1) print(fit.pcb) plotsld(fit.pcb[,1],add=TRUE,col="blue")
generated.data <- rsl(300,c(0,1,.4)) estimate1 <- fit.sld.lmom(generated.data) estimate2 <- fit.sld.lmom.given(c(0,1,.3),n=300) data(PCB1) hist(PCB1,prob=TRUE,main="PCB in Pelican Egg Yolk with SLD fit") fit.pcb <- fit.sld.lmom(PCB1) print(fit.pcb) plotsld(fit.pcb[,1],add=TRUE,col="blue")
Calculate sample L-Moments of a dataset
lmom.sample(data,max.mom=3)
lmom.sample(data,max.mom=3)
data |
A vector containing a dataset |
max.mom |
The maximum order of L-Moment to estimate |
This function is a wrapper around the samlmu
function from
Hosking's lmom
package, to give different argument defaults.
It calculates sample L Moments.
A vector of length max.mom
. The first two elements are the first two
L moments. If max.mom
is greater than two, the following elements are
the corresponding L moment ratios (the L Moment divided by the 2nd L Moment).
Robert King, [email protected], https://github.com/newystats and Paul van Staden
Hosking, J. R. M. (1990). L-moments: analysis and estimation of distributions using linear combinations of order statistics. Journal of the Royal Statistical Society, Series B, 52, 105–124.
Hosking, J. R. M., and Wallis, J. R. (1997). Regional frequency analysis: an approach based on L-moments. Cambridge University Press.
J. R. M. Hosking (2014). L-moments. R package, version 2.2. https://cran.r-project.org/package=lmom
generated.data <- rsl(300,c(0,1,.4)) lmom.sample(data=generated.data,max.mom=3) data(PCB1) lmom.sample(PCB1,max.mom=3)
generated.data <- rsl(300,c(0,1,.4)) lmom.sample(data=generated.data,max.mom=3) data(PCB1) lmom.sample(PCB1,max.mom=3)
Concentration (parts per million) of polychlorinated biphenyl (PCB) in the yolk lipids of pelican (Pelecanus occidentalis) eggs, from Anacapa, California. Published by Risebrough (1972).
The data PCB
are the data as published in Risebrough (1972).
These data are also used in Thas (2010), as table 1, with
a difference in the 24th observation (265 in Risebrough and
256 in Thas). PCB1
is the version in table 1 of Thas (2010).
This is a subset of a wider collection of data on Pelecanus occidentalis eggs from Risebrough et al (undated).
data(PCB)
data(PCB)
The data are in one vector, named PCB.
Risebrough (1972) Effects of environmental pollutants upon animals other than man, Proceedings of the 6th Berkeley Symposium on Mathematical Statistics and Probability, Volume 6: Effects of Pollution on Health, 443–463, University of California Press, Berkeley, California.
http://projecteuclid.org/euclid.bsmsp/1200514718
R.W. Risebrough, F. Gress, J.K. Baptista, D.W. Anderson and R.W Schreiber (undated) Oceanic pollution: Effects on the reproduction of Brown Pelicans Pelecanus occidentalis, unpublished manuscript
Thas (2010) Comparing Distributions, Springer. 978-0-387-92710-7
data(PCB)
data(PCB)
Produces plots of density and distribution function for the quantile based skew
logistic distribution. Although you could use curve(dsl(x))
to do this, the fact that the density and quantiles of this distribution are
defined in terms of the depth, , means that a seperate function that
uses the depths to produce the values to plot is more accurate and efficient.
plotsld(parameters, add=FALSE, granularity = 10000, xlab = "x", ylab="density", quant.probs = seq(0,1,.25), ...) plotslc(parameters, add=FALSE, granularity = 10000, xlab = "quantile", ylab="depth", quant.probs = seq(0,1,.25), ...)
plotsld(parameters, add=FALSE, granularity = 10000, xlab = "x", ylab="density", quant.probs = seq(0,1,.25), ...) plotslc(parameters, add=FALSE, granularity = 10000, xlab = "quantile", ylab="depth", quant.probs = seq(0,1,.25), ...)
parameters |
A vector of length 3, giving the parameters of the
quantile-based skew logistic distribution. The 3 elements are
|
add |
Should this add to an existing plot (using |
granularity |
Number of points at which quantiles and density will be calculated.— 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. |
... |
arguments that get passed to |
The quantile-based skew logistic distribution is defined by its quantile
function. The density of the distribution is available explicitly as a
function of depths, , but not explicitly available as a function of
(except for the special cases at
=0,0.5 and 1).
This function calculates quantiles and density as a function of depths to
produce a density plot
plotsld
or cumulative probability plot
plotslc
.
A number of quantiles from the distribution, the default being the minimum, maximum and quartiles.
Robert King, [email protected], https://github.com/newystats/sld
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. http://hdl.handle.net/2263/40265
https://github.com/newystats/sld
plotsld(c(0,1,1),main="Exponential Distribution") plotsld(c(0,1,0.5),main="Logistic Distribution") plotsld(c(0,1,0.7)) plotslc(c(0,1,0.7))
plotsld(c(0,1,1),main="Exponential Distribution") plotsld(c(0,1,0.5),main="Logistic Distribution") plotsld(c(0,1,0.7)) plotslc(c(0,1,0.7))
qqgl
produces a Quantile-Quantile plot of data against the
quantile-based skew logistic distribution,
or a Q-Q plot to compare two sets of parameter values
for the quantile-based skew logistic distribution. This function does for the
skew logistic distribution what qqnorm
does for the normal.
qqsl(y=NULL,parameters1,parameters2=NULL,abline=TRUE, granularity.for.2.dists=4000,use.endpoints=FALSE,...)
qqsl(y=NULL,parameters1,parameters2=NULL,abline=TRUE, granularity.for.2.dists=4000,use.endpoints=FALSE,...)
y |
The data sample |
parameters1 |
A vector of length 3, containg the parameters of the
skew logistic distribution, |
parameters2 |
Second set of parameters of the skew logistic distribution. A vector of length 3, as described above for |
abline |
A logical value, TRUE adds a line through the origian with a slope of 1 to the plot |
granularity.for.2.dists |
Number of quantiles to use in a Q-Q plot comparing two sets of parameter values |
use.endpoints |
logical. When comparing two sets of parameter values, should Q(0) and Q(1) be used? TRUE will give QQ plots including the theoretical
minimum and maximum of the distribution, which is arguably not equivalent to
what would be seen in QQ plots based on data. FALSE will give QQ plots based on
ideal depths (type 8 quantiles, see |
... |
graphical parameters, passed to |
See sld
for more details on the Skew Logistic
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 skew logistic distibution with parameters
|
y |
The original |
Robert King, [email protected], https://github.com/newystats/sld and Paul van Staden
van Staden, P.J. and King, R.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. http://hdl.handle.net/2263/40265
https://github.com/newystats/sld
qqsl(y=rsl(100,c(0,1,0.7)),parameters1=c(0,1,0.7)) qqsl(parameters1=c(0,1,0.7),parameters2=c(0,0.9,0.5),col="blue")
qqsl(y=rsl(100,c(0,1,0.7)),parameters1=c(0,1,0.7)) qqsl(parameters1=c(0,1,0.7),parameters2=c(0,0.9,0.5),col="blue")
Density, density quantile, distribution and quantile functions and random generation for the quantile-based skew logistic distribution.
dsl(x,parameters,inverse.eps=.Machine$double.eps,max.iterations=500) dqsl(p,parameters) psl(q,parameters,inverse.eps=.Machine$double.eps,max.iterations=500) qsl(p,parameters) rsl(n,parameters)
dsl(x,parameters,inverse.eps=.Machine$double.eps,max.iterations=500) dqsl(p,parameters) psl(q,parameters,inverse.eps=.Machine$double.eps,max.iterations=500) qsl(p,parameters) rsl(n,parameters)
x , q
|
vector of quantiles. |
p |
vector of probabilities. |
n |
number of observations. |
parameters |
A vector of length 3, giving the parameters of the
quantile-based skew logistic distribution. The 3 elements are
|
inverse.eps |
Accuracy of calculation for the numerical determination
of |
max.iterations |
Maximum number of iterations in the numerical
determination of |
The quantile-based skew logistic distribution is a generalisation of the logistic distribution, defined by its quantile funtion, Q(u), the inverse of the distribution function.
for and
.
The distribution was first used by Gilchrist (2000) in the book Statistical Modelling with Quantile Functions. Full details of the properties of the distributions, including moments, L-moments and estimation via L-Moments are given in van Staden and King (2015).
The distribution is defined by its quantile function and its distribution and
density functions do not exist in closed form (except for some special cases).
Accordingly, the results from psl
and dsl
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,
dqsl
, computes this.
The distribution has closed form method of L-Moment estimates
(see fit.sld.lmom
for details). The 4th L-Moment ratio of the
the distribution is constant for
all values of
.
The 3rd L-Moment ratio of the distribution is restricted to
, being
the the 3rd L-moment ratio values of the reflected exponential and
the exponential distributions respectively.
dsl
gives the density (based on the quantile density and a
numerical solution to ),
dqsl
gives the density quantile,
psl
gives the distribution function (based on a numerical
solution to Q(u)=x and dqsl
qsl
gives the quantile function, and
rsl
generates random deviates.
Robert King, [email protected], https://github.com/newystats/
Gilchrist, W.G. (2000) Statistical Modelling with Quantile Functions Chapman & Hall, print 978-1-58488-174-2, e-book 978-1-4200-3591-9.
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. http://hdl.handle.net/2263/40265
https://github.com/newystats/sld
qsl(seq(0,1,0.02),c(0,1,0.123)) psl(seq(-2,2,0.2),c(0,1,.1),inverse.eps=1e-10) rsl(21,c(3,2,0.3))
qsl(seq(0,1,0.02),c(0,1,0.123)) psl(seq(-2,2,0.2),c(0,1,.1),inverse.eps=1e-10) rsl(21,c(3,2,0.3))