7

I'm trying to understand the $\chi^2$-distribution. Wikipedia has the following graph for the probability density function:

enter image description here

This graph shows that for $ k = 1$, the PDF will be... infinite? The mode of the $\chi^2$-distribution is defined as $max \{k − 2, 0\}$, so $f_1(0) = ?$

In other graphs on the Web, it seemed like it even went higher than $1$. Like here:

enter image description here

Of course, the cumulative distribution function approaches $1$ for all degrees of freedom:

enter image description here

I don't understand why the probability distribution function behaves like that around $0$ for any $k$. How is the $\chi^2$-distribution defined around $0$?

kjetil b halvorsen
  • 63,378
  • 26
  • 142
  • 467
CamilB
  • 207
  • 1
  • 6
  • 3
    Have you looked at the formula for its density? That immediately and completely answers your question. – whuber Jul 12 '16 at 19:43
  • I get a sense that what you are really asking is whether it makes sense for the CDF to be bounded at 1, when the PDF goes to infinity at zero. Is that it? – Antoni Parellada Jul 12 '16 at 20:14
  • @AntoniParellada: what I'm asking is more like: how is it reconciled that the PDF for $k = 1$ is so high when approaching 0, with the fact that CDF is (and must be) bounded at $1$. It would appear that integrating the PDF would yield something way higher than $1$. – CamilB Jul 12 '16 at 20:17
  • @whuber: $f(0, 1)=0$, indeed... Now I'm curious $f(?, 1) = 1$. Will try in R, as suggested in the answer. – CamilB Jul 12 '16 at 20:20
  • @AntoniParellada: that's the weirdest thing I've seen today. Thank you. – CamilB Jul 12 '16 at 20:22
  • 3
    It sounds like you need to read http://stats.stackexchange.com/questions/4220/can-a-probability-distribution-value-exceeding-1-be-ok/4223?s=2|0.0000#4223. – whuber Jul 12 '16 at 20:34
  • @whuber: Thank you, yes. I thought I had the concept of a PDF sorted out - apparently not. The question you linked illustrates the same mistake I was making. – CamilB Jul 12 '16 at 20:42
  • 2
    Your feeling that the area under the pdf would be larger than 1 because of the way it increases as it approaches the origin is not uncommon (considering a plot of the density for $01.2$ say) -- without being worried about it exploding in area (and for good reason -- it doesn't). Perceptions can be fooled by a simple axis flip – Glen_b Jul 13 '16 at 00:02

2 Answers2

7

The pdf of a $\chi^2$ distribution is $f(x;k)=\frac{1}{2^{\frac{k}{2}}\Gamma(k/2)}x^{k/2-1}\exp(-x/2).$

So we just need to evaluate the expression for $f(0;k)$.

$$ f(0;1)=\infty $$ $$ f(0;2)=0.5 $$ $$ f(0;3)=0 $$ And so on. The R code for this is dchisq(0,k) for some positive k. It's really only interesting for $k= 2$ because $f(0;k)$ is infinite for $0<k<2$ and 0 for $k>2$.

Sycorax
  • 76,417
  • 20
  • 189
  • 313
  • Many thanks for suggesting R, I'll try to plot the function to get a better feel. – CamilB Jul 12 '16 at 20:24
  • 3
    One could argue that it's not especially interesting at $x=0$ for any d.f. value other than 2, since it's always either going to infinity as $x\to 0$ (for $k<2$) or it's $0$ (for $k>2$). – Glen_b Jul 13 '16 at 00:05
  • @Glen_b That's actually a really good point: the only interesting value of $f(0;k)$ is $2$ exactly. – Sycorax Jul 13 '16 at 00:45
0

Let's try to go back to the definition of this distribution and see what happens around 0.

By definition, the $\chi^2$ distribution is that of the sum of the squares of independent normal random variables:
$$ Y = \sum_{i=1}^k Z_i^2 , $$ (see the wikipedia page). We see easily that the value of the density is $0$ for $k\geq 3$ and $.5$ for $k=2$. For $k=1$, the case is a bit different.

Let's consider just that case to resolve your question: by a change of variable, we have $y=g(z)=z^2$ such that:

$$ f_Y(y) = \left| \frac{d}{dy} (g^{-1}(y)) \right| \cdot f_Z(g^{-1}(y))\\ = \left| \frac{d}{dy} (\sqrt{y}) \right| \cdot f_Z(\sqrt{y})\\ = \frac{1}{2\sqrt{y}} \cdot \frac{1}{\sqrt{2}\pi} \exp(-y/2) $$

We understand a basic fact, the $\chi_1$ is not defined at $0$ because the squaring operation at that point is flat $g(0)=0$ and thus that $g^{-1}(0)$ is not defined (infinite).

meduz
  • 552
  • 2
  • 9
  • As the mathematics shows, the fact that the density is undefined at $0$ follows from *two* facts. It does not suffice that $g^\prime(0)=0$. In addition, you need that $f_Z(0) \ne 0$. – whuber Jul 14 '16 at 23:40