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.

部分決定係数(partial R2)

Partial R2R^2 (偏決定係数、部分決定係数、偏重相関 などと呼ばれる)は Rosenbaum (2002) の改良として Imbens (2003)が提案した、線形回帰モデルにおける未観測の交絡因子の強さ(欠落変数バイアスの強さ)を把握する手法。

考え方

結果YY、処置TT、未観測の交絡因子UUそれぞれに分布型を仮定してパラメトリックモデルを構築する。

1. 未観測の交絡因子UUのモデル

未観測の交絡因子UUは確率0.5のベルヌーイ分布に従うとする。つまり未観測の交絡因子が影響する/しないの値1,0{1,0}が1/21/2の確率で決まるとする。

Ui∼ ind Bern⁡(12)U_i \stackrel{\text { ind }}{\sim} \operatorname{Bern} \left(\frac{1}{2} \right)

2. 処置変数TTのモデル

処置TTは二値変数で、ロジスティック回帰モデルで表現できると仮定する。観測済みの共変量XXだけでなく、未観測の交絡UUも影響するとして、処置TTへα\alpha倍の強さで影響すると仮定する。

Ti∣Xi,Ui∼ ind Bern⁡(sigmoid⁡(γXi+αUi))T_i \mid X_i, U_i \stackrel{\text { ind }}{\sim} \operatorname{Bern}\left(\operatorname{sigmoid}\left(\gamma X_i+\alpha U_i\right)\right)

別の書き方をすれば

P(Ti=1∣Xi,Ui)=11+exp⁡(−(γXi+αUi))P(T_i = 1 \mid X_i, U_i) = \frac{ 1 }{ 1 + \exp( -(\gamma X_i + \alpha U_i) )}

3. 結果変数YYのモデル

結果YYと他の変数との関係には正規線形回帰モデルを仮定する。未観測の交絡UUは結果YYへδ\delta倍の強さで影響すると仮定する。

Yi∣Xi,Ti,Ui∼ ind N(τTi+βXi+δUi,σ2)Y_i \mid X_i, T_i, U_i \stackrel{\text { ind }}{\sim} \mathcal{N}\left(\tau T_i+\beta X_i+\delta U_i, \sigma^2\right)

別の書き方をすれば

Yi=τTi+βXi+δUi+εi,εi∼N(0,σ2)Y_i = \tau T_i + \beta X_i + \delta U_i + \varepsilon_i, \quad \varepsilon_i \sim \mathcal{N}(0, \sigma^2)

となる。

推定

UUは未観測だが、α,δ\alpha, \deltaをなんらかの値に固定すれば、他のパラメータは最尤推定できる。

したがって、α,δ\alpha, \deltaをさまざまな値に変えたもとでの推定を行うことで、

  1. 未観測の交絡因子が割当や結果変数にどれくらい影響力があるか

  2. 因果効果の推定値τ\tauがどの程度変化するか

を推定することができる

部分決定係数

未観測の交絡因子の影響を表す 部分決定係数(partial R2R^2)は推定したパラメータをもとに構成される。

直感的な解釈としては「UUを追加したことで説明できた部分がどれだけあるか」。UUを追加してfull\text{full}モデルの説明力がreduced\text{reduced}モデルより高くなれば、 RSSfull<RSSreducedRSS_{\text{full}} < RSS_{\text{reduced}} になる。

なので、

  • 未観測の交絡因子UUの影響が 多い 場合、RSSfull<RSSreducedRSS_{\text{full}} < RSS_{\text{reduced}}になりRY,par2(α,δ)R^2_{Y, par}(\alpha, \delta)は 1に近づく

  • 未観測の交絡因子UUの影響が 少ない 場合、RSSfull≈RSSreducedRSS_{\text{full}} \approx RSS_{\text{reduced}}になりRY,par2(α,δ)R^2_{Y, par}(\alpha, \delta)は 0に近づく

ということになる。

→ ⚠️通常の決定係数は1に近いほどいいが、 部分決定係数は0に近いほどよい ことになる点に注意。

Imbens (2003) に記載の方法

未観測の交絡因子UUを入れた回帰モデル

Yi∣Xi,Ti,Ui∼N(τTi+βXi+δUi,σ2)Y_i \mid X_i, T_i, U_i \sim \mathcal{N}\left(\tau T_i+\beta X_i+\delta U_i, \sigma^2\right)

を最尤推定したときの残差の分散の推定量 σ^2(α,δ)\hat{\sigma}^2(\alpha, \delta) (残差平方和?)をもとに

RY2(α,δ)=1−σ^2(α,δ)1N∑i(Yi−Yˉ)2R_Y^2(\alpha, \delta)= \frac{ 1-\hat{\sigma}^2(\alpha, \delta) }{ \frac{1}{N}\sum_i(Y_i - \bar{Y})^2 }

という関数を構築する。α=0,δ=0\alpha=0, \delta = 0を仮定すればUUの影響がゼロになるので、「未観測の交絡因子がない」という仮定になる。

