# Chi2Pdf

Chi-square probability density function: returns the probability density for the χ2 probability density function.

## Contents

### Syntax

return = Chi2Pdf( X2 ;DegreesOfFreedom; PivotDim1 = -1; PivotDim2 = -1);

### Return Value

If X2 = 0 and DegreesOfFreedom >0 then the return value is the χ2 probability density, else the return value is 0

### Parameters

 X2 Structure or matrix with numerical values. X2 = 0 DegreesOfFreedom Structure of matrix with the degrees of freedom, number values. DegreesOfFreedom > 0 PivotDim1 one single integer value assigning the pivotal dimension of X2. If not specified, the last dimension is the pivotal dimension. PivotDim1 <> 0 PivotDim2 one single integer value assigning the pivotal dimension of DegreesOfFreedom. If not specified, the last dimension is the pivotal dimension. PivotDim2 <> 0

### Explanation

In the figure, the pdf χ2-distributions for 1, 2, 3 and 4 degrees of freedom are shown. The area formula for the PDF is

${\displaystyle f(\chi ^{2})={\frac {e^{-{\frac {1}{2}}}y^{{\frac {1}{2}}df-1}}{2^{{\frac {1}{2}}df}\Gamma ({\frac {1}{2}}df)}}}$

see

N. I. Johson and S. Kotz, 1970. Continuous univariate distributions. Houghton Mifflin Company, Boston.

### Example

        x2 = (0#0.5#10)';
df = 2#4;
Write("x2", ("Df="+df));
Write(x2, Chi2Cdf(x2; df));

which has the following output

x2          Df=2            Df=3            Df=4
0.000000	0.500000	0.000000	0.000000
0.500000	0.389400	0.219696	0.097350
1.000000	0.303265	0.241971	0.151633
1.500000	0.236183	0.230799	0.177137
2.000000	0.183940	0.207554	0.183940
2.500000	0.143252	0.180722	0.179065
3.000000	0.111565	0.154180	0.167348
3.500000	0.086887	0.129697	0.152052
4.000000	0.067668	0.107982	0.135335
4.500000	0.052700	0.089198	0.118574
5.000000	0.041042	0.073225	0.102606
5.500000	0.031964	0.059811	0.087901
6.000000	0.024894	0.048652	0.074681
6.500000	0.019387	0.039438	0.063008
7.000000	0.015099	0.031873	0.052845
7.500000	0.011759	0.025694	0.044096
8.000000	0.009158	0.020667	0.036631
8.500000	0.007132	0.016591	0.030311
9.000000	0.005554	0.013296	0.024995
9.500000	0.004326	0.010638	0.020548
10.000000	0.003369	0.008500	0.016845