Documentation

# icdf

Inverse cumulative distribution function

## Syntax

``x = icdf('name',p,A)``
``x = icdf('name',p,A,B)``
``x = icdf('name',p,A,B,C)``
``x = icdf('name',p,A,B,C,D)``
``x = icdf(pd,p)``

## Description

example

````x = icdf('name',p,A)` returns the inverse cumulative distribution function (icdf) for the one-parameter distribution family specified by `'name'` and the distribution parameter `A`, evaluated at the probability values in `p`.```

example

````x = icdf('name',p,A,B)` returns the icdf for the two-parameter distribution family specified by `'name'` and the distribution parameters `A` and `B`, evaluated at the probability values in `p`.```
````x = icdf('name',p,A,B,C)` returns the icdf for the three-parameter distribution family specified by `'name'` and the distribution parameters `A`, `B`, and `C`, evaluated at the probability values in `p`.```
````x = icdf('name',p,A,B,C,D)` returns the icdf for the four-parameter distribution family specified by `'name'` and the distribution parameters `A`, `B`, `C`, and `D`, evaluated at the probability values in `p`.```

example

````x = icdf(pd,p)` returns the icdf function of the probability distribution object `pd`, evaluated at the probability values in `p`.```

## Examples

collapse all

Create a standard normal distribution object with the mean, $\mu$, equal to 0 and the standard deviation, $\sigma$, equal to 1.

```mu = 0; sigma = 1; pd = makedist('Normal','mu',mu,'sigma',sigma);```

Define the input vector p to contain the probability values at which to calculate the icdf.

`p = [0.1,0.25,0.5,0.75,0.9];`

Compute the icdf values for the standard normal distribution at the values in p.

`x = icdf(pd,p)`
```x = 1×5 -1.2816 -0.6745 0 0.6745 1.2816 ```

Each value in x corresponds to a value in the input vector p. For example, at the value p equal to 0.9, the corresponding icdf value x is equal to 1.2816.

Alternatively, you can compute the same icdf values without creating a probability distribution object. Use the `icdf` function and specify a standard normal distribution using the same parameter values for $\mu$ and $\sigma$.

`x2 = icdf('Normal',p,mu,sigma)`
```x2 = 1×5 -1.2816 -0.6745 0 0.6745 1.2816 ```

The icdf values are the same as those computed using the probability distribution object.

Create a Poisson distribution object with the rate parameter, $\lambda$, equal to 2.

```lambda = 2; pd = makedist('Poisson','lambda',lambda);```

Define the input vector p to contain the probability values at which to calculate the icdf.

`p = [0.1,0.25,0.5,0.75,0.9];`

Compute the icdf values for the Poisson distribution at the values in p.

`x = icdf(pd,p)`
```x = 1×5 0 1 2 3 4 ```

Each value in x corresponds to a value in the input vector p. For example, at the value p equal to 0.9, the corresponding icdf value x is equal to 4.

Alternatively, you can compute the same icdf values without creating a probability distribution object. Use the `icdf` function and specify a Poisson distribution using the same value for the rate parameter $\lambda$.

`x2 = icdf('Poisson',p,lambda)`
```x2 = 1×5 0 1 2 3 4 ```

The icdf values are the same as those computed using the probability distribution object.

Create a standard normal distribution object.

`pd = makedist('Normal')`
```pd = NormalDistribution Normal distribution mu = 0 sigma = 1 ```

Determine the critical values at the 5% significance level for a test statistic with a standard normal distribution, by computing the upper and lower 2.5% values.

`x = icdf(pd,[.025,.975])`
```x = 1×2 -1.9600 1.9600 ```

Plot the cdf and shade the critical regions.

`p = normspec(x,0,1,'outside')`

```p = 0.0500 ```

## Input Arguments

collapse all

Probability distribution name, specified as one of the probability distribution names in this table.

