In [1]:
import warnings
warnings.filterwarnings('ignore')
In [3]:
%matplotlib inline
%pylab inline
In [4]:
# https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.chisquare.html
In [14]:
from scipy.stats import chisquare
In [15]:
observations = [16, 18, 16, 14, 12, 12]
In [16]:
chisquare(observations)
Out[16]:
In [ ]:
= [16, 16, 16, 16, 16, 8]
In [7]:
chisquare(observations, f_exp=)
Out[7]:
In [8]:
obs = np.array([[16, 18, 16, 14, 12, 12], [32, 24, 16, 28, 20, 24]]).T
In [9]:
obs
Out[9]:
In [10]:
chisquare(obs)
Out[10]:
In [11]:
chisquare(obs, axis=None)
Out[11]:
In [12]:
obs.ravel()
Out[12]:
In [13]:
chisquare([16, 18, 16, 14, 12, 12], ddof=1)
(2.0, 0.73575888234288467)
Out[13]:
In [18]:
# http://vassarstats.net/textbook/ch8pt1.html
chisquare([89, 120, 91])
Out[18]:
In [19]:
chisquare([89, 120, 91], [100, 100, 100])
Out[19]:
In [ ]: