Created
April 19, 2016 03:42
-
-
Save Peranikov/e0cb15ac46e59d0511a30a692f1d1787 to your computer and use it in GitHub Desktop.
カイ二乗検定
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
h = {} | |
120.times { | |
r = rand(6) | |
h[r] = h[r].nil? ? 0 : h[r] += 1 | |
} | |
p h | |
a = [] | |
e = 20 | |
h.each { |k, v| | |
a << ((v.to_f - e) ** 2) / e | |
} | |
p a | |
p sum = a.reduce(:+) | |
p sum <= 11.07 # 自由度5の有意水準5% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment