LoginSignup
1
1

More than 5 years have passed since last update.

StanとRでベイズ統計モデリング(アヒル本)をPythonにしてみる - 7.8 打ち切り

Last updated at Posted at 2018-08-18

実行環境

インポート

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)
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1