Learn R Programming

fitdistrplus (version 0.1-1)

mledistcens: Maximum likelihood fitting of univariate distributions from censored data

Description

Fits a univariate distribution from censored data by maximum likelihood using the optimization function optim.

Usage

mledistcens(censdata, distr, start)

Arguments

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

Value

  • mledistcens returns a list with 4 components,
  • estimatethe parameter estimates
  • convergencean 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.
  • loglikthe log-likelihood
  • hessiana symmetric matrix computed by optim as an estimate of the Hessian at the solution found. It is used in fitdistcens to estimate standard errors.

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.

References

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

See Also

fitdistcens, optim and bootdistcens.

Examples

Run this code
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))

Run the code above in your browser using DataLab