Accelerating the pace of engineering and science

# Statistics Toolbox

## Probability Distributions

Statistics Toolbox provides functions and an app to work with parametric and nonparametric probability distributions.

The toolbox lets you compute, fit, and generate samples from over 40 different distributions, including:

See the complete list of supported distributions.
With these tools, you can:

• Fit distributions to data
• Use statistical plots to evaluate goodness of fit
• Compute key functions such as probability density functions and cumulative distribution functions
• Generate random and quasi-random number streams from probability distributions

### Fitting Distributions to Data

The Distribution Fitting app enables you to fit data using predefined univariate probability distributions, a nonparametric (kernel-smoothing) estimator, or a custom distribution that you define. This app supports both complete data and censored (reliability) data. You can exclude data, save and load sessions, and generate MATLAB code.

Visual plot of distribution data (left) and summary statistics (right). Using the Distribution Fitting app, you can estimate a normal distribution with mean and variance values (16.9 and 8.7, respectively, in this example).

You can estimate distribution parameters at the command line or construct probability distributions that correspond to the governing parameters.

Additionally, you can create multivariate probability distributions, including Gaussian mixtures and multivariate normal, multivariate t, and Wishart distributions. You can use copulas to create multivariate distributions by joining arbitrary marginal distributions using correlation structures.

Simulating Dependent Random Numbers Using Copulas (Example)
Create distributions that model correlated multivariate data.

With the toolbox, you can specify custom distributions and fit these distributions using maximum likelihood estimation.

Fitting Custom Univariate Distributions
Perform maximum likelihood estimation on truncated, weighted, or bimodal data.

### Evaluating Goodness of Fit

Statistics Toolbox provides statistical plots to evaluate how well a data set matches a specific distribution. The toolbox includes probability plots for a variety of standard distributions, including normal, exponential, extreme value, lognormal, Rayleigh, and Weibull. You can generate probability plots from complete data sets and censored data sets. Additionally, you can use quantile-quantile plots to evaluate how well a given distribution matches a standard normal distribution.

Statistics Toolbox also provides hypothesis tests to determine whether a data set is consistent with different probability distributions. Specific tests include:

• Chi-square goodness-of-fit tests
• One-sided and two-sided Kolmogorov-Smirnov tests
• Lilliefors tests
• Jarque-Bera tests

### Analyzing Probability Distributions

Statistics Toolbox provides functions for analyzing probability distributions, including:

• Probability density functions
• Cumulative density functions
• Inverse cumulative density functions
• Negative log-likelihood functions

### Generating Random Numbers

Statistics Toolbox provides functions for generating pseudo-random and quasi-random number streams from probability distributions. You can generate random numbers from either a fitted or constructed probability distribution by applying the random method.

MATLAB code for constructing a Poisson distribution with a specific mean and generating a vector of random numbers that match the distribution.

Statistics Toolbox also provides functions for:

• Generating random samples from multivariate distributions, such as t, normal, copulas, and Wishart
• Sampling from finite populations
• Performing Latin hypercube sampling
• Generating samples from Pearson and Johnson systems of distributions

You can also generate quasi-random number streams. Quasi-random number streams produce highly uniform samples from the unit hypercube. Quasi-random number streams can often accelerate Monte Carlo simulations because fewer samples are required to achieve complete coverage.

### Code Generation

MATLAB Coder lets you generate portable and readable C code for more than 100 Statistics Toolbox functions including probability distribution and descriptive statistics. The generated code can be used for:

• Standalone execution
• Integration with other software
• Accelerating statistics algorithms
• Embedded implementation