The chi-square ($\chi^2$) distribution is one of the most important continuous probability distributions with many uses in statistical theory and inference (Lovric 2011).
Let $n > 0$ be a positive integer. For a random variable that has a ($\chi^2$)-distribution with $n$ degrees of freedom $(df)$ the probability density function is
$$ f(x) = \begin{cases} 0 & \text{if $x \le 0$} \\ \frac{x^{(n/2-1)}e^{-x/2}}{2^{n/2}\Gamma \left(\frac{k}{2}\right)} & \text{if $x > 0$} \end{cases} $$where $\Gamma$ denotes the Gamma function. The ($\chi^2$)-distribution (with $n$ degrees of freedom) is equal to the $\Gamma$-distribution with the parameters ($n/2,2$), that is, with the mean and variance equal to $n$ and $2n$ respectively.
start = 0
end = 14
cut_a = 0.05
cut_b = 3
x = np.arange(0, 14, 0.1)
df = [1, 2, 3, 5, 7, 10]
color = ["red", "blue", "darkgreen", "gold", "pink", "purple"]
handle = ["df=1", "df=2", "df=3", "df=5", "df=7", "df=10"]
plt.figure(figsize=(10, 5))
plt.title(
"Densities of $\\chi^2$-distributions with 1, 2, 3, 5, 7, and 10 degrees of freedom (df)",
fontsize=16,
)
for d, c, h in zip(df, color, handle):
y = stats.chi2.pdf(x, df=d, loc=0, scale=1)
plt.plot(x, y, color=c, label=h)
plt.legend(fontsize=14)
plt.ylim([0, 0.65])
plt.show()
Basic Properties of $\chi^2$-Curves (Weiss, 2010)
Citation
The E-Learning project SOGA-Py was developed at the Department of Earth Sciences by Annette Rudolph, Joachim Krois and Kai Hartmann. You can reach us via mail by soga[at]zedat.fu-berlin.de.
Please cite as follow: Rudolph, A., Krois, J., Hartmann, K. (2023): Statistics and Geodata Analysis using Python (SOGA-Py). Department of Earth Sciences, Freie Universitaet Berlin.