Description Usage Arguments Details Value Author(s) Source References See Also Examples
Fit of univariate distributions for non-censored data using minimum quantile distance estimation (mqde), which can also be called maximum quantile goodness-of-fit estimation.
1 2 3 4 5 |
data |
A numeric vector with the observed values for non-censored data. |
distr |
A character string |
probs |
A numeric vector of the probabilities for which the minimum quantile distance estimation is done. p[k] = (k - 0.5) / n (default). |
qtype |
The quantile type used by the R |
dist |
The distance measure between observed and theoretical quantiles to be used. This must be one of "euclidean" (default), "maximum", or "manhattan". Any unambiguous substring can be given. |
start |
A named list giving the initial values of parameters of the
named distribution or a function of data computing initial values and
returning a named list. This argument may be omitted (default) for some
distributions for which reasonable starting values are computed (see the
'details' section of |
fix.arg |
An optional named list giving the values of fixed parameters of the named distribution or a function of data computing (fixed) parameter values and returning a named list. Parameters with fixed value are thus NOT estimated. |
optim.method |
|
lower |
Left bounds on the parameters for the |
upper |
Right bounds on the parameters for the |
custom.optim |
A function carrying the optimization (see details). |
weights |
An optional vector of weights to be used in the fitting
process. Should be |
silent |
A logical to remove or show warnings when bootstraping. |
gradient |
A function to return the gradient of the optimization
objective function for the |
... |
Further arguments passed to the |
The mqdedist
function carries out the minimum quantile
distance estimation numerically, by minimization of a distance between
observed and theoretical quantiles.
The optimization process is the same as
mledist
, see the 'details' section of that
function.
Optionally, a vector of weights
can be used in the fitting process.
By default (when weigths=NULL
), ordinary mqde is carried out,
otherwise the specified weights are used to compute a weighted distance.
We believe this function should be added to the package
fitdistrplus
. Until it is accepted and incorporated into that
package, it will remain in the package BMT
. This function is
internally called in BMTfit.mqde
.
mqdedist
returns a list with following components,
estimate |
the parameter estimates. |
convergence |
an integer code for the convergence of
|
value |
the value of the optimization objective function at the solution found. |
hessian |
a symmetric matrix computed by |
probs |
the probability vector on which observed and theoretical quantiles were calculated. |
dist |
the name of the distance between observed and theoretical quantiles used. |
optim.function |
the name of the optimization function used. |
fix.arg |
the named list giving the values of parameters of the named
distribution that must kept fixed rather than estimated by maximum
likelihood or |
loglik |
the log-likelihood. |
optim.method |
when |
fix.arg.fun |
the function used to set the value of |
weights |
the vector of weigths used in the estimation process or
|
counts |
A two-element integer vector giving the number of calls to
the log-likelihood function and its gradient respectively. This excludes
those calls needed to compute the Hessian, if requested, and any calls to
log-likelihood function to compute a finite-difference approximation to the
gradient. |
optim.message |
A character string giving any additional information
returned by the optimizer, or |
Camilo Jose Torres-Jimenez [aut,cre] cjtorresj@unal.edu.co
Based on the function mledist of the R package: fitdistrplus
Delignette-Muller ML and Dutang C (2015), fitdistrplus: An R Package for Fitting Distributions. Journal of Statistical Software, 64(4), 1-34.
Functions checkparam
and start.arg.default
are needed and
were copied from the same package (fitdistrplus version: 1.0-9).
LaRiccia, V. N. (1982). Asymptotic Properties of Weighted $L^2$ Quantile Distance Estimators. The Annals of Statistics, 10(2), 621-624.
Torres-Jimenez, C. J. (2017, September), Comparison of estimation methods for the BMT distribution. ArXiv e-prints.
mpsedist
, mledist
,
mmedist
, qmedist
,
mgedist
, optim
,
constrOptim
, and quantile
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | # (1) basic fit of a normal distribution
set.seed(1234)
x1 <- rnorm(n = 100)
mean(x1); sd(x1)
mqde1 <- mqdedist(x1, "norm")
mqde1$estimate
# (2) defining your own distribution functions, here for the Gumbel
# distribution for other distributions, see the CRAN task view dedicated
# to probability distributions
dgumbel <- function(x, a, b) 1/b*exp((a-x)/b)*exp(-exp((a-x)/b))
pgumbel <- function(q, a, b) exp(-exp((a-q)/b))
qgumbel <- function(p, a, b) a-b*log(-log(p))
mqde1 <- mqdedist(x1, "gumbel", start = list(a = 10, b = 5))
mqde1$estimate
# (3) fit a discrete distribution (Poisson)
set.seed(1234)
x2 <- rpois(n = 30, lambda = 2)
mqde2 <- mqdedist(x2, "pois")
mqde2$estimate
# (4) fit a finite-support distribution (beta)
set.seed(1234)
x3 <- rbeta(n = 100, shape1 = 5, shape2 = 10)
mqde3 <- mqdedist(x3, "beta")
mqde3$estimate
# (5) fit frequency distributions on USArrests dataset.
x4 <- USArrests$Assault
mqde4pois <- mqdedist(x4, "pois")
mqde4pois$estimate
mqde4nbinom <- mqdedist(x4, "nbinom")
mqde4nbinom$estimate
# (6) weighted fit of a normal distribution
set.seed(1234)
w1 <- runif(100)
weighted.mean(x1, w1)
mqde1 <- mqdedist(x1, "norm", weights = w1)
mqde1$estimate
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.