FUNCTION REFERENCE

fitdist

Fit a probability distribution object to data.

Fit a probability distribution object to data.

Syntax

pd = fitdist(x, name)

Syntax

pd = fitdist(x, name, Name, Value)

Syntax

[pd, gn, gl] = fitdist(x, name, 'By', groupvar, Name, Value)

Fits Normal, Exponential, Gamma, Weibull, Lognormal, Poisson, Binomial ('NTrials'), Beta, Rayleigh, ExtremeValue, NegativeBinomial, Logistic, Loglogistic, Rician, Nakagami, GeneralizedExtremeValue, GeneralizedPareto ('Theta', default 0), tLocationScale, InverseGaussian, BirnbaumSaunders, HalfNormal ('mu', default 0) by maximum likelihood, and Kernel ('Kernel' normal|box|triangle|epanechnikov, 'Bandwidth' or 'Width', 'Support' 'unbounded'|'positive'|[lower upper]). A real row or column is one sample; NaN observations are ignored. Normal sigma and Lognormal log-sigma are unbiased (divided by n-1) for uncensored data. Options: 'Censoring' (1 = right-censored, continuous parametric families), 'Frequency' (nonnegative counts or weights), 'Options' (statset: MaxIter, MaxFunEvals, TolX, TolFun) and 'By': pd is then a 1-by-g cell of objects and gn, gl are g-by-1 cell arrays of the group names in sorted order.

Fitted objects add ParameterCovariance (inverse observed information; analytic for Normal/Lognormal at the unbiased sigma, Poisson, Binomial and Exponential), ParameterIsFixed, ParameterDescription, InputData (data, cens, freq), NLogL, Truncation and IsTruncated; the display lists each parameter with its 95% confidence interval (see paramci). Kernel objects have Kernel, BandWidth and Support; their default bandwidth is Silverman's rule sigma*(4/(3n))^(1/5) with sigma = MAD/0.6745, the kernels are scaled to unit variance and bounded supports are mapped by log(x) or log((x-L)/(U-x)).

Example

pd = fitdist([1 2 3 4 NaN], 'Normal'); [pd.mu, pd.sigma]

Example

pd = fitdist([0 1 2 3], 'Binomial', 'NTrials', 5); mean(pd)

Example

pd = fitdist([1.2 0.4 2.2 0.9 3.1 1.7]', 'Weibull', 'Censoring', [0 0 0 0 1 0]')

Example

[pd, gn] = fitdist([4.1 5.3 4.4 6.0 4.8 5.1]', 'Normal', 'By', [1 1 1 2 2 2]');

Example

pd = fitdist([1.2 0.4 2.2 0.9 3.1 1.7]', 'Kernel', 'Support', 'positive'); pdf(pd, 1)

Differences from MATLAB: at most 1000000 observations; Burr and Stable are not supported; left censoring, truncation and kernel censoring are not supported. Normal/Lognormal need at least two observations; families with two or three free parameters need that many distinct uncensored values. Iterative fits use tighter default tolerances than MATLAB's statset defaults, so last digits can differ. 'By' groups are ordered by sorted value or text.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.