雨で体調不良だったので基本的に寝ていた。スーファミミニ聖剣伝説2を2時間ぐらいやった(はじめたばかり)。本を読んだ。
StanとRでベイズ統計モデリング (Wonderful R)
posted with amazlet at 17.10.15
python+pystanで中身を動かしているので、少し細かいところが面倒だけど、だいたいオブジェクトから呼び出せば良い。簡易的に動かす場合は、Pythonでは辞書型でデータを持てばRのデータフレームと同じ感じで使える。サンプリングの例。
- Rの場合
fit <- sampling(stan_model, data=data, chains=4) bs <- rstan::extract(fit) quantile(bs$b, probs=c(0.025, 0.975))
- Pythonの場合
fm = pystan.StanModel(file=filename) fit = fm.sampling(data=data, chains=4) b1 = np.percentile(b, 2.5) b2 = np.percentile(b, 97.5)