Help to Fit of a Parametric Distribution to Non-Censored or Censored Data

Extends the fitdistr() function (of the MASS package) with several functions to help the fit of a parametric distribution to non-censored or censored data. Censored data may contain left censored, right censored and interval censored values, with several lower and upper bounds. In addition to maximum likelihood estimation (MLE), the package provides moment matching (MME), quantile matching (QME), maximum goodness-of-fit estimation (MGE) and maximum spacing estimation (MSE) methods (available only for non-censored data). Weighted versions of MLE, MME, QME and MSE are available. See e.g. Casella & Berger (2002), Statistical inference, Pacific Grove, for a general introduction to parametric estimation.


=== fitdistrplus : Help to fit of a parametric distribution ===

Version 1.0-12


  • bug fixed in qmedist() and fitdistcens() which raised an error in checkparamlist().
  • bug fixed in testdpqfun() which assumes the first argument of d,p,q,r functions are exactly the same as in base R.

Version 1.0-11


  • update the FAQ with beta(a,a).
  • improve graphics for discrete distributions in denscomp().
  • improve automatic naming of legends in xxxcomp().
  • harmonize outputs in mledist(), qmedist(), mmedist(), mgedist(), fitdist() and fitdistcens().
  • automatic test of d, p, q functions in fitdist() and raise warnings.
  • improve test for starting and fixed values.
  • add new default starting values for distributions in actuar.
  • change of the default CDF plot for censored data, using the Wang NPMLE algorithm provided in the package npsurv (in plotdistcens() and cdfcompcens())
  • add of two new goodness-of-fit plots (QQ-plot and PP-plot) for censored data (cf. plotdistcens, qqcompcens and ppcompcens).
  • add of a part dedicated to censored datain the FAQ vignette.
  • homogeneization of xlim and ylim default definition in plotdistcens.
  • Removing of the name of the first argument in calls to dpq functions in order to make the package compatible with distributions defined with a non classical name for their first argument (resp. x, q, p for d, p, q functions).
  • add the possibility to change the title of the CDF plot in plotdistcens() using the argument main.
  • support the use of ggplot2 for cdfcompcens, qqcompcens, ppcompcens.


  • bug fixed concerning the use of gofstat with a chi squared df <=0 (error message blocking the other functions)
  • bug fix in mledist() when bounds were set (so not NULL) for censored MLE
  • enable a correct use of non-equidistant breaks in denscomp for the histogram when plotstyle = "ggplot", and prohibit the use of non-equidistant breaks with probability = FALSE (adding a stop in this case).

Version 1.0-9

  • update the FAQ with linear inequality constraints.

Version 1.0-8


  • support the use of ggplot2 for cdfcomp, denscomp, qqcomp, ppcomp.


  • correct legend for qqcomp and ppomp on large data.
  • correct weights in mmedist.
  • correct the name Akaike in gofstat.
  • correct the use of trueval in plot.bootdist.
  • correct the vignette on truncate (inflated) distributions.

Version 1.0-7


  • keep the JSS vignette as a pdf.
  • start the FAQ vignette and add datasets (?dataFAQ) for it.
  • provide likelihood plot/surface/curve: llplot, llcurve, llsurface.
  • provide parallelization of bootstrap in bootdist and bootdistcens.
  • provide graphic of (e)cdf with bootstraped confidence interval/area: CIcdfplot.
  • allow the use of constrOptim() in mledist, mmedist, mgedist, qmedist functions.
  • add a possible pre-fitting procedure: prefit.


  • add invisible() for all graphical functions.
  • bug fixed concerning the use of weights on censored data.

Version 1.0-6


  • automatic definition of starting values for distributions "llogis" and "invweibull" is now working.

Version 1.0-5


  • update starting/fixing values in mledist, mmedist, mgedist, qmedist functions.
  • update graphics for bootstrap procedure.
  • add argument do.points in cdfcomp.
  • add argument weights in mledist, qmedist, mmedist, fitdist, fitdistcens.
  • add argument keepdata in fitdist, fitdistcens.
  • suppress warnings/errors in fitdist(cens), bootdist(cens).


  • defensive programming in plotdist, cdfcomp,...
  • simplify plotting curves in cdfcomp where seq(xmin, xmax, by=1) was used.

Version 1.0-4

  • release for the JSS publication.

