Skip to content

Instantly share code, notes, and snippets.

@j08lue
Created April 15, 2013 15:19
Show Gist options
  • Save j08lue/5388876 to your computer and use it in GitHub Desktop.
Save j08lue/5388876 to your computer and use it in GitHub Desktop.
Test the SciPy built-in function for One-Way ANOVA
"""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