Categories &

Functions List

Function Reference: chi2inv

statistics: x = chi2inv (p, df)

Inverse of the chi-squared cumulative distribution function (iCDF).

For each element of p, compute the quantile (the inverse of the CDF) of the chi-squared distribution with df degrees of freedom. The size of x is the common size of p and df. A scalar input functions as a constant matrix of the same size as the other inputs.

Further information about the chi-squared distribution can be found at https://en.wikipedia.org/wiki/Chi-squared_distribution

See also: chi2cdf, chi2pdf, chi2rnd, chi2stat

Source Code: chi2inv

Example: 1

Plot various iCDFs from the chi-squared distribution

 p = 0.001:0.001:0.999;
 x1 = chi2inv (p, 1);
 x2 = chi2inv (p, 2);
 x3 = chi2inv (p, 3);
 x4 = chi2inv (p, 4);
 x5 = chi2inv (p, 6);
 x6 = chi2inv (p, 9);
 plot (p, x1, '-b', p, x2, '-g', p, x3, '-r', ...
       p, x4, '-c', p, x5, '-m', p, x6, '-y')
 grid on
 ylim ([0, 8])
 legend ({'df = 1', 'df = 2', 'df = 3', ...
          'df = 4', 'df = 6', 'df = 9'}, 'location', 'northwest')
 title ('Chi-squared iCDF')
 xlabel ('probability')
 ylabel ('values in x')
plotted figure