Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

段階反応モデル

段階反応モデル(graded response model: GRM, Samejima, 1969) は多値の順序尺度の反応を扱えるモデル。複数の二値IRTモデルを組み合わせて多値反応を表現する。

回答者iiの項目jjに対する回答yij=k (k=1,2,…,K)y_{ij} = k \ (k=1,2,\dots,K)について、「kk以上のカテゴリを選ぶ確率」を考えると、これはまだ「kk未満 or kk以上」の二値なので2PLなどで表せる。例えば以下のようになる。

P(yij≥k)=11+exp⁡(−aj(θi−bjk))P(y_{ij} \geq k) = \frac{1}{1+ \exp \big(-a_j ( \theta_i - b_{jk}) \big)}

なお、困難度は項目jjのカテゴリkkごとに用意されるためbjkb_{jk}に変更している。

このモデルを組み合わせると、「ちょうどkk番目のカテゴリを選ぶ確率」は

P(yij=k)=P(yij≥k)−P(yij≥k+1)P(y_{ij} = k) = P(y_{ij} \geq k) - P(y_{ij} \geq k + 1)

と表すことができる。ただし端のカテゴリはP(yij≥1)=1,P(yij≥K+1)=0P(y_{ij} \geq 1) = 1, P(y_{ij} \geq K + 1) = 0とする。また確率100%の困難度は低くて当然なのでbj1=−∞b_{j1} = -\inftyとする。

実装例(全項目のカテゴリ数が等しい場合)

PyMCパッケージを使ってベイズ推定する場合、各項目のカテゴリ数が同じ場合は順序ロジットモデルで簡単に実装できる

Loading...
Loading...

閾値(cutpoints)の推定

pymc.OrderedLogistic が logit−1(η−ck)\text{logit}^{-1}(\eta - c_k) なので、IRTモデルのlogit−1(a(θ−bk))=logit−1(aθ−abk)\text{logit}^{-1}(a(\theta - b_k)) = \text{logit}^{-1}(a\theta - a b_k) に合わせると cutpoints = a[:, None] * b のようにするのが素直な実装。

# --- GRM の閾値:各 item ごとに (K-1) 本 ---
# ordered transform が last axis に対して単調増加を強制する想定
b = pm.Normal(
    "b",
    mu=np.linspace(-1, 1, n_thresholds),
    sigma=2.0,
    dims=("item", "threshold"),
    initval=np.tile(np.linspace(-1, 1, n_thresholds), (num_items, 1)), # 初期値を指定
    transform=pm.distributions.transforms.ordered,
)

# GRM の cutpoints: a_j * b_{jk}
# OrderedLogistic は P(Y >= k) = sigma(eta - cutpoints_k) を計算するため、
# Samejima のパラメタリゼーション P(Y >= k) = sigma(a*(theta - b)) に合わせるには
# cutpoints = a * b とする必要がある(a > 0 なので順序は保たれる)
cutpoints = a[:, None] * b

しかし、これはaとbに依存が関係が生じてサンプリングが安定しにくいかもしれない。cutpoints = pm.Normal() にして b = cutpoints / a[:, None] としたほうが良いかも

Loading...

推定

Initializing NUTS using jitter+adapt_diag...
Multiprocess sampling (4 chains in 4 jobs)
NUTS: [theta, a, b]
Loading...
Loading...
Sampling 4 chains for 2_000 tune and 1_000 draw iterations (8_000 + 4_000 draws total) took 114 seconds.
CPU times: user 16.5 s, sys: 5.18 s, total: 21.7 s
Wall time: 1min 59s

EAP推定量

Loading...
Loading...
Source
<Figure size 1200x400 with 3 Axes>

実装例(各項目のカテゴリ数が異なる場合)

OrderedLogisticを複数個重ねるように実装する方法がある

Response matrix shape: (100, 20)
K=3: 7 items, category counts = [275 154 271]
K=4: 7 items, category counts = [256  85 113 246]
K=5: 6 items, category counts = [193  38  92 124 153]
Loading...
Loading...

モデル

荘島宏二郎 & 豊田秀樹 (2004) を参考に、複数のモデルの尤度を掛けるようにして混合形式のモデルを構築する。

ある項目jjのカテゴリ数がkk個だとし、それをGRMでモデリングした項目特性曲線を PjGRM(k)(θ)P^{GRM(k)}_j(\theta) とすると、今回のデータはカテゴリ数がk=3k=3の項目が7個、k=4k=4の項目が7個、k=5k=5の項目が6個なので

L(θ)=∏i=1N{∏j=17PjGRM(3)(θi)×∏j=17PjGRM(4)(θi)×∏j=16PjGRM(5)(θi)}L(\theta) = \prod_{i=1}^N \left\{ \prod_{j=1}^7 P^{GRM(3)}_j(\theta_i) \times \prod_{j=1}^7 P^{GRM(4)}_j(\theta_i) \times \prod_{j=1}^6 P^{GRM(5)}_j(\theta_i) \right\}

となる。同じカテゴリ数の項目ごとにグルーピングして実装すれば

with pm.Model() as model:
    for k in [3, 4, 5]:
        subset = data[K_per_item == k] # 対応する項目を取り出す
        pm.OrderedLogistic(...) # GRMを構築
        ...

のように実装できる

Loading...
WARNING:2026-04-29 20:37:55,403:jax._src.xla_bridge:794: An NVIDIA GPU may be present on this machine, but a CUDA-enabled jaxlib is not installed. Falling back to cpu.
Loading...
Loading...
Loading...
Loading...

EAP推定値

Loading...

真値と比較

Source
<Figure size 1000x300 with 3 Axes>

参考文献

References
  1. Samejima, F. (1969). Estimation of Latent Ability Using a Response Pattern of Graded Scores. Psychometrika, 34(S1), 1–97. 10.1007/bf03372160
  2. Zein, R. A., & Akhtar, H. (2024). Getting started with the graded response model: An introduction and tutorial in R. International Journal of Psychology, 60(1). 10.1002/ijop.13265