Learn R Programming

mbbefd (version 0.8.12)

fitDR: Fit of destruction rate models

Description

Fit of univariate distributions to destruction rate data by maximum likelihood (mle), moment matching (mme), quantile matching (qme) or maximizing goodness-of-fit estimation (mge). The latter is also known as minimizing distance estimation. Generic methods are print, plot, summary, quantile, logLik, vcov and coef.

Usage

fitDR(x, dist, method="mle", start=NULL, optim.method="default", ...)

Value

fitDR returns an object of class "fitDR" inheriting from the "fitdist" class. That is a list with the following components:

estimate

the parameter estimates.

method

the character string coding for the fitting method : "mle" for 'maximum likelihood estimation', "tlmme" for 'matching total loss moment estimation'.

sd

the estimated standard errors, NA if numerically not computable or NULL if not available.

cor

the estimated correlation matrix, NA if numerically not computable or NULL if not available.

vcov

the estimated variance-covariance matrix, NULL if not available.

loglik

the log-likelihood.

aic

the Akaike information criterion.

bic

the the so-called BIC or SBC (Schwarz Bayesian criterion).

n

the length of the data set.

data

the data set.

distname

the name of the distribution.

fix.arg

the named list giving the values of parameters of the named distribution that must be kept fixed rather than estimated by maximum likelihood or NULL if there are no such parameters.

fix.arg.fun

the function used to set the value of fix.arg or NULL.

discrete

the input argument or the automatic definition by the function to be passed to functions gofstat, plotdist and cdfcomp.

dots

the list of further arguments passed in ... to be used in bootdist in iterative calls to mledist, mmedist, qmedist, mgedist or NULL if no such arguments.

weights

the vector of weigths used in the estimation process or NULL.

Generic functions:

print

The print of a "fitDR" object shows few traces about the fitting method and the fitted distribution.

summary

The summary provides the parameter estimates of the fitted distribution, the log-likelihood, AIC and BIC statistics and when the maximum likelihood is used, the standard errors of the parameter estimates and the correlation matrix between parameter estimates.

plot

The plot of an object of class "fitDR" returned by fitdist uses the function plotdist. An object of class "fitdist" or a list of objects of class "fitDR" corresponding to various fits using the same data set may also be plotted using a cdf plot (function cdfcomp), a density plot(function denscomp), a density Q-Q plot (function qqcomp), or a P-P plot (function ppcomp).

logLik

Extracts the estimated log-likelihood from the "fitDR" object.

vcov

Extracts the estimated var-covariance matrix from the "fitDR" object (only available when method = "mle").

coef

Extracts the fitted coefficients from the "fitDR" object.

Arguments

x

A numeric vector.

dist

A character string "name" naming a distribution among "oiunif", "oistpareto", "oibeta", "oigbeta", "mbbefd", "MBBEFD".

method

A character string coding for the fitting method: "mle" for 'maximum likelihood estimation', "tlmme" for 'total-loss-moment matching estimation'.

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 mledist).

optim.method

"default" or an optimization method to pass to optim.

...

Further arguments to be passed to "fitdist" when method != "tlmme". See fitdist for details on parameter estimation.

Author

Christophe Dutang.

Details

The fitted distribution (dist) has its d, p, q, r functions defined in the man page: oiunif, oistpareto, oibeta, oigbeta, mbbefd, MBBEFD.

The two possible fitting methods are described below:

When method="mle"

Maximum likelihood estimation consists in maximizing the log-likelihood. A numerical optimization is carried out in mledist via optim to find the best values (see mledist for details). For one-inflated distributions, the probability parameter is estimated by a closed-form formula and other parameters use a two-optimization procedures.

When method="tlmme"

Total loss and moment matching estimation consists in equalizing theoretical and empirical total loss as well as theoretical and empirical moments. The theoretical and the empirical moments are matched numerically, by minimization of the sum of squared differences between observed and theoretical quantities (see mmedist for details).

For one-inflated distributions, by default, direct optimization of the log-likelihood (or other criteria depending of the chosen method) is performed using optim, with the "L-BFGS-B" method for distributions characterized by more than one parameter and the "Brent" method for distributions characterized by only one parameter. Note that when errors are raised by optim, it's a good idea to start by adding traces during the optimization process by adding control=list(trace=1, REPORT=1). For the MBBEFD distribution, constrOptim.nl is used.

A pre-fitting process is carried out for the following distributions "mbbefd", "MBBEFD" and "oigbeta" before the main optimization.

The estimation process is carried out via fitdist from the fitdistrplus package and the output object will inherit from the "fitdist" class. Therefore, the following generic methods are available print, plot, summary, quantile, logLik, vcov and coef.

References

Cullen AC and Frey HC (1999), Probabilistic techniques in exposure assessment. Plenum Press, USA, pp. 81-155.

Venables WN and Ripley BD (2002), Modern applied statistics with S. Springer, New York, pp. 435-446.

Vose D (2000), Risk analysis, a quantitative guide. John Wiley & Sons Ltd, Chischester, England, pp. 99-143.

Delignette-Muller ML and Dutang C (2015), fitdistrplus: An R Package for Fitting Distributions. Journal of Statistical Software, 64(4), 1-34.

See Also

See mledist, mmedist, for details on parameter estimation. See gofstat for goodness-of-fit statistics. See plotdist, graphcomp for graphs. See bootDR for bootstrap procedures See optim for base R optimization procedures. See quantile.fitdist, another generic function, which calculates quantiles from the fitted distribution. See quantile for base R quantile computation.

Examples

Run this code

# (1) fit of a one-inflated beta distribution by maximum likelihood estimation
#
n <- 1e3
set.seed(12345)
x <- roibeta(n, 3, 2, 1/6)

f1 <- fitDR(x, "oibeta", method="mle")
summary(f1)

plot(bootdist(f1, niter=11), enhance=TRUE, trueval=c(3, 2, 1/6))

Run the code above in your browser using DataLab