File:Chi-square distributionCDF.svg
Summary
Description | |
Date | |
Source | Own work |
Author | Jona |
SVG development | |
Source code | Python codeimport numpy as np
import matplotlib.pyplot as plt
from scipy.stats import chi2
col = {1: 'black', 2: 'blue', 3: 'green', 4: 'red', 5: 'purple'}
X = np.arange(0, 8, 0.01)
##
## PDF
##
plt.clf()
plt.figure(figsize=(4,3.2))
plt.axes([0.15,0.13,0.79,0.8])
plt.hold(True)
A = []
for k in col.keys():
plt.plot(X, chi2.pdf(X, k), '-', color=col[k], label="k="+str(k))
plt.xlabel("x")
plt.ylabel("P(x)")
bx = plt.legend(numpoints=1, handletextpad=0.5, loc="upper right")
bx.draw_frame(False)
plt.xlim(0,8)
plt.ylim(0,1)
plt.savefig("chi-square_pdf.svg")
##
## CDF
##
plt.clf()
plt.figure(figsize=(4,3.2))
plt.axes([0.15,0.13,0.79,0.8])
plt.hold(True)
A = []
for k in col.keys():
a = plt.plot(X, chi2.cdf(X, k), '-', color=col[k], label="k="+str(k))
A.append(a)
plt.xlabel("x")
plt.ylabel(u"P(X\N{Less-THAN OR EQUAL TO}x)")
bx = plt.legend(numpoints=1, handletextpad=0.5, loc="lower right")
bx.draw_frame(False)
plt.xlim(0,8)
plt.ylim(0,1)
plt.savefig("chi-square_cdf.svg")
|
Licensing
I, the copyright holder of this work, hereby publish it under the following license:
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
- You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
- Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.