Accelerating the pace of engineering and science

# chi2inv

Chi-square inverse cumulative distribution function

X = chi2inv(P,V)

## Description

X = chi2inv(P,V) computes the inverse of the chi-square cdf with degrees of freedom specified by V for the corresponding probabilities in P. P and V can be vectors, matrices, or multidimensional arrays that have the same size. A scalar input is expanded to a constant array with the same dimensions as the other inputs.

The degrees of freedom parameters in V must be positive integers, and the values in P must lie in the interval [0 1].

The inverse chi-square cdf for a given probability p and ν degrees of freedom is

$x={F}^{-1}\left(p|\nu \right)=\left\{x:F\left(x|\nu \right)=p\right\}$

where

$p=F\left(x|\nu \right)={\int }_{0}^{x}\frac{{t}^{\left(\nu -2\right)/2}{e}^{-t/2}}{{2}^{\nu /2}\Gamma \left(\nu /2\right)}dt$

and Γ( · ) is the Gamma function. Each element of output X is the value whose cumulative probability under the chi-square cdf defined by the corresponding degrees of freedom parameter in V is specified by the corresponding value in P.

## Examples

Find a value that exceeds 95% of the samples from a chi-square distribution with 10 degrees of freedom.

```x = chi2inv(0.95,10)
x =
18.3070
```

You would observe values greater than 18.3 only 5% of the time by chance.