2つのさいころの和の試行から,さいころの各面の確率を推定する
* 2つのm-面さいころをふる,2つのさいころの出た目の和を記録する
* この試行をN回する
* 和がiである試行がx_iとする
* x_iが与えられたとき各さいころの各目の出る確率を推定する
* 1こめのさいころの目のでる確率を\theta_i^1,2つめのさいころの確率を\theta_i^2
Stanのコード
Stan code for inferring probabilities of m-face di ...
等確率の6面さいころを10000回試行したデータを作って上のStanコードで確率を推定するPythonコード
Python code call dice2.stan with generating data.
結果
mean se_mean sd 2.5% 25% 50% 75% 97.5% n_eff Rhat
theta1[0] 0.17 6.3e-4 0.04 0.11 0.15 0.17 0.2 0.25 3186 1.0
theta1[1] 0.17 8.1e-4 0.05 0.07 0.14 0.17 0.2 0.24 3130 1.0
theta1[2] 0.15 3.9e-4 0.03 0.09 0.13 0.15 0.18 0.22 6507 1.0
theta1[3] 0.17 6.9e-4 0.04 0.1 0.14 0.17 0.2 0.26 3324 1.0
theta1[4] 0.17 8.4e-4 0.05 0.08 0.14 0.17 0.2 0.25 2875 1.0
theta1[5] 0.17 3.4e-4 0.03 0.12 0.15 0.16 0.18 0.22 5849 1.0
theta2[0] 0.17 6.4e-4 0.04 0.11 0.15 0.17 0.2 0.25 3176 1.0
theta2[1] 0.17 8.1e-4 0.05 0.07 0.14 0.17 0.2 0.24 3206 1.0
theta2[2] 0.16 3.9e-4 0.03 0.1 0.13 0.15 0.18 0.22 6399 1.0
theta2[3] 0.17 7.1e-4 0.04 0.1 0.14 0.17 0.2 0.25 3153 1.0
theta2[4] 0.17 8.5e-4 0.05 0.08 0.13 0.17 0.2 0.25 2811 1.0
theta2[5] 0.16 3.4e-4 0.03 0.12 0.15 0.16 0.18 0.22 5872 1.0
lp__ -2.3e4 0.02 2.04 -2.3e4 -2.3e4 -2.3e4 -2.3e4 -2.3e4 10214 1.0
このモデルだと2つのサイコロは対称だから,2つのさいころの違いは検出できないみたい.