# BMTfit.mqde: Minimum Quantile Distance Fit of the BMT Distribution to... In BMT: The BMT Distribution

## Description

Fit of the BMT distribution to non-censored data by minimum quantile distance (mqde), which can also be called maximum quantile goodness-of-fit.

## Usage

 ```1 2 3 4 5``` ```BMTfit.mqde(data, probs = (1:length(data) - 0.5)/length(data), qtype = 5, dist = "euclidean", start = list(p3 = 0.5, p4 = 0.5, p1 = min(data) - 0.1, p2 = max(data) + 0.1), fix.arg = NULL, type.p.3.4 = "t w", type.p.1.2 = "c-d", optim.method = "Nelder-Mead", custom.optim = NULL, weights = NULL, silent = TRUE, ...) ```

## Arguments

 `data` A numeric vector with the observed values for non-censored data. `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 `quantile` function to compute the empirical quantiles. Type 5 (default), i.e. x[k] is both the kth order statistic and the type 5 sample quantile of p[k] = (k - 0.5) / n. `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 BMT distribution or a function of data computing initial values and returning a named list. (see the 'details' section of `mledist`). `fix.arg` An optional named list giving the values of fixed parameters of the BMT distribution or a function of data computing (fixed) parameter values and returning a named list. Parameters with fixed value are thus NOT estimated. (see the 'details' section of `mledist`). `type.p.3.4` Type of parametrization asociated to p3 and p4. "t w" means tails weights parametrization (default) and "a-s" means asymmetry-steepness parametrization. `type.p.1.2` Type of parametrization asociated to p1 and p2. "c-d" means domain parametrization (default) and "l-s" means location-scale parametrization. `optim.method` `"default"` (see the 'details' section of `mledist`) or optimization method to pass to `optim`. Given the close-form expression of the quantile function, two optimization methods were added when the euclidean distance is selected: Coordinate descend (`"CD"`) and Newton-Rhapson (`"NR"`). `custom.optim` A function carrying the optimization (see the 'details' section of `mledist`). `weights` an optional vector of weights to be used in the fitting process. Should be `NULL` or a numeric vector with strictly positive numbers. If non-`NULL`, weighted mqde is used, otherwise ordinary mqde. `silent` A logical to remove or show warnings when bootstraping. `...` Further arguments to be passed to generic functions or to the function `"mqdedist"`. See `mqdedist` for details.

## Details

This function is not intended to be called directly but is internally called in `BMTfit` when used with the minimum quantile distance method.

`BMTfit.mqde` is based on the function `mqdedist` but it focuses on the minimum quantile distance parameter estimation for the BMT distribution (see `BMT` for details about the BMT distribution and `mqdedist` for details about minimum quantile distance fit of univariate distributions).

Given the close-form expression of the quantile function, two optimization methods were added when the euclidean distance is selected: Coordinate descend (`"CD"`) and Newton-Rhapson (`"NR"`).

## Value

`BMTfit.mqde` returns a list with following components,

 `estimate` the parameter estimates. `convergence` an integer code for the convergence of `optim`/`constrOptim` defined as below or defined by the user in the user-supplied optimization function. `0` indicates successful convergence. `1` indicates that the iteration limit of `optim` has been reached. `10` indicates degeneracy of the Nealder-Mead simplex. `100` indicates that `optim` encountered an internal error. `value` the value of the corresponding objective function of the estimation method at the estimate. `hessian` a symmetric matrix computed by `optim` as an estimate of the Hessian at the solution found or computed in the user-supplied optimization function. `loglik` the log-likelihood value. `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 for maximum product of spacing. `optim.method` when `optim` is used, the name of the algorithm used, `NULL` otherwise. `fix.arg` the named list giving the values of parameters of the named distribution that must kept fixed rather than estimated or `NULL` if there are no such parameters. `fix.arg.fun` the function used to set the value of `fix.arg` or `NULL`. `weights` the vector of weigths used in the estimation process or `NULL`. `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. `counts` is returned by `optim` or the user-supplied function or set to `NULL`. `optim.message` A character string giving any additional information returned by the optimizer, or `NULL`. To understand exactly the message, see the source code.

## Author(s)

Camilo Jose Torres-Jimenez [aut,cre] cjtorresj@unal.edu.co

## Source

Based on the function `mqdedist` which in turn is 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.

## References

Torres-Jimenez, C. J. (2017, September), Comparison of estimation methods for the BMT distribution. ArXiv e-prints.

Torres-Jimenez, C. J. (2018), The BMT Item Response Theory model: A new skewed distribution family with bounded domain and an IRT model based on it, PhD thesis, Doctorado en ciencias - Estadistica, Universidad Nacional de Colombia, Sede Bogota.

See `BMT` for the BMT density, distribution, quantile function and random deviates. See `BMTfit.mme`, `BMTfit.mle`, `BMTfit.mge`, `BMTfit.mpse` and `BMTfit.qme` for other estimation methods. See `optim` and `constrOptim` for optimization routines. See `BMTfit` and `fitdist` for functions that return an objetc of class `"fitdist"`.
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24``` ```# (1) basic fit by minimum quantile distance estimation set.seed(1234) x1 <- rBMT(n=100, p3=0.25, p4=0.75) BMTfit.mqde(x1) # (2) quantile matching is a particular case of minimum quantile distance BMTfit.mqde(x1, probs=c(0.2,0.4,0.6,0.8), qtype=7) # (3) maximum or manhattan instead of euclidean distance BMTfit.mqde(x1, dist="maximum") BMTfit.mqde(x1, dist="manhattan") # (4) how to change the optimisation method? BMTfit.mqde(x1, optim.method="L-BFGS-B") BMTfit.mqde(x1, custom.optim="nlminb") # (5) estimation of the tails weights parameters of the BMT # distribution with domain fixed at [0,1] BMTfit.mqde(x1, start=list(p3=0.5, p4=0.5), fix.arg=list(p1=0, p2=1)) # (6) estimation of the asymmetry-steepness parameters of the BMT # distribution with domain fixed at [0,1] BMTfit.mqde(x1, start=list(p3=0, p4=0.5), type.p.3.4 = "a-s", fix.arg=list(p1=0, p2=1)) ```