| Title: | Fast Estimation of Subbottin and AEP Distributions (Generalized Error Distribution) |
|---|---|
| Description: | Create densities, probabilities, random numbers, quantiles, and maximum likelihood estimation for several distributions, mainly the symmetric and asymmetric power exponential (AEP), a.k.a. the Subbottin family of distributions, also known as the generalized error distribution. Estimation is made using the design of Bottazzi (2004) <https://ideas.repec.org/p/ssa/lemwps/2004-14.html>, where the likelihood is maximized by several optimization procedures using the 'GNU Scientific Library (GSL)', translated to 'C++' code, which makes it both fast and accurate. The package also provides methods for the gamma, Laplace, and Asymmetric Laplace distributions. |
| Authors: | Elias Haddad [aut, cre] (ORCID: <https://orcid.org/0000-0003-1863-1022>), Giulio Bottazzi [aut] (ORCID: <https://orcid.org/0000-0003-2565-4732>), Fernando J. Von Zuben [aut, ths] (ORCID: <https://orcid.org/0000-0002-4128-5415>), Jochen Voss [ctb], J.D. Lamb [ctb], Brian Gough [ctb] |
| Maintainer: | Elias Haddad <[email protected]> |
| License: | GPL-3 |
| Version: | 0.0.1 |
| Built: | 2026-05-27 08:13:30 UTC |
| Source: | https://github.com/cran/Rsubbotools |
alaplafit returns the parameters, standard errors. negative
log-likelihood and covariance matrix of the Asymmetric Laplace Distribution
for a sample. See details below.
alaplafit(data, verb = 0L, interv_step = 10L, provided_m_ = NULL)alaplafit(data, verb = 0L, interv_step = 10L, provided_m_ = NULL)
data |
(NumericVector) - the sample used to fit the distribution. |
verb |
(int) - the level of verbosity. Select one of:
|
interv_step |
int - the number of intervals to be explored after the last minimum was found in the interval optimization. Default is 10. |
provided_m_ |
NumericVector - if NULL, the m parameter is estimated by the routine. If numeric, the estimation fixes m to the given value. |
The Asymmetric Laplace distribution is a distribution controlled by three parameters, with formula:
with:
where are scale parameters, and is a location parameter.
It is basically derived from the Asymmetric Exponential Power distribution
by setting .
The estimations are produced by maximum likelihood, where
analytical formulas are available for the parameters.
The parameter is found by an iterative method, using the median as
the initial guess. The method explore intervals around the last minimum
found, similar to the subboafit routine.
Details on the method can be found on the package vignette.
a list containing the following items:
"dt" - dataset containing parameters estimations and standard deviations.
"log-likelihood" - negative log-likelihood value.
"matrix" - the covariance matrix for the parameters.
sample_subbo <- rpower(1000, 1, 1) alaplafit(sample_subbo)sample_subbo <- rpower(1000, 1, 1) alaplafit(sample_subbo)
The dalaplace returns the density at point x for the
Asymmetric Laplace distribution with parameters and .
dalaplace(x, m = 0, al = 1, ar = 1)dalaplace(x, m = 0, al = 1, ar = 1)
x |
(numeric) - value in the range |
m |
(numeric) - location parameter. |
al, ar
|
(numeric) - scale parameters. Must be in the range
|
The Asymmetric Laplace distribution is a distribution controlled by three parameters, with formula:
with:
where are scale parameters, and is a location parameter.
It is basically derived from the Asymmetric Exponential Power distribution
by setting .
a vector containing the values for the densities.
The dasubbo returns the density at point x for the
AEP distribution with parameters , , . Notice
that the function can generate RNGs for both the subboafit and
subbolafit routines.
dasubbo(x, m = 0, al = 1, ar = 1, bl = 2, br = 2)dasubbo(x, m = 0, al = 1, ar = 1, bl = 2, br = 2)
x |
(numeric) - value in the range |
m |
(numeric) - location parameter. |
al, ar
|
(numeric) - scale parameters. Must be in the range
|
bl, br
|
(numeric) - shape parameters. Must be in the range
|
The AEP is a exponential power distribution controlled by five parameters, with formula:
with:
where and represent left and right tails, are
scale parameters, control the tails (lower values represent
fatter tails), and is a location parameter.
a vector containing the values for the densities.
The dlaplace returns the density at point x for the
Laplace distribution with parameters and .
dlaplace(x, m = 0, a = 1)dlaplace(x, m = 0, a = 1)
x |
(numeric) - value in the range |
m |
(numeric) - location parameter. |
a |
(numeric) - scale parameter. Must be in the range |
The Laplace distribution is a distribution controlled by two parameters, with formula:
where is a scale parameter, and is a location parameter.
a vector containing the values for the densities.
The dpower returns the density at point x for the
Exponential Power distribution with parameters , and .
dpower(x, m = 0, a = 1, b = 2)dpower(x, m = 0, a = 1, b = 2)
x |
(numeric) - value in the range |
m |
(numeric) - location parameter. Must be in the range
|
a |
(numeric) - scale parameter. Must be in the range |
b |
(numeric) - shape parameter. Must be in the range |
The Exponential Power distribution (EP) is given by the function:
.
where is a shape parameter, is a scale parameter,
is a location parameter and represents the gamma function.
a vector containing the values for the densities.
The dsep returns the density at point x for the
Gamma distribution with parameters , .
dsep(x, m = 0, a = 1, b = 1, lambda = 1)dsep(x, m = 0, a = 1, b = 1, lambda = 1)
x |
(numeric) - value in the range |
m |
(numeric) - location parameter. Must be in the range
|
a |
(numeric) - scale parameter. Must be in the range |
b |
(numeric) - shape parameter. Must be in the range |
lambda |
(numeric) - skewness parameter. Must be in the range |
The SEP is a exponential power distribution controlled by four parameters, with formula:
where:
with the cumulative normal distribution with mean zero and variance
one.
a vector containing the values for the densities.
The dsubbo returns the density at point x for the
Subbotin distribution with parameters , , .
dsubbo(x, m = 0, a = 1, b = 2)dsubbo(x, m = 0, a = 1, b = 2)
x |
(numeric) - value in the range |
m |
(numeric) - location parameter. |
a |
(numeric) - scale parameter. Must be in the range |
b |
(numeric) - shape parameter. Must be in the range |
The Subbotin distribution is a exponential power distribution controlled by three parameters, with formula:
with:
where is a scale parameter, controls the tails (lower values
represent fatter tails), and is a location parameter.
a vector containing the values for the densities.
laplafit returns the parameters, standard errors. negative
log-likelihood and covariance matrix of the Laplace Distribution for a
sample. See details below.
laplafit(data, verb = 0L, interv_step = 10L, provided_m_ = NULL)laplafit(data, verb = 0L, interv_step = 10L, provided_m_ = NULL)
data |
(NumericVector) - the sample used to fit the distribution. |
verb |
(int) - the level of verbosity. Select one of:
|
interv_step |
int - the number of intervals to be explored after the last minimum was found in the interval optimization. Default is 10. |
provided_m_ |
NumericVector - if NULL, the m parameter is estimated by the routine. If numeric, the estimation fixes m to the given value. |
The Laplace distribution is a distribution controlled by two parameters, with formula:
where is a scale parameter, and is a location parameter.
The estimations are produced by maximum likelihood, where analytical
formulas are available. Details on the method can be found on
the package vignette.
a list containing the following items:
"dt" - dataset containing parameters estimations and standard deviations.
"log-likelihood" - negative log-likelihood value.
"matrix" - the covariance matrix for the parameters.
sample_subbo <- rpower(1000, 1, 1) laplafit(sample_subbo)sample_subbo <- rpower(1000, 1, 1) laplafit(sample_subbo)
The palaplace returns the Cumulative Distribution Function at point x
for the Asymmetric Laplace distribution with parameters and .
palaplace(x, m = 0, al = 1, ar = 1)palaplace(x, m = 0, al = 1, ar = 1)
x |
(numeric) - value in the range |
m |
(numeric) - location parameter. |
al, ar
|
(numeric) - scale parameters. Must be in the range
|
The Asymmetric Laplace distribution is a distribution controlled by three parameters, with formula:
with:
where are scale parameters, and is a location parameter.
It is basically derived from the Asymmetric Exponential Power distribution
by setting .
a vector containing the values for the probabilities.
The pasubbo returns the Cumulative Distribution Function at point x
for the AEP distribution with parameters , , .
pasubbo(x, m = 0, al = 1, ar = 1, bl = 2, br = 2)pasubbo(x, m = 0, al = 1, ar = 1, bl = 2, br = 2)
x |
(numeric) - value in the range |
m |
(numeric) - location parameter. |
al, ar
|
(numeric) - scale parameters. Must be in the range
|
bl, br
|
(numeric) - shape parameters. Must be in the range
|
The AEP is a exponential power distribution controlled by five parameters, with formula:
with:
where and represent left and right tails, are
scale parameters, control the tails (lower values represent
fatter tails), and is a location parameter.
a vector containing the values for the probabilities.
The plaplace returns the Cumulative Distribution Function at point x
for the Laplace distribution with parameters and .
plaplace(x, m = 0, a = 1)plaplace(x, m = 0, a = 1)
x |
(numeric) - value in the range |
m |
(numeric) - location parameter. |
a |
(numeric) - scale parameter. Must be in the range |
The Laplace distribution is a distribution controlled by two parameters, with formula:
where is a scale parameter, and is a location parameter.
a vector containing the values for the probabilities.
The ppower returns the Cumulative Distribution Function at point x for
the Exponential Power distribution with parameters , and .
ppower(x, m = 0, a = 1, b = 2)ppower(x, m = 0, a = 1, b = 2)
x |
(numeric) - value in the range |
m |
(numeric) - location parameter. Must be in the range |
a |
(numeric) - scale parameter. Must be in the range |
b |
(numeric) - shape parameter. Must be in the range |
The Exponential Power distribution (EP) is given by the function:
.
where is a shape parameter, is a scale parameter,
is a location parameter and represents the gamma function.
a vector containing the values for the probabilities.
The psep returns the Cumulative Distribution Function at point x for
the Skewed Exponential Power distribution with parameters , .
psep(x, m = 0, a = 2, b = 1, lambda = 0)psep(x, m = 0, a = 2, b = 1, lambda = 0)
x |
|
m |
|
a |
|
b |
|
lambda |
|
The SEP is a exponential power distribution controlled by four parameters, with formula:
where:
with the cumulative normal distribution with mean zero and variance
one. The CDF is calculated through numerical integration using the 'GSL' suite.
a vector containing the values for the probabilities.
The psubbo returns the Cumulative Distribution Function (CDF) from the
the Subbotin evaluated at and return , such that
.
psubbo(x, m = 0, a = 1, b = 2)psubbo(x, m = 0, a = 1, b = 2)
x |
(numeric) - value in the range |
m |
(numeric) - location parameter. |
a |
(numeric) - scale parameter. Must be in the range |
b |
(numeric) - shape parameter. Must be in the range |
The Subbotin cumulative distribution function is given by:
where is the normalized incomplete gamma function:
and is a scale parameter, controls the tails (lower values
represent fatter tails), and is a location parameter.
a vector containing the values for the probabilities.
The qalaplace returns the density at point x for the
Asymmetric Laplace distribution with parameters and .
qalaplace(x, m = 0, al = 1, ar = 1)qalaplace(x, m = 0, al = 1, ar = 1)
x |
(numeric) - value in the range |
m |
(numeric) - location parameter. |
al, ar
|
(numeric) - scale parameters. Must be in the range
|
The Asymmetric Laplace distribution is a distribution controlled by three parameters, with formula:
with:
where are scale parameters, and is a location parameter.
It is basically derived from the Asymmetric Exponential Power distribution
by setting .
a vector containing the values for the densities.
The qasubbo returns the density at point x for the
AEP distribution with parameters , , .
qasubbo(x, m = 0, al = 1, ar = 1, bl = 2, br = 2)qasubbo(x, m = 0, al = 1, ar = 1, bl = 2, br = 2)
x |
(numeric) - value in the range |
m |
(numeric) - location parameter. |
al, ar
|
(numeric) - scale parameters. Must be in the range
|
bl, br
|
(numeric) - shape parameters. Must be in the range
|
The AEP is a exponential power distribution controlled by five parameters, with formula:
with:
where and represent left and right tails, are
scale parameters, control the tails (lower values represent
fatter tails), and is a location parameter.
a vector containing the values for the densities.
The qlaplace returns the density at point x for the
Laplace distribution with parameters and .
qlaplace(x, m = 0, a = 1)qlaplace(x, m = 0, a = 1)
x |
(numeric) - value in the range |
m |
(numeric) - location parameter. |
a |
(numeric) - scale parameter. Must be in the range |
The Laplace distribution is a distribution controlled by two parameters, with formula:
where is a scale parameter, and is a location parameter.
a vector containing the values for the densities.
The qpower returns the density at point x for the
Exponential Power distribution with parameters , and .
qpower(x, m = 0, a = 1, b = 2)qpower(x, m = 0, a = 1, b = 2)
x |
(numeric) - value in the range |
m |
(numeric) - location parameter. Must be in the range |
a |
(numeric) - scale parameter. Must be in the range |
b |
(numeric) - shape parameter. Must be in the range |
The Exponential Power distribution (EP) is given by the function:
.
where is a shape parameter, is a scale parameter,
is a location parameter and represents the gamma function.
a vector containing the values for the densities.
The qsep returns the Cumulative Distribution Function at point x for
the Skewed Exponential Power distribution with parameters , .
qsep( x, m = 0, a = 2, b = 1, lambda = 0, method = 0L, step_size = 1e-04, tol = 1e-10, max_iter = 100L, verb = 0L )qsep( x, m = 0, a = 2, b = 1, lambda = 0, method = 0L, step_size = 1e-04, tol = 1e-10, max_iter = 100L, verb = 0L )
x |
(numeric) - vector with values to evaluate CDF. |
m |
(numeric) - the location parameter. |
a |
(numeric) - the scale parameter. |
b |
(numeric) - the shape parameter |
lambda |
(numeric) - the skewness parameter. |
method |
(numeric) - If 0, uses the Newton-Raphson procedure for optimization. If 1, uses Steffensen. |
step_size |
(numeric) - the size of the step in the numerical optimization (gradient descent). Default is 1e-4. |
tol |
(numeric) - error tolerance (default is 1e-10). |
max_iter |
(numeric) - maximum number of iterations for the optimization procedure (default is 100). |
verb |
(numeric) - verbosity level of the process (default 0). |
The SEP is a exponential power distribution controlled by four parameters, with formula:
where:
with the cumulative normal distribution with mean zero and variance
one. The CDF is calculated through numerical integration using the GSL suite
and the quantile is solved by inversion using a root-finding algorithm
(Newton-Raphson by default).
a vector containing the values for the densities.
The qsubbo returns the Cumulative Distribution Function (CDF) from the
the Subbotin evaluated at and return , such that
.
qsubbo(x, m = 0, a = 1, b = 2)qsubbo(x, m = 0, a = 1, b = 2)
x |
(numeric) - value in the range |
m |
(numeric) - location parameter. |
a |
(numeric) - scale parameter. Must be in the range |
b |
(numeric) - shape parameter. Must be in the range |
The Subbotin cumulative distribution function is given by:
where is the normalized incomplete gamma function:
and is a scale parameter, controls the tails (lower values
represent fatter tails), and is a location parameter.
a vector containing the values for the densities.
Returns a sample from an Asymmetric Laplace distribution.
ralaplace(n, m = 0, al = 1, ar = 1)ralaplace(n, m = 0, al = 1, ar = 1)
n |
(int) - the size of the sample. |
m |
(numeric) - the location parameter. |
al, ar
|
(numeric) - left and right scale parameters, respectively. |
The Asymmetric Laplace distribution is given by the two-sided exponential distribution given by the function:
with:
The random sampling is done by inverse transform sampling.
a numeric vector containing a random sample.
sample_gamma <- ralaplace(1000)sample_gamma <- ralaplace(1000)
Generate pseudo random-number from an asymmetric power exponential distribution
using the Tadikamalla method.
This version improves on Bottazzi (2004) by making the mass of each
distribution to depend on the ratio between the and the
parameters.
rasubbo(n, m = 0, al = 1, ar = 1, bl = 2, br = 2)rasubbo(n, m = 0, al = 1, ar = 1, bl = 2, br = 2)
n |
(int) - size of the sample. |
m |
(numeric) - location parameter. |
al, ar
|
(numeric) - scale parameters. |
bl, br
|
(numeric) - shape parameters. |
The AEP distribution is expressed by the function:
with:
where is a location parameter, are shape parameters,
are scale parameters and represents the gamma function.
By a suitably transformation, it is possible to use the EP distribution with
the Tadikamalla method to sample from this distribution. We basically take
the absolute values of the numbers sampled from the rpower function,
which is equivalent from sampling from a half Exponential Power distribution.
These values are then weighted by a constant expressed in the parameters.
More details are available on the package vignette and on the
function rpower.
a numeric vector containing a random sample.
sample_gamma <- rasubbo(1000, 0, 0.5, 0.5, 1, 1)sample_gamma <- rasubbo(1000, 0, 0.5, 0.5, 1, 1)
Generate pseudo random-number from an asymmetric power exponential distribution using the Tadikamalla method. This codes is the original version of Bottazzi (2004)
rasubbo_orig(n, m = 0, al = 1, ar = 1, bl = 2, br = 2)rasubbo_orig(n, m = 0, al = 1, ar = 1, bl = 2, br = 2)
n |
(int) - size of the sample. |
m |
(numeric) - location parameter. |
al, ar
|
(numeric) - scale parameters. |
bl, br
|
(numeric) - shape parameters. |
The AEP distribution is expressed by the function:
with:
where is a location parameter, are shape parameters,
are scale parameters and represents the gamma function.
By a suitably transformation, it is possible to use the EP distribution with
the Tadikamalla method to sample from this distribution. We basically take
the absolute values of the numbers sampled from the rpower function,
which is equivalent from sampling from a half Exponential Power distribution.
These values are then weighted by a constant expressed in the parameters.
More details are available on the package vignette and on the
function rpower.
a numeric vector containing a random sample.
sample_gamma <- rasubbo(1000, 0, 0.5, 0.5, 1, 1)sample_gamma <- rasubbo(1000, 0, 0.5, 0.5, 1, 1)
Returns a sample from a gamma-distributed random variable. The function uses the Marsaglia-Tsang fast gamma method used to generate the random samples. See more details below. The name was chosen so it doesn't clash with R's native method.
rgamma_c(n, b = 2, a = 1/2)rgamma_c(n, b = 2, a = 1/2)
n |
(int) |
b |
(numeric) - shape parameter. Must be in the range |
a |
(numeric) - scale parameter. Must be in the range |
The gamma distribution is given by the function:
where is a shape parameter and is a scale parameter.
The RNG is given by Marsaglia and Tsang, "A Simple Method for
generating gamma variables", ACM Transactions on Mathematical
Software, Vol 26, No 3 (2000), p363-372.
Available at doi:10.1145/358407.358414.
The code is based on the original 'GSL' version, adapted to
use 'R' version of RNGs. All credits to the original authors.
Implemented by [email protected], minor modifications for 'GSL'
by Brian Gough. Adapted to 'R' by Elias Haddad.
a numeric vector containing a random sample with above parameters.
sample_gamma <- rgamma_c(1000, 1, 1)sample_gamma <- rgamma_c(1000, 1, 1)
Returns a sample from a Laplace-distributed random variable.
rlaplace(n, m = 0, a = 1)rlaplace(n, m = 0, a = 1)
n |
(int) - the size of the sample. |
m |
(numeric) - the location parameter. |
a |
(numeric) - the scale parameter. |
The Laplace distribution is given by the two-sided exponential distribution given by the function:
The random sampling is done by inverse transform sampling.
a numeric vector containing a random sample with above parameters.
sample_gamma <- rlaplace(1000, 0, 1)sample_gamma <- rlaplace(1000, 0, 1)
Returns a sample from a gamma-distributed random variable.
rpower(n, m = 0, a = 1, b = 2)rpower(n, m = 0, a = 1, b = 2)
n |
(int) - size of the sample. |
m |
(numeric) - the location parameter. |
a |
(numeric) - scale parameter. |
b |
(numeric) - shape parameter. |
The exponential power distribution (EP) is given by the function:
.
where is a shape parameter, is a scale parameter and
represents the gamma function. While not done here, the distribution can
be adapted to have non-zero location parameter.
The Exponential Power distribution is related to the gamma distribution by
the equation:
where E and G are respectively EP and gamma random variables. This property
is used for cases where and . For
rejection methods based on the Laplace and normal distributions are used,
which should be faster.
Technical details about this algorithm are available on:
P. R. Tadikamalla, "Random Sampling from the Exponential Power
Distribution", Journal of the American Statistical Association,
September 1980, Volume 75, Number 371, pages 683-686.
The code is based on the original 'GSL' version, adapted to
use 'R' version of RNGs by Elias Haddad. All credits to the original authors.
a numeric vector containing a random sample with above parameters.
sample_gamma <- rpower(1000)sample_gamma <- rpower(1000)
Generate pseudo random-number from a Subbotin distribution using the Tadikamalla method.
rsubbo(n, m = 0, a = 1, b = 2)rsubbo(n, m = 0, a = 1, b = 2)
n |
(int) - the size of the sample. |
m |
(numeric) - the location parameter. |
a |
(numeric) - the scale parameter. |
b |
(numeric) - the shape parameter. |
The Subbotin distribution is given by the function:
where is a location parameter, is a shape parameter,
is a scale parameter and represents the gamma function.
Since the Subbotin distribution is basically the exponential distribution
with scale parameter and , we use the same
method of the exponential power RNG and add the location parameter.
Details can be found on the documentation of the rpower function.
a numeric vector containing a random sample.
sample_gamma <- rsubbo(1000, 1, 1)sample_gamma <- rsubbo(1000, 1, 1)
sepfit returns the parameters, standard errors. negative
log-likelihood and covariance matrix of the skewed power exponential
for a sample. The process performs a global minimization over the negative
log-likelihood function. See details below.
sepfit( data, verb = 0L, par = as.numeric(c(0, 1, 2, 0)), g_opt_par = as.numeric(c(0.1, 0.01, 100, 0.001, 1e-05, 2)) )sepfit( data, verb = 0L, par = as.numeric(c(0, 1, 2, 0)), g_opt_par = as.numeric(c(0.1, 0.01, 100, 0.001, 1e-05, 2)) )
data |
(NumericVector) - the sample used to fit the distribution. |
verb |
(int) - the level of verbosity. Select one of:
|
par |
NumericVector - vector containing the initial guess for parameters m (location), a (scale), b (shape), lambda (skewness), respectively. Default values of are c(0, 1, 2, 0), i.e. a normal distribution. |
g_opt_par |
NumericVector - vector containing the global optimization parameters. The optimization parameters are:
Details for each algorithm are available on the 'GSL' Manual. Default values are c(.1, 1e-2, 100, 1e-3, 1e-5, 2). |
The SEP is a exponential power distribution controlled by four parameters, with formula:
where:
with the cumulative normal distribution with mean zero and
variance one.
Details on the method are available on the package vignette.
a list containing the following items:
"dt" - dataset containing parameters estimations and standard deviations.
"log-likelihood" - negative log-likelihood value.
"matrix" - the covariance matrix for the parameters.
sample_subbo <- rpower(1000, 1, 2) sepfit(sample_subbo)sample_subbo <- rpower(1000, 1, 2) sepfit(sample_subbo)
Returns the Fisher Information matrix and its inverse for the Asymmetric Power Exponential distribution for the given parameters.
subboafish(size = 1L, bl = 2, br = 2, m = 0, al = 1, ar = 1, O_munknown = 0L)subboafish(size = 1L, bl = 2, br = 2, m = 0, al = 1, ar = 1, O_munknown = 0L)
size |
(numeric) - number of observations (Default: 01) |
bl |
(numeric) - set the left exponent (Default: 2.0) |
br |
(numeric) - set the right exponent (Default: 2.0) |
m |
(numeric) - the location parameter (Default: 0.0) |
al |
(numeric) - the left scale parameter (Default: 1.0) |
ar |
(numeric) - the right scale parameter (Default: 1.0) |
O_munknown |
(numeric) - if true assumes |
a list containing three elements:
std_error - the standard error for the parameters
infmatrix - the Fisher Information Matrix
inv_infmatrix - the Inverse Fisher Information Matrix
subboafit returns the parameters, standard errors. negative
log-likelihood and covariance matrix of the asymmetric power exponential for
a sample. The process can execute two steps, depending on the level of
accuracy required. See details below.
subboafit( data, verb = 0L, method = 2L, interv_step = 10L, provided_m_ = NULL, par = as.numeric(c(2, 2, 1, 1, 0)), g_opt_par = as.numeric(c(0.1, 0.01, 100, 0.001, 1e-05, 2)), itv_opt_par = as.numeric(c(0.01, 0.001, 200, 0.001, 1e-05, 5)) )subboafit( data, verb = 0L, method = 2L, interv_step = 10L, provided_m_ = NULL, par = as.numeric(c(2, 2, 1, 1, 0)), g_opt_par = as.numeric(c(0.1, 0.01, 100, 0.001, 1e-05, 2)), itv_opt_par = as.numeric(c(0.01, 0.001, 200, 0.001, 1e-05, 5)) )
data |
(NumericVector) - the sample used to fit the distribution. |
verb |
(int) - the level of verbosity. Select one of:
|
method |
int - the steps that should be used to estimate the parameters.
|
interv_step |
int - the number of intervals to be explored after the last minimum was found in the interval optimization. Default is 10. |
provided_m_ |
NumericVector - if NULL (default), the m parameter is estimated by the routine. If numeric, the estimation fixes m to the given value. |
par |
NumericVector - vector containing the initial guess for parameters bl, br, al, ar and m, respectively. Default values are c(2, 2, 1, 1, 0). |
g_opt_par |
NumericVector - vector containing the global optimization parameters. The optimization parameters are:
Details for each algorithm are available on the 'GSL' Manual. Default values are c(.1, 1e-2, 100, 1e-3, 1e-5, 2). |
itv_opt_par |
NumericVector - interval optimization parameters. Fields are the same as the ones for the global optimization. Default values are c(.01, 1e-3, 200, 1e-3, 1e-5, 5). |
The AEP is a exponential power distribution controlled by five parameters, with formula:
with:
where and represent left and right tails, are
scale parameters, control the tails (lower values represent
fatter tails), and is a location parameter. Due to its lack of
symmetry, and differently from the Subbotin, there is no simple equations
available to use the method of moments, so we start directly by minimizing
the negative log-likelihood. This global optimization is executed without
restricting any parameters. If required (default), after the global
optimization is finished, the method proceeds to iterate over the intervals
between several two observations, iterating the same algorithm of the
global optimization. The last method happens because of the lack of
smoothness on the parameter, and intervals must be used since the
likelihood function doesn't have a derivative whenever equals a
sample observation. Due to the cost, these iterations are capped at most
interv_step (default 10) from the last minimum observed.
Details on the method are available on the package vignette.
a list containing the following items:
"dt" - dataset containing parameters estimations and standard deviations.
"log-likelihood" - negative log-likelihood value.
"matrix" - the covariance matrix for the parameters.
sample_subbo <- rpower(1000, 1, 2) subboafit(sample_subbo)sample_subbo <- rpower(1000, 1, 2) subboafit(sample_subbo)
Calculate the standard errors, the correlation, the Fisher Information matrix and its inverse for a power exponential density with given parameters
subbofish(size = 1L, b = 2, m = 0, a = 1, O_munknown = 0L)subbofish(size = 1L, b = 2, m = 0, a = 1, O_munknown = 0L)
size |
numeric - number of observations (Default: 01) |
b |
numeric - the exponent b (Default: 2.0) |
m |
numeric - the location parameter (Default: 0.0) |
a |
numeric - the scale parameter (Default: 1.0) |
O_munknown |
numeric - if true assumes m known |
a list containing four elements:
std_error - the standard error for the parameters
cor_ab - the correlation between parameters a and b
infmatrix - the Fisher Information Matrix
inv_infmatrix - the Inverse Fisher Information Matrix
subbofit returns the parameters, standard errors. negative
log-likelihood and covariance matrix of the Subbotin Distribution for a
sample. The process can execute three steps, depending on the level of
accuracy required. See details below.
subbofit( data, verb = 0L, method = 3L, interv_step = 10L, provided_m_ = NULL, par = as.numeric(c(2, 1, 0)), g_opt_par = as.numeric(c(0.1, 0.01, 100, 0.001, 1e-05, 3)), itv_opt_par = as.numeric(c(0.01, 0.001, 200, 0.001, 1e-05, 5)) )subbofit( data, verb = 0L, method = 3L, interv_step = 10L, provided_m_ = NULL, par = as.numeric(c(2, 1, 0)), g_opt_par = as.numeric(c(0.1, 0.01, 100, 0.001, 1e-05, 3)), itv_opt_par = as.numeric(c(0.01, 0.001, 200, 0.001, 1e-05, 5)) )
data |
(NumericVector) - the sample used to fit the distribution. |
verb |
(int) - the level of verbosity. Select one of:
|
method |
int - the steps that should be used to estimate the parameters.
|
interv_step |
int - the number of intervals to be explored after the last minimum was found in the interval optimization. Default is 10. |
provided_m_ |
NumericVector - if NULL (default), the m parameter is estimated by the routine. If numeric, the estimation fixes m to the given value. |
par |
NumericVector - vector containing the initial guess for parameters b, a and m, respectively. Default values are c(2, 1, 0). |
g_opt_par |
NumericVector - vector containing the global optimization parameters. The optimization parameters are:
Details for each algorithm are available on the 'GSL' Manual. Default values are c(.1, 1e-2, 100, 1e-3, 1e-5, 3,0). |
itv_opt_par |
NumericVector - interval optimization parameters. Fields are the same as the ones for the global optimization. Default values are c(.01, 1e-3, 200, 1e-3, 1e-5, 5, 0). |
The Subbotin distribution is a exponential power distribution controlled by three parameters, with formula:
with:
where is a scale parameter, controls the tails (lower values
represent fatter tails), and is a location parameter. Due to its
symmetry, the equations are simple enough to be estimated by the method of
moments, which produce rough estimations that should be used only for first
explorations. The maximum likelihood global estimation improves on this
initial guess by using a optimization routine, defaulting to the
Broyden-Fletcher-Goldfarb-Shanno method. However, due to the lack of
smoothness of this function on the parameter (derivatives are zero
whenever equals a sample observation), an exhaustive search must be
done by redoing the previous step in all intervals between two observations.
For a sample of observations, this would lead to
optimization problems. Given the computational cost of such procedure,
an interval search is used, where the optimization is repeated in the
intervals at most the value of the interv_step from the last
minimum found. Details on the method are available on the package vignette.
a list containing the following items:
"dt" - dataset containing parameters estimations and standard deviations.
"log-likelihood" - negative log-likelihood value.
"matrix" - the covariance matrix for the parameters.
sample_subbo <- rpower(1000, 1, 2) subbofit(sample_subbo)sample_subbo <- rpower(1000, 1, 2) subbofit(sample_subbo)
subbolafit returns the parameters, standard errors. negative
log-likelihood and covariance matrix of the (less) asymmetric power exponential
for a sample. The main difference from subboafit is that
. The process can execute two steps, depending on the
level of accuracy required. See details below.
subbolafit( data, verb = 0L, method = 2L, interv_step = 10L, provided_m_ = NULL, par = as.numeric(c(2, 2, 1, 0)), g_opt_par = as.numeric(c(0.1, 0.01, 100, 0.001, 1e-05, 2)), itv_opt_par = as.numeric(c(0.01, 0.001, 200, 0.001, 1e-05, 2)) )subbolafit( data, verb = 0L, method = 2L, interv_step = 10L, provided_m_ = NULL, par = as.numeric(c(2, 2, 1, 0)), g_opt_par = as.numeric(c(0.1, 0.01, 100, 0.001, 1e-05, 2)), itv_opt_par = as.numeric(c(0.01, 0.001, 200, 0.001, 1e-05, 2)) )
data |
(NumericVector) - the sample used to fit the distribution. |
verb |
(int) - the level of verbosity. Select one of:
|
method |
int - the steps that should be used to estimate the parameters.
|
interv_step |
int - the number of intervals to be explored after the last minimum was found in the interval optimization. Default is 10. |
provided_m_ |
NumericVector - if NULL (default), the m parameter is estimated by the routine. If numeric, the estimation fixes m to the given value. |
par |
NumericVector - vector containing the initial guess for parameters bl, br, a and m, respectively. Default values of are c(2, 2, 1, 0). |
g_opt_par |
NumericVector - vector containing the global optimization parameters. The optimization parameters are:
Details for each algorithm are available on the 'GSL' Manual. Default values are c(.1, 1e-2, 100, 1e-3, 1e-5, 2). |
itv_opt_par |
NumericVector - interval optimization parameters. Fields are the same as the ones for the global optimization. Default values are c(.01, 1e-3, 200, 1e-3, 1e-5, 2). |
The LAPE is a exponential power distribution controlled by four parameters, with formula:
with:
where and represent left and right tails, is a
scale parameter, control the tails (lower values represent
fatter tails), and is a location parameter. Due to its lack of
symmetry, and differently from the Subbotin, there is no simple equations
available to use the method of moments, so we start directly by minimizing
the negative log-likelihood. This global optimization is executed without
restricting any parameters. If required (default), after the global
optimization is finished, the method proceeds to iterate over the intervals
between several two observations, iterating the same algorithm of the
global optimization. The last method happens because of the lack of
smoothness on the parameter, and intervals must be used since the
likelihood function doesn't have a derivative whenever equals a
sample observation. Due to the cost, these iterations are capped at most
interv_step (default 10) from the last minimum observed.
Details on the method are available on the package vignette.
a list containing the following items:
"dt" - dataset containing parameters estimations and standard deviations.
"log-likelihood" - negative log-likelihood value.
sample_subbo <- rpower(1000, 1, 2) subbolafit(sample_subbo)sample_subbo <- rpower(1000, 1, 2) subbolafit(sample_subbo)