Main Content

# chi2inv

Chi-square inverse cumulative distribution function

## Syntax

``x = chi2inv(p,nu)``

## Description

example

````x = chi2inv(p,nu)` returns the inverse cumulative distribution function (icdf) of the chi-square distribution with degrees of freedom `nu`, evaluated at the probability values in `p`.```

## Examples

collapse all

Find the 95th percentile for the chi-square distribution with `10` degrees of freedom.

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

If you generate random numbers from this chi-square distribution, you would observe numbers greater than `18.3` only `5%` of the time.

Compute the medians of the chi-square distributions with degrees of freedom one through six.

`x = chi2inv(0.50,1:6)`
```x = 1×6 0.4549 1.3863 2.3660 3.3567 4.3515 5.3481 ```

## Input Arguments

collapse all

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

• To evaluate the icdf at multiple values, specify `p` using an array.

• To evaluate the icdfs of multiple distributions, specify `nu` using an array.

If either or both of the input arguments `p` and `nu` are arrays, then the array sizes must be the same. In this case, `chi2inv` expands each scalar input into a constant array of the same size as the array inputs. Each element in `x` is the icdf value of the distribution specified by the corresponding element in `nu`, evaluated at the corresponding probabilities in `p`.

Example: `[0.1,0.5,0.9]`

Data Types: `single` | `double`

Degrees of freedom for the chi-square distribution, specified as a positive scalar value or an array of positive scalar values.

• To evaluate the icdf at multiple values, specify `p` using an array.

• To evaluate the icdfs of multiple distributions, specify `nu` using an array.

If either or both of the input arguments `p` and `nu` are arrays, then the array sizes must be the same. In this case, `chi2inv` expands each scalar input into a constant array of the same size as the array inputs. Each element in `x` is the icdf value of the distribution specified by the corresponding element in `nu`, evaluated at the corresponding probabilities in `p`.

Example: `[9 19 49 99]`

Data Types: `single` | `double`

## Output Arguments

collapse all

icdf values evaluated at the probabilities in `p`, returned as a scalar value or an array of scalar values. `x` is the same size as `p` and `nu` after any necessary scalar expansion. Each element in `x` is the icdf value of the distribution specified by the corresponding element in `nu`, evaluated at the corresponding probabilities in `p`.

## More About

collapse all

### Chi-Square icdf

The chi-square distribution is a one-parameter family of curves. The parameter ν is the degrees of freedom.

The icdf of the chi-square distribution 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,$`

ν is the degrees of freedom, and Γ( · ) is the Gamma function. The result p is the probability that a single observation from the chi-square distribution with ν degrees of freedom falls in the interval [0, x].

For more information, see Chi-Square Distribution.

## Alternative Functionality

• `chi2inv` is a function specific to the chi-square distribution. Statistics and Machine Learning Toolbox™ also offers the generic function `icdf`, which supports various probability distributions. To use `icdf`, specify the probability distribution name and its parameters. Note that the distribution-specific function `chi2inv` is faster than the generic function `icdf`.

## See Also

### Topics

Introduced before R2006a

Download ebook
{"ft_lang_label":"__label__en","ft_lang_prob":0.66202766,"math_prob":0.9947963,"size":417,"snap":"2021-04-2021-17","text_gpt3_token_len":82,"char_repetition_ratio":0.19612591,"word_repetition_ratio":0.0,"special_character_ratio":0.16306955,"punctuation_ratio":0.0952381,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9986198,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-04-11T15:13:50Z\",\"WARC-Record-ID\":\"<urn:uuid:7bdc172a-e69a-4032-9f1b-7e61fe369be5>\",\"Content-Length\":\"90182\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:deec420a-1ad6-4fe3-93db-ec48a5363ac3>\",\"WARC-Concurrent-To\":\"<urn:uuid:5a3b137c-1f2a-49ad-a5db-243ecab2e529>\",\"WARC-IP-Address\":\"184.28.136.58\",\"WARC-Target-URI\":\"https://es.mathworks.com/help/stats/chi2inv.html\",\"WARC-Payload-Digest\":\"sha1:NJ7FGRLM3NSFTM5UFX5RHZ2DH65CY3GZ\",\"WARC-Block-Digest\":\"sha1:BJHUFPJZ3YJUNDLCKN2XU7BAHH4JR2MQ\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-17/CC-MAIN-2021-17_segments_1618038064520.8_warc_CC-MAIN-20210411144457-20210411174457-00034.warc.gz\"}"}