mledistcens {fitdistrplus} | R Documentation |
Fits a univariate distribution from censored data
by maximum likelihood using the optimization function optim
.
mledistcens(censdata, distr, start)
censdata |
A dataframe of two columns respectively named left
and right , describing each observed value as an interval.
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, for which the corresponding
density function dname and the corresponding distribution function pname
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
fitdistcens
and bootdistcens
.
mledistcens
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 fitdistcens 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.
fitdistcens
, optim
and bootdistcens
.
d1<-data.frame( left=c(1.73,1.51,0.77,1.96,1.96,-1.4,-1.4,NA,-0.11,0.55,0.41, 2.56,NA,-0.53,0.63,-1.4,-1.4,-1.4,NA,0.13), right=c(1.73,1.51,0.77,1.96,1.96,0,-0.7,-1.4,-0.11,0.55,0.41, 2.56,-1.4,-0.53,0.63,0,-0.7,NA,-1.4,0.13)) mledistcens(d1,"norm") 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)) mledistcens(d1,"gumbel",start=list(a=0,b=2))