Version 1.0-3


  • new generic functions for fitdist(cens): loglik, vcov and coef.
  • vignette updated to the version of a paper accepted by the Journal of Statistical Software.
  • add of an argument discrete in fitdist in order to be able to take into account non classical discrete distributions while plotting the fit with plot.fitdist or cdfcomp and while calculating goodness-of-fit statistics with gofstat (add of an example : fit of a zero inflate Poisson distribution).
  • add of an S3 class for descdist and a print method.


  • fitdist can handle non invertible Hessian matrices.

Version 1.0-2


  • plotdist can plot empirical density as an histogram, a density plot or both superimposed.
  • a strong warning was added to the documentation of function descdist about the problematic high variance of skewness and kurtosis.


  • bug fixed in bootdistcens : argument fix.arg is now correctly passed to mle.

Version 1.0-1


  • gofstat can handle multiple 'fitdist' objects.
  • plotdist for discrete data is slightly enhanced.

Version 1.0-0


  • update cdfcomp and add denscomp, ppcomp and qqcomp functions.
  • add of an argument Turnbull.confint to functions plotdistcens and cdfcompcens in order to draw confidence intervals on the empirical distribution only if requested.
  • ppoints now used in "fitdist" for QQ plot, PP plot and cdf plot for continuous data (was used only for QQ plot in previous versions) to enable Blom type plotting position (using by default Hazen plotting position than can be chanfge using arguments use.ppoints and a.ppoints)
  • many changes in the examples given in the reference manual.
  • the vignette was removed, to be transformed in a paper that we will soon submit to a journal.
  • add of four data sets : fluazinam, salinity, danishuni and danishmulti.
  • add of functions to calculate quantiles of the fitted distribution, with 95 percent CI calculated by bootstrap : quantile generic function is available both for "fitdist" and "bootdist" objects and quantile generic function is available both for "fitdistcens" and "bootdistcens" objects.


  • correction the formula for the CvM test for Weibull distribution.
  • elimination of CvM and AD tests for normal, lognormal and logistic distributions : formulas previously used (given by Stephens 1986) do not use exactly MLE estimates and thus results were only approximates.
  • make arguments xlim and ylim functional in cdfcompcens.
  • bug fix in the closed formula in mmedist for lognormal distributions.

Version 0.3-4


  • posibility to fix xlegend to a keyword (e.g. "bottomright") in "cdfcomp" and "cdfcompdens".
  • improvement of the new vignette.


  • correction of the NAMESPACE file in order to enable the correct print of a summary of a fitdistcens object (with the correlation matrix, the loglikelihood and AIC and BIC statistics).

Version 0.3-3


  • a new function ("cdfcompcens") to plot cumulative distributions corresponding to various fits using a same censored data set.
  • add an example with scaling problem in man pages.

Version 0.3-2


  • new plot of the empirical cdf curve in plotdistcens, using the Turnbull algorithm by a call to function survfit{survival}.
  • new arguments to function "cdfcomp" : verticals, horizontals and xlim.

Version 0.3-1


  • add of a draft of a new version of the vignette.

Version 0.3-0


  • a new function ("cdfcomp") to plot cumulative distributions corresponding to various fits using a same non censored data set.
  • add of two data sets : "endosulfan" and "toxocara".

Version 0.2-2


  • elimination of NON-ASCII characters in the vignette.

Version 0.2-1


  • a new fitting method was implemented for continuous distributions : the maximum goodness-of-fit estimation (function "mgedist") (for the moment only available for non censored data).

Version 0.1-5


  • a new goodness-of-fit statistic was added in gofstat, with corresponding test : the Cramer-von Mises distance.
  • a new fitting method has been implemented : the quantile matching estimation (function "qmedist"). For the moment, only available for non censored data.
  • the moment matching estimation has been extended (in function mmedist) to enable numerical matching when closed formula are not available.


  • correction of a bug inserted while adding the argument "fix.arg" which prevent the print of the results of goodness-of-fit tests.

