mledist {fitdistrplus} | R Documentation |
Fits a univariate distribution by maximum likelihood using the optimization function optim
.
mledist(data, distr, start)
data |
A numeric vector. |
distr |
A character string "name" naming a distribution for which the corresponding
density function dname must be defined, or directly the density function. |
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). |
Maximum likelihood estimations of the distribution parameters are computed.
Direct optimization of the log-likelihood is performed using optim
, with its
default method "Nelder-Mead"
for distributions characterized by more than one parameter and
the method "BFGS"
for distributions characterized by only one parameter.
For the following named distributions, reasonable starting values will
be computed if start
is omitted : "norm"
, "lnorm"
,
"exp"
and "pois"
, "cauchy"
, "gamma"
, "logis"
,
"nbinom"
(parametrized by mu and size), "geom"
, "beta"
and "weibull"
.
Note that these starting
values may not be good enough if the fit is poor. The function is not able to fit a uniform distribution.
This function is not intended to be called directly but is internally called in
fitdist
and bootdist
when used with the maximum likelihood method.
mledist
returns a list with 4 components,
estimate |
the parameter estimates |
convergence |
an integer code for the convergence of optim .
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.
|
loglik |
the log-likelihood |
hessian |
a symmetric matrix computed by optim as an estimate of the Hessian
at the solution found. It is used in fitdist to estimate standard errors. |
Marie-Laure Delignette-Muller ml.delignette@vet-lyon.fr
Venables WN and Ripley BD (2002) Modern applied statistics with S. Springer, New York, pp. 435-446.
momdist
, fitdist
, optim
and bootdist
.
x1<-c(6.4,13.3,4.1,1.3,14.1,10.6,9.9,9.6,15.3,22.1,13.4, 13.2,8.4,6.3,8.9,5.2,10.9,14.4) mledist(x1,"norm") dgumbel<-function(x,a,b) 1/b*exp((a-x)/b)*exp(-exp((a-x)/b)) mledist(x1,"gumbel",start=list(a=10,b=5)) x2<-c(rep(4,1),rep(2,3),rep(1,7),rep(0,12)) mledist(x2,"pois") mledist(x2,"nbinom") x3<-c(0.80,0.72,0.88,0.84,0.38,0.64,0.69,0.48,0.73,0.58,0.81, 0.83,0.71,0.75,0.59) mledist(x3,"beta")