Created
April 15, 2013 15:19
-
-
Save j08lue/5388876 to your computer and use it in GitHub Desktop.
Test the SciPy built-in function for One-Way ANOVA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Test the SciPy built-in function for One-Way ANOVA""" | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import scipy.stats as sstats | |
numargs = sstats.f.numargs | |
[ dfn, dfd ] = [0.9,] * numargs | |
rv = sstats.f(dfn, dfd) | |
# Display frozen pdf | |
plt.figure() | |
x = np.linspace(0, np.minimum(rv.dist.b, 3)) | |
h = plt.plot(x, rv.pdf(x)) | |
plt.show() | |
# Check accuracy of cdf and ppf | |
plt.figure() | |
prb = sstats.f.cdf(x, dfn, dfd) | |
h = plt.semilogy(np.abs(x - sstats.f.ppf(prb, dfn, dfd)) + 1e-20) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment