インポート
import pandas as pd
import pystan
データ読み込み
protein = pd.read_csv('./data/data-protein.txt')
7.8 打ち切り
idx = protein['Y'].str.contains('<')
Y_obs = protein.loc[~idx, 'Y'].astype(float)
L = protein.loc[idx, 'Y'].str.replace('<', '').astype(float)[0]
data = dict(
N_obs=Y_obs.index.size,
N_cens=idx.sum(),
Y_obs=Y_obs,
L=L
)
fit = pystan.stan('./stan/model7-7.stan', data=data, seed=1234)