StanとRでベイズ統計モデリング(アヒル本)をPythonにしてみる - Chapter 6 練習問題
インポート
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
(1)
np.random.seed(123)
bernoulli_rng = np.random.binomial(1, 0.2, size=10)
categorical_rng = np.random.randint(1, 6, size=10)
(2)
np.random.seed(123)
beta_rng = np.random.beta(2.0, 2.0, size=5)
dirichlet_rng = np.random.dirichlet((0.3, 1.0, 1.0), size=5)
gamma_rng = np.random.gamma(3.0, 1.0, size=5)
bivariate_normal_rng = np.random.multivariate_normal((0, 1), np.array((2, 1, 1, 3)).reshape((-1, 2)), size=5)
cauchy_rng = stats.cauchy.rvs(loc=1, scale=2.5, size=5)
(3)
np.random.seed(123)
y1 = np.random.normal(loc=50, scale=20, size=2000)
y2 = np.random.normal(loc=20, scale=15, size=2000)
y = y1 - y2
sns.kdeplot(y)
plt.show()
Author And Source
この問題について(StanとRでベイズ統計モデリング(アヒル本)をPythonにしてみる - Chapter 6 練習問題), 我々は、より多くの情報をここで見つけました https://qiita.com/shngt/items/ea3468429be2a40f9106著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .