Fit distributions to censored data
Fits a distribution to the data x based on maximum likelihood. The data can be left and/or right and/or interval censored.
The following distributions are supported:
1. Normal (normfitc)
2. Log-Normal (lognfitc)
3. Logistic (logistfitc)
4. Log-logistic (loglogistfitc)
5. Extreme value (evfitc)
6. Weibull (wblfitc)
7. Exponential (expfitc)
8. Gamma (gamfitc)
9. Rayleigh (raylfitc)
INPUT ARGUMENTS:
x: a two column matrix of the data. For example, (for a real-line supported distribution):
-Inf 5.0000--> left censored
7.0000 Inf--> right censored
5.0000 9.0000--> interval censored
8.0000 8.0000--> exactly observed
that is, if all data are exactly observed then the two columns must be identical. See also the "examples" file for an illustration.
If a distribution with positive support is to be chosen then the above example turns out to be:
0 5.0000--> left censored
7.0000 Inf--> right censored
5.0000 9.0000--> interval censored
8.0000 8.0000--> exactly observed
OPTIONAL INPUT ARGUMENTS: (These can be either not be reached at all,
or set as [] to proceed to the next optional input argument)
minimizer: Can be set equal to 1 or 2 or 3. That is 1: the fminsearchbnd routine is used for minimization, 2: the fmincon with Largescale set to off and the ‘spq’ algorithm is employed. 3. the fmincon with Largescale set to off and the ‘interior-point’ algorithm is employed. If set to [] or not reached at all then minimizer 1 is chosen by default (for no particular reason). If convergence problems occur be sure to explore all three minimizers first. Then you may explore other initial values in the next input argument.
init: A row vector of initial values defined by the user. If you do not want to define this and move on to the next optional input arguments set it as []. If initial values are not provided by the user then they are derived based on exactly observed data or right censored based on built in MATLAB functions. If only interval data are available then the midpoints are considered as exactly observed and built in funtions are used to obtain initial values.
options: The options that will be used in the optimset of fminsearchbnd or fmincon depending which minimizer is selected by the previous input argument. That is, if the minimizer is set to 1, then the options will refer to the fminsearchbnd. If the minimizer is set to 2 or 3, then the options will refer to fmincon. The options set in this argument will replace the default options mentioned in the minimizer input argument. The default will take place if this input argument is set to [] or not reached at all. See also MATLAB documentation for the "options" of fmincon or fminsearch.
OUTPUT ARGUMENTS:
pars: estimated parameters
covars: variance covariance matrix of the estimated parameters. This is evaluated based on John D'erricos "Adaptive Robust Numerical Differentiation" tools throughout all distributions.
SE: standard error of the estimated parameters
gval: value of the loglikelihood
exitflag: depends on the minimizer selected. In the case where only exactly observed data and/or right censored data are available then exitflag is set to NaN since the estimation is done based on the built in fitting routines.
The purpose of this routine is to provide a useful tool to MATLAB users to fit some distributions (many of which are primarily used in Survival Analysis) when left and/or right and/or interval censored are available.
This routine uses John D'Erricos fminsearchbnd or built in "fmincon" for minimization.
The covariance matrix is calculated
numerically using also John D'Erricos “Adaptive Robust Numerical Differentiation” tools. These can be found here:
http://www.mathworks.com/matlabcentral/fileexchange/8277
http://www.mathworks.com/matlabcentral/fileexchange/13490-adaptive-robust-numerical-differentiation
%See also the "examples" file for an illustration
Citar como
Leonidas Bantis (2024). Fit distributions to censored data (https://www.mathworks.com/matlabcentral/fileexchange/38226-fit-distributions-to-censored-data), MATLAB Central File Exchange. Recuperado .
Compatibilidad con la versión de MATLAB
Compatibilidad con las plataformas
Windows macOS LinuxCategorías
Etiquetas
Agradecimientos
Inspirado por: fminsearchbnd, fminsearchcon, Adaptive Robust Numerical Differentiation
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Descubra Live Editor
Cree scripts con código, salida y texto formateado en un documento ejecutable.
fit distributions censored data/
Versión | Publicado | Notas de la versión | |
---|---|---|---|
1.0.0.0 |