YYに対する部分決定係数RY,par2(α,δ)R^2_{Y, par}(\alpha, \delta)は次のように定義される

RY,par2(α,δ)=RY2(α,δ)−RY2(0,0)1−RY2(0,0)=σ^2(0,0)−σ^2(α,δ)σ^2(0,0)\begin{aligned} R_{Y, \mathrm{par}}^2(\alpha, \delta) & =\frac{R_Y^2(\alpha, \delta)-R_Y^2(0,0)}{1-R_Y^2(0,0)} \\ & =\frac{\hat{\sigma}^2(0,0)-\hat{\sigma}^2(\alpha, \delta)}{\hat{\sigma}^2(0,0)} \end{aligned}

処置変数への影響は

RT2(α,δ)=γ^(α,δ)′ΣXγ^(α,δ)+α2/4γ^(α,δ)′Σxγ^(α,δ)+α2/4+π2/3R_T^2(\alpha, \delta) =\frac{\hat{\gamma}(\alpha, \delta)^{\prime} \boldsymbol{\Sigma}_X \hat{\gamma}(\alpha, \delta)+\alpha^2 / 4} {\hat{\gamma}(\alpha, \delta)^{\prime} \boldsymbol{\Sigma}_{\mathrm{x}} \hat{\gamma}(\alpha, \delta)+\alpha^2 / 4+\pi^2 / 3}

部分決定係数は

RW,par2(α,δ)=RT2(α,δ)−RT2(0,0)1−RT2(0,0)R_{W, \mathrm{par}}^2(\alpha, \delta)=\frac{R_T^2(\alpha, \delta)-R_T^2(0,0)}{1-R_T^2(0,0)}
詳細な計算方法(金本, 2024)

金本拓 (2024) にかかれていた計算方法。よくわからなかった

実際の計算方法はもう少し複雑なものになる。

3つのパターンの部分決定係数を算出する

(1) Y∼T∣XY \sim T \mid X

XXで条件づけた結果YYと処置TTの関係について

RY∼T∣X2=1−RSSY∼T+XRSSY∼XR_{Y \sim T \mid X}^2=1-\frac{R S S_{Y \sim T+X}}{R S S_{Y \sim X}}

ここで

  • RSSY∼T+XR S S_{Y \sim T+X}:結果YYを処置TTと共変量XXで説明したモデルの残差平方和

  • RSSY∼XR S S_{Y \sim X}:結果YYを共変量XXで説明したモデルの残差平方和

これは次のようにも表される

RY∼T∣X2=RY∼T+X2−RY∼X21−RY∼X2R_{Y \sim T \mid X}^2=\frac{R_{Y \sim T+X}^2-R_{Y \sim X}^2}{1-R_{Y \sim X}^2}

ここで

RY∼T+X2=1−RSSY∼T+X1n∑i=1n(Yi−Yˉ)2R_{Y \sim T+X}^2=1-\frac{R S S_{Y \sim T+X}}{\frac{1}{n} \sum_{i=1}^n\left(Y_i-\bar{Y}\right)^2}\\
RY∼X2=1−RSSY∼X1n∑i=1n(Yi−Yˉ)2R_{Y \sim X}^2=1-\frac{R S S_{Y \sim X}}{\frac{1}{n} \sum_{i=1}^n\left(Y_i-\bar{Y}\right)^2}

(2) Y∼U∣X,TY \sim U \mid X, T

X,TX, Tで条件づけた結果YYと未観測の交絡因子UUの関係について。

RY∼U∣X,T2=RY∼U+X+T2−RY∼X+T21−RY∼X+T2R_{Y \sim U \mid X, T}^2=\frac{R_{Y \sim U+X+T}^2-R_{Y \sim X+T}^2}{1-R_{Y \sim X+T}^2}

(3) T∼U∣XT \sim U \mid X

XXで条件づけたもとでの未観測の交絡因子UUの処置TTへの影響

RT∼U∣X2=RT∼U+X2−RT∼X21−RT∼X2R_{T \sim U \mid X}^2=\frac{R_{T \sim U+X}^2-R_{T \sim X}^2}{1-R_{T \sim X}^2}
Source
/home/mitama/notes/.venv/lib/python3.10/site-packages/sensemakr/sensitivity_statistics.py:177: FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`
  return (t_statistic ** 2 / (t_statistic ** 2 + dof))[0]  # extracts float
/home/mitama/notes/.venv/lib/python3.10/site-packages/sensemakr/sensitivity_statistics.py:177: FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`
  return (t_statistic ** 2 / (t_statistic ** 2 + dof))[0]  # extracts float
Loading...
Sensitivity Analysis to Unobserved Confounding

Model Formula: peacefactor ~ directlyharmed + age + farmer_dar + herder_dar + pastvoted + hhsize_darfur + female + village

Null hypothesis: q = 1 and reduce = True 

