Skip to content

Instantly share code, notes, and snippets.

@abikoushi
Created May 12, 2026 05:24
Show Gist options
  • Select an option

  • Save abikoushi/c5447797a0a509368af86d2f72b2bc9e to your computer and use it in GitHub Desktop.

Select an option

Save abikoushi/c5447797a0a509368af86d2f72b2bc9e to your computer and use it in GitHub Desktop.
Nowcast-It における Nowcasting の方法論
marp true
theme uncover
style section { font-size: 24px; text-align: left; }

Nowcast-It における Nowcasting の方法論

Tariq, A., Yan, P., Bleichrodt, A., & Chowell, G. (2025). Nowcast-It: A Practical Toolbox for Real-Time Adjustment of Reporting Delays in Epidemic Surveillance. Viruses, 17(12), 1598. https://doi.org/10.3390/v17121598

は、逆ハザード法(reverse-time hazard method)を採用しています。

これは、発生したもののまだ報告されていないイベント(occurred-but-not-reported events)を統計的に推定する手法であり、以下の方法で補正を行います。

1. 表記

まず、時間を離散的なステップとする。

  • $c$: 現在の時刻(分析を行う時点)。
  • $n_{tx}$: 時刻 $t$ に発生し、遅延 $x$ を経て(時刻 $t+x$ に)報告されたケース数。

2. reverse-time hazard の推定

遅延が $x$ 以下であるイベントが、ちょうど $x$ で報告される確率(逆ハザード)を $g_x$ で表す。

$$ g_x = \Pr(X=x |X \le x)= \frac{\Pr(X=x)}{\Pr(X \le x)} $$

条件付き確率 $g_x$ は次のように推定される。

$$ \hat{g}_x = \frac{n_{+x}}{N_{+x}} $$

ここで、

  • $n_{+x} = \sum_{t=0}^{C-x} n_{tx}$ : 遅延がちょうど $x$ であったイベントの総数。
  • $N_{+x} = \sum_{t=0}^{C-x} \sum_{j=0}^{x} n_{tj}$ : 遅延が $x$ 以下であったイベントの総数。

3. 報告遅延の分布

$$ g_x = \Pr(X=x |X \le x)= \frac{\Pr(X \le x) - \Pr(X \le x-1) }{\Pr(X \le x)}= \frac{\Pr(X \le x|X \le c) - \Pr(X \le x-1|X \le c) }{\Pr(X \le x|X \le c)} $$

より,

$$ \Pr(X \le x-1|C \le c) = (1- g_x)\Pr(X \le x|C \le c). $$

また,

$$ \Pr(X \le c-1|C \le c) = (1- g_c)\Pr(X \le c|X \le c)= 1- g_c. $$

これより,確率 $\Pr(X \le c-t|X \le c)$$g_x$ を使って表すと,

$$ \begin{aligned} \Pr(X \le c-t|C \le c) &= (1- g_{c-t+1})\Pr(X \le c-t+1|C \le c) \\ &= (1- g_{c-t+1})(1- g_{c-t+2})\Pr(X \le c-t+2|C \le c)\\ &=\prod_{u=c-t+1}^{c} [1 - g_u] \end{aligned} $$


4. 補正後の発生数(推定値)の算出

  • $N(t; c)$ を時刻 $t$ に発症し、時刻 $c$ までに報告されたケース数とする。
  • $i(t)$ を報告遅延がない場合の真の発生数とする。

$N(t; c)$$i(t)$ に対して次が成り立つ。

$$ N(t; c) = i(t)\Pr(X \le c-t|C \le c)=i(t)\prod_{u=c-t+1}^{c} [1 - g_u] $$

次式により,直近のデータに見られる「報告の遅れによる見かけ上の減少(downward bias)」を補正し、リアルタイムの流行曲線を再構築する。

$$ \hat{i}(t) = \frac{N(t; c)}{\prod_{u=c-t+1}^{c} [1 - \hat{g}_u]} $$


5. 非定常性への対応(ウィンドウ $m$ の導入)

現実の流行状況では報告パターンが常に変化するため、Nowcast-Itでは移動窓(moving-window) $m$ を導入しています。 定常性を仮定するのではなく、直近 $m$ 期間のデータのみを使用して $\hat{g}_x$ を計算することで、監視体制の変化や介入の影響を柔軟に反映させることが可能です。

また、パフォーマンス評価のために、平均絶対誤差(MAE)や平均二乗誤差(MSE)といった指標を用いて、最適な $m$ の値を選択します。


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment