Last active
December 11, 2015 19:28
-
-
Save taroyabuki/4648554 to your computer and use it in GitHub Desktop.
CodeIQ「NumpyとScipyで統計基本復習」https://codeiq.jp/ace/tsuji_shingo/q153
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
# -*- coding: utf-8 -*- | |
import numpy as np | |
import scipy.stats as ss | |
import matplotlib.pyplot as plt | |
ss.binom.rvs(10, 0.3) | |
np.random.binomial(10, 0.3) | |
data = ss.binom.rvs(10, 0.3, size=1000) | |
plt.hist(data, range(12)) | |
plt.show() | |
ss.binom.pmf(6, 10, 0.3) | |
#0.03675690899999997 | |
np.sum(ss.binom.pmf(range(6, 11), 10, 0.3)) | |
#0.047348987399999959 | |
1 - ss.binom(10, 0.3).cdf(5) | |
#0.047348987400000042 | |
ss.binom.rvs(10, 0.3, size=[5, 3]) | |
data = ss.binom.rvs(10, 0.3, size=[500, 200]) | |
plt.clf() | |
plt.hist(list(map(np.mean, data))) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment