**MathWorks Machine Translation**

The automated translation of this page is provided by a general purpose third party translator tool.

MathWorks does not warrant, and disclaims all liability for, the accuracy, suitability, or fitness for purpose of the translation.

Fit probability distributions to data

The **Distribution Fitting** app interactively
fits probability distributions to data imported from the MATLAB^{®} workspace.
You can choose from 22 built-in probability distributions or create
your own custom distribution. The app displays plots of the fitted
distribution superimposed on a histogram of the data. Available plots
include probability density function (pdf), cumulative distribution
function (cdf), probability plots, and survivor functions. You can
export the fitted parameter values to the workspace as a probability
distribution object, and use object functions to perform further analyses.
For more information on working with these objects, see Working with Probability Distributions. For
the programmatic work flow of the Distribution Fitting app, see `dfittool`

.

MATLAB

Statistics and Machine Learning Toolbox™

MATLAB Toolstrip: On the

**Apps**tab, under**Math, Statistics and Optimization**, click the app icon.MATLAB command prompt: Enter

`dfittool`

.

`Data`

— Data to import from the workspacelist of variables | valid MATLAB expression

Specify the data to import by selecting a variable from the
drop-down list. If the variable is a matrix, the app imports the first
column of the matrix by default. To select a different column or row
of the matrix, click **Select Column or Row**.
Alternatively, you can enter any valid MATLAB expression in the
field.

`Censoring`

— Variable containing censoring datalist of variables

Specify the censoring data by selecting a variable from the
drop-down list. If the variable is a matrix, the app imports the first
column of the matrix by default. To select a different column or row
of the matrix, click **Select Column or Row**.
This parameter is optional.

`Frequency`

— Variable containing frequency datalist of variables

Specify the frequency data by selecting a variable from the
drop-down list. If the variable is a matrix, the app imports the first
column of the matrix by default. To select a different column or row
of the matrix, click **Select Column or Row**.
This parameter is optional.

`Data set name`

— Data set namecharacter vector

Specify a name for the data set as a character vector, or accept the default name.

`Manage data sets`

— Manage previously imported data setslist of data sets

Manage previously imported data sets. Click the data set of
interest, then click the buttons below this pane to view the data
(**View**), set the bin rules (**Set Bin
Rules**), rename the data set (**Rename**),
or delete the data set (**Delete**).

`Data preview`

— Preview plot of datahistogram plot

Display a preview plot of the variable selected from the **Data** drop-down
menu.

`Fit name`

— Name of fitcharacter vector

Specify a name for the fit or accept the default name.

`Data`

— Data set to fitlist of data sets

Specify the data to fit by selecting a data set from the drop-down list.

`Distribution`

— Distribution to fit`Normal`

(default) | `Exponential`

| `Weibull`

| `Non-parametric`

| `...`

Specify the distribution to fit by selecting a distribution name from the drop-down list.

`Exclusion rule`

— Data exclusion rulelist of exclusion rules

Specify a rule to exclude some data values by selecting an exclusion
rule from the drop-down list. To populate this drop-down list, you
must first define exclusion rules by clicking **Exclude** in
the main window of the app. This parameter is optional

`Plot`

— Flag to plot fitted distributionchecked (default) | unchecked

Specify which fit or fits to plot in the main window by selecting
the **Plot** check box next to each fit. Clear the **Plot** check
box to remove a fit from the plot.

`Conf counds`

— Flag to plot confidence boundsunchecked (default) | checked

If you select **Plot** for a particular fit,
you can select **Conf bounds** to display the confidence
bounds for that fit on the plot in the main window. Clearing the **Conf
bounds** check box removes the confidence intervals from
the plot. The Distribution Fitting app displays confidence bounds
only if the Display Type in the main window is set to **Cumulative
probability (CDF)**, **Quantile (inverse CDF)**, **Survivor
function**, or **Cumulative hazard**.

`Fit`

— Fit to evaluatelist of fits

Select one or more fits from the list to evaluate.

`Function`

— Available functions to fit`Density (PDF)`

(default) | `Cumulative probability (CDF)`

| `Quantile (inverse CDF)`

| `Survivor function`

| `Cumulative hazard`

| `Hazard rate`

Specify the type of probability function to evaluate from the drop-down list. Available probability functions include the probability density function (pdf), cumulative distribution function (cdf), quantile (inverse cdf), survival function, cumulative hazard, and hazard rate.

`At x =`

— Values at which to evaluate functionnumeric vector

Specify a numeric vector of values at which to evaluate the
function. If you specify **Function** as **Quantile
(inverse CDF)**, this field name changes to **At
p =** and you enter a vector of probability values.

`Compute confidence bounds`

— Flag to compute confidence boundsunchecked (default) | checked

Select **Compute confidence bounds** to compute
the confidence bounds for the selected fit. This check box is enabled
only if you specify **Function** as **Cumulative
probability (CDF)**, **Quantile (inverse CDF)**, **Survivor
function**, or **Cumulative hazard**. This
parameter is optional.

`Level`

— Level for confidence bounds95% (default) | numeric value

Specify the level at which to compute the confidence bounds.
This check box is enabled only if you specify **Function** as **Cumulative
probability (CDF)**, **Quantile (inverse CDF)**, **Survivor
function**, or **Cumulative hazard**.

`Plot function`

— Flag to plot functionunchecked (default) | checked

Select **Plot function** to display a plot
of the distribution function, evaluated at the points that you enter
in the **At x =** field, in a new window. This
parameter is optional.

`Exclusion rule name`

— Name of exclusion rulecharacter vector

Specify a name for the exclusion rule as a character vector.

`Exclude sections`

— Define data exclusion rules numericallynumeric value

Specify lower and upper limits for the data numerically.

`Exclude graphically`

— Define data exclusion rules graphicallylist of variables

Specify lower and upper limits for the data by selecting a variable
from the **Select data** drop-down list and
clicking **Exclude graphically**. An interactive
plot opens in a new window, where you can add lower or upper limits
by clicking and dragging a boundary on the plot.

`Existing exclusion rules`

— List of existing exclusion ruleslist of exclusion rules

Select an existing exclusion rule from the list. You can copy, view, rename, or delete exclusion rules by clicking the appropriate button.

`dfittool`

`dfittool`

opens the Distribution Fitting
app, or brings focus to the app if it is already open.

`dfittool(y)`

`dfittool(y)`

opens the Distribution Fitting
app populated with the data specified by the vector `y`

.

`dfittool(``y`

,`cens`

)

`dfittool(`

uses
the vector `y`

,`cens`

)`cens`

to specify whether the observation `y(j)`

is
censored, `(cens(j)==1)`

, or observed exactly, `(cens(j)==0)`

.
If `cens`

is omitted or empty, then no `y`

values
are censored.

`dfittool(``y`

,`cens`

,`freq`

)

`dfittool(`

uses
the vector `y`

,`cens`

,`freq`

)`freq`

to specify the frequency of each
element contained in `y`

. If `freq`

is
omitted or empty, then all values in `y`

have a
frequency of 1.

`dfittool(``y`

,`cens`

,`freq`

,`dsname`

)

`dfittool(`

creates
a data set with the name `y`

,`cens`

,`freq`

,`dsname`

)`dsname`

using the data
vector, `y`

, censoring indicator, `cens`

,
and frequency vector, `freq`

. Specify `dsname`

as
a character vector, for example, `'mydata'`

.

You clicked a link that corresponds to this MATLAB command:

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Was this topic helpful?

You can also select a location from the following list:

- Canada (English)
- United States (English)

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)