Categories &

Functions List

Function Reference: fitdist

statistics: pd = fitdist (x, distname)
statistics: pd = fitdist (x, distname, Name, Value)
statistics: [pdca, gn, gl] = fitdist (x, distname, 'By', groupvar)
statistics: [pdca, gn, gl] = fitdist (x, distname, 'By', groupvar, Name, Value)

Create probability distribution object.

pd = fitdist (x, distname) creates a probability distribution object by fitting the distribution specified by distname to the data in vector x.

pd = fitdist (x, distname, Name, Value) creates the probability distribution object with additional options specified by one or more Name-Value pair arguments listed below.

NameValue
'distribution'A character vector specifying the distribution type for which to estimate parameters.
'Ntrials'A scalar specifying the number of trials for the corresponding element of x for the binomial distribution.
'theta'A scalar specifying the location parameter for the generalized Pareto distribution. It defaults to 0, as MATLAB assumes it, and is not estimated.
'mu'A scalar specifying the location parameter for the half-normal distribution.
'censoring'A vector of the same size as x indicating censored data in x. By default it is censor = zeros (size (x)).
'frequency'A vector of nonnegative integer counts of the same size as x used as frequency observations. By default it is freq = ones (size (x)).
'alpha'A scalar in the range (0,1), as the significance level for the confidence interval pci. By default it is 0.05 corresponding to 95% confidence intervals.
'options'A structure specifying the control parameters for the iterative algorithm used to compute ML estimates with the fminsearch function.

Source Code: fitdist

[pdca, gn, gl] = fitdist (x, distname, 'By', groupvar) creates probability distribution objects by fitting the distribution specified by distname to the data in x based on the grouping variable groupvar. It returns a cell array of fitted probability distribution object, pdca, a cell array of group labels, gn, and a cell array of grouping variable levels, gl.

[pdca, gn, gl] = fitdist (x, distname, 'By', groupvar, Name, Value) returns the same output arguments using additional options specified by one or more Name-Value pair arguments mentioned above.

Note: calling fitdist without any input arguments will return a cell array of character vectors listing all supported distributions.

Distribution names are matched ignoring case, spaces and hyphens, so that 'Extreme Value', 'ExtremeValue' and 'extreme-value' all select the same distribution, and the same set of names is accepted by cdf, pdf, icdf, random, makedist, fitdist and mle.

This accepts more names than MATLAB. MATLAB takes the spaced and the squashed spelling but refuses the hyphenated one, so 'Birnbaum-Saunders' and 'Log-Logistic' are errors there; Octave has always accepted them and continues to. MATLAB also accepts 'tLocationScale' in makedist while refusing it in cdf for the same distribution; Octave accepts it, and 'location-scale T', everywhere. Code written against MATLAB’s names therefore runs unchanged, but code relying on these names will not port back.

See also: makedist

Source Code: fitdist