Version 0.1-4


  • a component named dots added to the list returned by fitdist and fitdistcens in order to pass optional arguments for the control of optimization in mledist to bootdist and bootdistcens. bootdist and bootdistcens changed to take into account these optional arguments if they are defined in the call to fitdist or fitdistcens.
  • an argument added to fitdist, fitdistcens and mledist, named fix.arg, and giving the possibility to fix some of the distribution parameters while maximizing the likelihood. Functions bootdist, bootdistcens and gofstat were also changed in order to take this new argument into account.
  • a new data file of bacterial contamination censored data extracted from Busschaert et al. 2000 and examples corresponding to analysis of this dataset.


  • correction of a bug in the print and the plot of bootstraped samples using bootdist or bootdistcens when there was only one parameter estimated by maximum likelihood.

Version 0.1-3


  • new data file "groundbeef" (groundbeef.rda and groundbeef.Rd) and new use of this dataset in some examples.
  • new function gofstat. Goodness-of-fit statistics are no more computed by fitdist but may computed and printed by the use of the function gofstat. In this new function, the whole results computed are not printed : results of tests are printed only if the argument print.test==TRUE and for continuous distributions only Anderson-Darling and Kolomogorov-Smirnov statistics are printed by default (but complete results are returned by gofstat).
  • modifications in descdist : three arguments were added in descdist 1/ method, to choose between unbiased estimations of standard deviation, skewness and kurtosis (default choice) and sample values. 2/ obs.col to choose the color used to plot the observed point on the graph. 3/ boot.col to choose the color used to plot the bootstrap sample of points on the graph.
  • modifications in plotfit : minor changes were performed in order to facilitate the use of the argument ... to personnalize the plots (see examples in plotdist.Rd)
  • modication of the vignette


  • correction of a bug in plotdist due to the redefinition in the previous version of the parameter "ylim" for the plot of a histogram with theoretical density function (there was a problem with infinite values of theoretical density function).

Version 0.1-2


  • deletion of mledistcens and modification of mledist in order to maximize likelihood for both censored and non censored data.
  • possibility to choose the optimization method used for maximum likelihood estimation (MLE) of distribution parameters using the new argument "optim.method" of mledist.
  • possibility to specify contraints on distribution parameters using the new arguments "lower" and "upper" of mledist.
  • possibility to use a custom optimization function for MLE using the new argument "custom.optim".
  • moment matching estimation is no longer done with argument method set to "mom" but set to "mme" in fitdist.
  • renaming of momdist in mmedist.
  • calculation of AIC and BIC criterion after maximum likelihood estimation of distribution parameters
  • change of the default number of iterations from 999 to 1001 for bootstrap in order to avoid interpolation using the quantile function
  • use of the argument "log" and (resp. "log.p") of density (resp. distribution) when available to compute the loglikelihood.


  • omitting the name of the first argument in calls to the density function during maximization of the likelihood in order to enable the use of a density function defined with a first parameter (the vector of quantiles) with a name differing from "x" (classical name for density distributions defined in R), such as the density function dexGAUS from the package gamlss.dist.

Version 0.1-1

  • Initial release.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


1.1-6 by Aurelie Siberchicot, 22 days ago,

Report a bug at

Browse source code at

Authors: Marie-Laure Delignette-Muller [aut] , Christophe Dutang [aut] , Regis Pouillot [ctb] , Jean-Baptiste Denis [ctb] , Aurelie Siberchicot [aut, cre]

Documentation:   PDF Manual  

Task views: Probability Distributions, Survival Analysis

GPL (>= 2) license

Imports stats

Depends on MASS, grDevices, survival, methods

Suggests actuar, rgenoud, mc2d, gamlss.dist, knitr, ggplot2, GeneralizedHyperbolic, rmarkdown, Hmisc

Imported by AnnuityRIR, CalibratR, Dpit, EnviroPRA, EpiEstim, FMAdist, FitUltD, GMZTests, ICcalib, Kernelheaping, NADA2, PhitestR, PredictionR, STI, SeqNet, Seurat, amt, binnednp, cascsim, conf, evtclass, fasstr, fitur, kindisperse, myTAI, parmsurvfit, phenesse, simPop, ssdtools.

Depended on by BMT, GofCens, OneStep, SCI, enveomics.R, genasis, goft, mbbefd, qmap, vsgoftest.

Suggested by AICcmodavg, Corbi, EGAnet, Ecfun, LindleyR, RTL, WASP, baytrends, eventTrack, ggh4x, mc2d,, raw, zalpha.

Enhanced by RobExtremes.

See at CRAN