-- This means we are considering biases that reduce the absolute value of the current estimate.
-- The null hypothesis deemed problematic is H0:tau = 0.0 

Unadjusted Estimates of ' directlyharmed ':
  Coef. estimate: 0.097
  Standard Error: 0.023
  t-value: 4.184 

Sensitivity Statistics:
  Partial R2 of treatment with outcome: 0.022
  Robustness Value, q = 1 : 0.139
  Robustness Value, q = 1 alpha = 0.05 : 0.076 

Verbal interpretation of sensitivity statistics:

-- Partial R2 of the treatment with the outcome: an extreme confounder (orthogonal to the covariates)  that explains 100% of the residual variance of the outcome, would need to explain at least 2.187 % of the residual variance of the treatment to fully account for the observed estimated effect.

-- Robustness Value, q = 1 : unobserved confounders (orthogonal to the covariates) that  explain more than 13.878 % of the residual variance of both the treatment and the outcome are strong enough to bring the point estimate to 0.0 (a bias of 100.0 % of the original estimate). Conversely, unobserved confounders that do not explain more than 13.878 % of the residual variance of both the treatment and the outcome are not strong enough to bring the point estimate to 0.0 .

-- Robustness Value, q = 1 , alpha = 0.05 : unobserved confounders (orthogonal to the covariates) that explain more than 7.626 % of the residual variance of both the treatment and the outcome are strong enough to bring the estimate to a range where it is no longer 'statistically different' from 0.0 (a bias of 100.0 % of the original estimate), at the significance level of alpha = 0.05 . Conversely, unobserved confounders that do not explain more than 7.626 % of the residual variance of both the treatment and the outcome are not strong enough to bring the estimate to a range where it is no longer 'statistically different' from 0.0 , at the significance level of alpha = 0.05 .

Bounds on omitted variable bias:
--The table below shows the maximum strength of unobserved confounders with association with the treatment and the outcome bounded by a multiple of the observed explanatory power of the chosen benchmark covariate(s).

  bound_label    r2dz_x   r2yz_dx       treatment  adjusted_estimate  \
0   1x female  0.009164  0.124641  directlyharmed           0.075220   
1   2x female  0.018329  0.249324  directlyharmed           0.052915   
2   3x female  0.027493  0.374050  directlyharmed           0.030396   

   adjusted_se  adjusted_t  adjusted_lower_CI  adjusted_upper_CI  
0     0.021873    3.438904           0.032283           0.118158  
1     0.020350    2.600246           0.012968           0.092862  
2     0.018670    1.628062          -0.006253           0.067045  

結果の読み方

Sensitivity Statistics

の箇所に部分決定係数が表示されている

Sensitivity Statistics:
  Partial R2 of treatment with outcome: 0.022
  Robustness Value, q = 1 : 0.139
  Robustness Value, q = 1 alpha = 0.05 : 0.076 
  • Partial R2 of treatment with outcome:部分決定係数

  • Robustness Value, q = 1: Robustness Value は未観測の交絡因子が処置変数と結果変数に与える影響を定量的に測る指標。値が大きいほど影響を受けないことを示す。

    • 例えばRobustness Valueが0.1なら、処置変数と結果変数の両方の残差の分散のうち10%を説明するほどの未観測の交絡因子が存在しない限り、処置の結果への影響はロバストであるという意味。

  • Robustness Value, q = 1 alpha = 0.05:統計的有意性も加味したもの。

-- Partial R2 of the treatment with the outcome: an extreme confounder (orthogonal to the covariates) that explains 100% of the residual variance of the outcome, would need to explain at least 2.187 % of the residual variance of the treatment to fully account for the observed estimated effect.

(治療と結果の部分 R2: 結果の残差分散の 100% を説明する極端な交絡因子 (共変量に対して直交) は、観察された推定効果を完全に説明するには、治療の残差分散の少なくとも 2.187% を説明する必要があります。)

この説明を見ると、 RY∼D∣X2R^2_{Y\sim D|X} は高いほうがいい指標の様子(E-valueと同様)

Contour plot

<Figure size 576x576 with 1 Axes>

contour plotの見方

  • x軸が処置変数の部分決定係数

  • y軸が結果変数の部分決定係数

  • 等高線:感度パラメーター(\alpha, \delta)の値のもとでのFullモデルで得られる、因果効果の調整済み推定値(adjusted estimate)

  • 点:指定したcovariateの1倍、2倍、3倍の影響を持つ未観測の交絡因子のもとでの、因果効果の調整済み推定値(adjusted estimate)

<Figure size 768x460.8 with 1 Axes>

発展手法

Cinelli & Hazlett (2020) は複数の交絡因子に対応するよう一般化した手法を提案し、 sensmakerパッケージとして提供

参考文献

References
  1. Imbens, G. W. (2003). Sensitivity to Exogeneity Assumptions in Program Evaluation. American Economic Review, 93(2), 126–132. 10.1257/000282803321946921