`'name'`DistributionInput Parameter `A`Input Parameter `B`Input Parameter `C`Input Parameter `D`
`'Beta'`Beta Distributiona first shape parameterb second shape parameter
`'Binomial'`Binomial Distributionn number of trialsp probability of success for each trial
`'BirnbaumSaunders'`Birnbaum-Saunders Distributionβ scale parameterγ shape parameter
`'Burr'`Burr Type XII Distributionα scale parameterc first shape parameterk second shape parameter
`'Chisquare'`Chi-Square Distributionν degrees of freedom
`'Exponential'`Exponential Distributionμ mean
`'Extreme Value'`Extreme Value Distributionμ location parameterσ scale parameter
`'F'`F Distributionν1 numerator degrees of freedomν2 denominator degrees of freedom
`'Gamma'`Gamma Distributiona shape parameterb scale parameter
`'Generalized Extreme Value'`Generalized Extreme Value Distributionk shape parameterσ scale parameterμ location parameter
`'Generalized Pareto'`Generalized Pareto Distributionk tail index (shape) parameterσ scale parameterμ threshold (location) parameter
`'Geometric'`Geometric Distributionp probability parameter
`'HalfNormal'`Half-Normal Distributionμ location parameterσ scale parameter
`'Hypergeometric'`Hypergeometric Distributionm size of the populationk number of items with the desired characteristic in the populationn number of samples drawn
`'InverseGaussian'`Inverse Gaussian Distributionμ scale parameterλ shape parameter
`'Logistic'`Logistic Distributionμ meanσ scale parameter
`'LogLogistic'`Loglogistic Distributionμ mean of logarithmic valuesσ scale parameter of logarithmic values
`'Lognormal'`Lognormal Distributionμ mean of logarithmic valuesσ standard deviation of logarithmic values
`'Nakagami'`Nakagami Distributionμ shape parameterω scale parameter
`'Negative Binomial'`Negative Binomial Distributionr number of successesp probability of success in a single trial
`'Noncentral F'`Noncentral F Distributionν1 numerator degrees of freedomν2 denominator degrees of freedomδ noncentrality parameter
`'Noncentral t'`Noncentral t Distributionν degrees of freedomδ noncentrality parameter
`'Noncentral Chi-square'`Noncentral Chi-Square Distributionν degrees of freedomδ noncentrality parameter
`'Normal'`Normal Distributionμ mean σ standard deviation
`'Poisson'`Poisson Distributionλ mean
`'Rayleigh'`Rayleigh Distributionb scale parameter
`'Rician'`Rician Distributions noncentrality parameterσ scale parameter
`'Stable'`Stable Distributionα first shape parameterβ second shape parameterγ scale parameterδ location parameter
`'T'`Student's t Distributionν degrees of freedom
`'tLocationScale'`t Location-Scale Distributionμ location parameterσ scale parameterν shape parameter
`'Uniform'`Uniform Distribution (Continuous)a lower endpoint (minimum)b upper endpoint (maximum)
`'Discrete Uniform'`Uniform Distribution (Discrete)n maximum observable value
`'Weibull'`Weibull Distributiona scale parameterb shape parameter

Example: `'Normal'`

Probability values at which to evaluate the icdf, specified as a scalar value, or an array of scalar values in the range [0,1].

If one or more of the input arguments `p`, `A`, `B`, `C`, and `D` are arrays, then the array sizes must be the same. In this case, `icdf` expands each scalar input into a constant array of the same size as the array inputs. See `'name'` for the definitions of `A`, `B`, `C`, and `D` for each distribution.

Example: `[0.1,0.25,0.5,0.75,0.9]`

Data Types: `single` | `double`

First probability distribution parameter, specified as a scalar value or an array of scalar values.

If one or more of the input arguments `p`, `A`, `B`, `C`, and `D` are arrays, then the array sizes must be the same. In this case, `icdf` expands each scalar input into a constant array of the same size as the array inputs. See `'name'` for the definitions of `A`, `B`, `C`, and `D` for each distribution.

Data Types: `single` | `double`

Second probability distribution parameter, specified as a scalar value or an array of scalar values.

If one or more of the input arguments `p`, `A`, `B`, `C`, and `D` are arrays, then the array sizes must be the same. In this case, `icdf` expands each scalar input into a constant array of the same size as the array inputs. See `'name'` for the definitions of `A`, `B`, `C`, and `D` for each distribution.

Data Types: `single` | `double`

Third probability distribution parameter, specified as a scalar value or an array of scalar values.

If one or more of the input arguments `p`, `A`, `B`, `C`, and `D` are arrays, then the array sizes must be the same. In this case, `icdf` expands each scalar input into a constant array of the same size as the array inputs. See `'name'` for the definitions of `A`, `B`, `C`, and `D` for each distribution.

Data Types: `single` | `double`

Fourth probability distribution parameter, specified as a scalar value or an array of scalar values.

If one or more of the input arguments `p`, `A`, `B`, `C`, and `D` are arrays, then the array sizes must be the same. In this case, `icdf` expands each scalar input into a constant array of the same size as the array inputs. See `'name'` for the definitions of `A`, `B`, `C`, and `D` for each distribution.

Data Types: `single` | `double`

Probability distribution, specified as a probability distribution object created with a function or app in this table.

Function or AppDescription
`makedist`Create a probability distribution object using specified parameter values.
`fitdist`Fit a probability distribution object to sample data.
Distribution FitterFit a probability distribution to sample data using the interactive Distribution Fitter app and export the fitted object to the workspace.
`paretotails`Create a piecewise distribution object that has generalized Pareto distributions in the tails.

## Output Arguments

collapse all

icdf values, returned as a scalar value or an array of scalar values. `x` is the same size as `p` after any necessary scalar expansion. Each element in `x` is the icdf value of the distribution, specified by the corresponding elements in the distribution parameters (`A`, `B`, `C`, and `D`) or specified by the probability distribution object (`pd`), evaluated at the corresponding element in `p`.

## Alternative Functionality

`icdf` is a generic function that accepts either a distribution by its name `'name'` or a probability distribution object `pd`. It is faster to use a distribution-specific function, such as `norminv` for the normal distribution and `binoinv` for the binomial distribution. For a list of distribution-specific functions, see Supported Distributions.