Learn R Programming

rriskDistributions (version 2.1.1)

rriskMLEdist: Maximum likelihood fitting of univariate distributions

Description

Fits a univariate distribution by maximum likelihood.

Usage

rriskMLEdist(data, distr, start = NULL, optim.method = "default", lower = -Inf, upper = Inf, custom.optim = NULL, ...)

Arguments

data
A numerical vector for non censored data or a dataframe of two columns respectively named left and right, describing each observed value as an interval for censored data. In that case the left column contains either NA for left censored observations, the left bound of the interval for interval censored observations, or the observed value for non-censored observations. The right column contains either NA for right censored observations, the right bound of the interval for interval censored observations, or the observed value for non-censored observations.
distr
A character string "name" naming a distribution (or directly the density function) for which the corresponding density function dname and the corresponding distribution pname must be classically defined. The possible values are: "norm", "exp", "lnorm", "logis", "gamma", "weibull", "beta", "chisq", "t", "f", "cauchy", "gompertz".
start
A named list giving the initial values of parameters of the named distribution. This argument may be omitted for some distributions for which reasonable starting values are computed (see details).
optim.method
"default" (see details) or optimization method to pass to optim.
lower
Left bounds on the parameters for the "L-BFGS-B" method (see optim).
upper
Right bounds on the parameters for the "L-BFGS-B" method (see optim).
custom.optim
a function carrying the MLE optimization (see details).
...
further arguments passed to the optim or custom.optim function.

Value

rriskMLEdist returns a list with fitting results containing following informations
estimate
numeric, a single value or a vector containing estimated parameters.
convergence
an integer code for the convergence of optim. The value 0 indicates a successful convergence.
loglik
the log-likelihood
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. It is used in rriskFitdist.cont to estimate standard errors.
optim.function
the name of the optimization function used for maximum likelihood.

Details

This function is an alias of the function mledist from the package fitdistrplus (Version 0.1-2). The original function was extended to fitting additional distributions. The following continuous distributions can be fitted by this function: normal, exponential, lognormal, logistic, gamma, Weibull, Beta, chi-square, Student's t, F, Cauchy, Gompertz and triangular. And the following discrete distributions can be fitted: (wird ergaenzt). For more details see the assistance page of the function mledist from the package fitdistrplus. This function is not intended to be called directly but is internally called in rriskFitdist.cont.

Examples

Run this code
## a basic fit of some distribution with maximum likelihood estimation
set.seed(1)
x2 <- rchisq(500, 4)
rriskMLEdist(x2, "norm")
rriskMLEdist(x2, "exp")
rriskMLEdist(x2, "lnorm")
rriskMLEdist(x2, "logis")
rriskMLEdist(x2, "gamma")
rriskMLEdist(x2, "weibull")
#rriskMLEdist(x2, "beta")
rriskMLEdist(x2, "chisq")
rriskMLEdist(x2, "t")
rriskMLEdist(x2, "f")
rriskMLEdist(x2, "cauchy")
rriskMLEdist(x2, "gompertz")

## produces an error:
# rriskMLEdist(x2, "triang")

Run the code above in your browser using DataLab