-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathChi2_Distribution_PDF.tex
More file actions
30 lines (30 loc) · 1.36 KB
/
Chi2_Distribution_PDF.tex
File metadata and controls
30 lines (30 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
\begin{figure}[H]
\centering
\begin{tikzpicture}[
declare function={gamma(\z) = (2.506628274631*sqrt(1/\z) + 0.20888568*(1/\z)^(1.5) + 0.00870357*(1/\z)^(2.5) - (174.2106599*(1/\z)^(3.5))/25920 - (715.6423511*(1/\z)^(4.5))/1244160) * exp((-ln(1/\z)-1)*\z);},
declare function={gammapdf(\x,\k) = \x^(\k-1)*exp(-\x/2) / (2^\k*gamma(\k));},
scale=1.2
]
\begin{axis}[
axis lines=left,
xmax=22,
ymax=0.28,
xtick={0,5,10,15,20},
xticklabels={0,5,10,15,20},
ytick={0, 0.1, 0.2},
yticklabels={0, 0.1, 0.2},
xlabel=$x$,
ylabel=$f_X(x)$,
xlabel style={at={(axis description cs:1,0)},anchor=north west},
ylabel style={at={(axis description cs:-0.2,0.9)},anchor=south west,rotate=-90},
samples=100,
legend entries={$n=3$, $n=5$, $n=7$, $n=9$},
legend style={draw=none}
]
\addplot [smooth, domain=0:21, red, line width=1] {gammapdf(x,1.5)};
\addplot [smooth, domain=0:21, orange, line width=1] {gammapdf(x,2.5)};
\addplot [smooth, domain=0:21, cyan, line width=1] {gammapdf(x,3.5)};
\addplot [smooth, domain=0:21, blue, line width=1] {gammapdf(x,4.5)};
\end{axis}
\end{tikzpicture}
\end{figure}