CI-HW6

HW6.

Part I: Theory

Problem 1. An alternative form of the Weighting Estimator.

1-a

E[W(Yobs−μ1(X,β1))e(X)]=E[E[W(Y(1)−μ1(X,β1))e(X)∣X]]=E[E[Y(1)∣X]−μ1(X,β1)]\begin{align} \mathbb{E}\left[ \frac{W(Y^{\mathrm{obs}}-\mu_{1}(X,\beta_{1}))}{e(X)} \right] & = \mathbb{E}\left[ \mathbb{E}\left[ \frac{W(Y(1)-\mu_{1}(X,\beta_{1}))}{e(X)} \mid X\right] \right] \\ & = \mathbb{E}\big[ \mathbb{E}[Y(1)\mid X]-\mu_{1}(X,\beta_{1}) \big] \end{align}

thus

τ=…\tau=\dots

1-b

WiYiobse(Xi)−(1−Wi)Yiobs1−e(Xi)=(1−e(Xi))WiYiobs−e(Xi)(1−Wi)Yiobse(Xi)(1−e(Xi))=Wi−e(Xi)e(Xi)(1−e(Xi))Yiobs\begin{align} \frac{W_{i}Y_{i}^{\mathrm{obs}}}{e(X_{i})}-\frac{(1-W_{i})Y_{i}^{\mathrm{obs}}}{1-e(X_{i})} & = \frac{(1-e(X_{i}))W_{i}Y_{i}^{\mathrm{obs}}-e(X_{i})(1-W_{i})Y_{i}^{\mathrm{obs}}}{e(X_{i})(1-e(X_{i}))} \\ & = \frac{W_{i}-e(X_{i})}{e(X_{i})(1-e(X_{i}))}Y_{i}^{\mathrm{obs}} \end{align}

1-c

W∣X∼Bern(e(X))W\mid X\sim \mathrm{Bern}(e(X))

Therefore,

V[W∣X]=e(X)(1−e(X))\mathbb{V}[W\mid X]=e(X)(1-e(X))

Part II: Application

Problem 0. Background

a

Dataset 2 - 义务教育长短影响成人后的收入么?

b

  • Yi(1)Y_{i}(1): log weekly wage of unit ii if it was born in the beginning half year.
  • Yi(0)Y_{i}(0): log weekly wage of unit ii if it was born in the end half year.
  • WiW_{i}: equals to 1 if unit ii was born in the beginning half year and 0 if born in the end half year.
  • XiX_{i}: covariates of unit ii such as place of birth

Discussions:

  • SUTVA: I think it's violated. Because even if two units were both born in the beginning half year, they surely could be different if one was born in January and the other was born in June, which could lead to at most 6 months education duration difference.
  • Individualistic: I think it holds. Whether a unit was born in the beginning half year or end half year doesn't depend on other units.
  • Probabilistic: I think it holds. Whatever was given, it could not decide when the unit would be born.
  • Unconfounded: I think it holds. Given the place of birth, how much a unit would earn weekly doesn't depend on when it was born.

Problem 1. Traditional regression

a

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Call:
lm(formula = log_week_wage ~ birthtime, data = data)

Residuals:
Min 1Q Median 3Q Max
-8.2485 -0.2757 0.0473 0.3474 3.3057

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 5.905173 0.009048 652.656 <2e-16 ***
birthtime 0.001543 0.012732 0.121 0.904
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.6366 on 9998 degrees of freedom
Multiple R-squared: 1.469e-06, Adjusted R-squared: -9.855e-05
F-statistic: 0.01469 on 1 and 9998 DF, p-value: 0.9035

Birth time has no effect on log weekly wage.

b


Covariates seem to be balanced between the two groups. My faith in (a) would not be changed by this.

c

I choose year of birth. This should be controlled because only when this is controlled will birth time be able to indicate compulsory education length. The result is

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Call:
lm(formula = log_week_wage ~ birthtime + yearofbirth, data = data)

Residuals:
Min 1Q Median 3Q Max
-8.2458 -0.2763 0.0567 0.3518 3.3082

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 5.880487 0.020837 282.210 <2e-16 ***
birthtime 0.001269 0.012736 0.100 0.9206
yearofbirth31 0.059406 0.028440 2.089 0.0367 *
yearofbirth32 0.025612 0.028681 0.893 0.3719
yearofbirth33 0.008374 0.029270 0.286 0.7748
yearofbirth34 0.022191 0.028357 0.783 0.4339
yearofbirth35 0.036883 0.028123 1.312 0.1897
yearofbirth36 0.040197 0.028497 1.411 0.1584
yearofbirth37 0.010100 0.028096 0.359 0.7192
yearofbirth38 0.027316 0.027820 0.982 0.3262
yearofbirth39 0.018426 0.027737 0.664 0.5065
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.6367 on 9989 degrees of freedom
Multiple R-squared: 0.0006683, Adjusted R-squared: -0.0003321
F-statistic: 0.668 on 10 and 9989 DF, p-value: 0.7552

My answer doesn't change compared with (a).

d

Controlling education:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Call:
lm(formula = log_week_wage ~ birthtime + education, data = data)

Residuals:
Min 1Q Median 3Q Max
-8.1953 -0.2556 0.0576 0.3246 3.2861

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 5.050775 0.024924 202.647 <2e-16 ***
birthtime -0.003956 0.011963 -0.331 0.741
education 0.067226 0.001844 36.467 <2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.5981 on 9997 degrees of freedom
Multiple R-squared: 0.1174, Adjusted R-squared: 0.1172
F-statistic: 664.9 on 2 and 9997 DF, p-value: < 2.2e-16

Controlling education and year of birth:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Call:
lm(formula = log_week_wage ~ birthtime + education + yearofbirth,
data = data)

Residuals:
Min 1Q Median 3Q Max
-8.1916 -0.2467 0.0589 0.3309 3.2894

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 5.0505684 0.0299754 168.490 <2e-16 ***
birthtime -0.0041424 0.0119625 -0.346 0.7291
education 0.0674955 0.0018466 36.552 <2e-16 ***
yearofbirth31 0.0469426 0.0267127 1.757 0.0789 .
yearofbirth32 0.0005409 0.0269462 0.020 0.9840
yearofbirth33 -0.0261763 0.0275069 -0.952 0.3413
yearofbirth34 -0.0065478 0.0266450 -0.246 0.8059
yearofbirth35 0.0117684 0.0264219 0.445 0.6560
yearofbirth36 0.0104478 0.0267767 0.390 0.6964
yearofbirth37 -0.0229836 0.0264034 -0.870 0.3841
yearofbirth38 -0.0117009 0.0261500 -0.447 0.6546
yearofbirth39 -0.0317919 0.0260869 -1.219 0.2230
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.5979 on 9988 degrees of freedom
Multiple R-squared: 0.1186, Adjusted R-squared: 0.1176
F-statistic: 122.1 on 11 and 9988 DF, p-value: < 2.2e-16

It turns negative. This happens because the correlation between birth time and other variables. Regression is not ideal because Wi⊥(Yi(1),Yi(0))W_{i}\perp (Y_{i}(1),Y_{i}(0)) cannot be guaranteed in observational data, which causes that the estimation for the coefficient of WiW_{i} depends on the model selection.

Problem 2. Design

a

1
2
3
4
5
6
7
8
9
load("CPSS-HW6-dataset/data.Rdata")

ps_model <- glm(
birthtime ~ education + yearofbirth + placeofbirth,
data = data,
family = binomial(link = "logit")
)

propensity_score <- fitted(ps_model)

b

Let ℓ(x)=ln⁡(e(x)1−e(x))\ell(x)=\ln \left( \frac{e(x)}{1-e(x)} \right) and let

ℓˉc=1Nc∑i:Wi=0ℓ(Xi),sℓ,c2=1Nc−1∑i:Wi=0(ℓ(Xi)−ℓˉc)2ℓˉt=1Nt∑i:Wi=1ℓ(Xi),sℓ,t2=1Nt−1∑i:Wi=1(ℓ(Xi)−ℓˉt)2Δ^ctℓ=ℓˉt−ℓˉc(sℓ,c2+sℓ,t2)/2\begin{aligned} \bar{\ell}_c &= \frac{1}{N_c} \sum_{i:W_i=0} \ell(X_i), & s_{\ell,c}^2 &= \frac{1}{N_c - 1} \sum_{i:W_i=0} (\ell(X_i) - \bar{\ell}_c)^2 \\ \bar{\ell}_t &= \frac{1}{N_t} \sum_{i:W_i=1} \ell(X_i), & s_{\ell,t}^2 &= \frac{1}{N_t - 1} \sum_{i:W_i=1} (\ell(X_i) - \bar{\ell}_t)^2 \\ \hat{\Delta}_{ct}^{\ell} &= \frac{\bar{\ell}_t - \bar{\ell}_c}{\sqrt{(s_{\ell,c}^2 + s_{\ell,t}^2) / 2}} \\ \end{aligned}

and use Δ^ctℓ\hat{\Delta}_{ct}^{\ell} to assess the overall balance. The result is

1
2
3
4
 birthtime    n  mean_logit   var_logit
0 4950 0.010676138 0.018616820
1 5050 0.029396450 0.018940817
Standardized mean difference (1 - 0): 0.13660889

Not close to zero. Imbalance.

c

Trimming: Keep the intersection of e(Xi)e(X_{i}) where Wi=1W_{i}=1 and 00.

Blocking: Divide the trimmed data into five groups based on the quintiles of e(Xi)e(X_{i}).

Assess:

Covariate After Before
education −0.0386 1.2150
birth year −0.0484 0.2528
birth place −0.3745 0.0614
Covariate balance is improved.

Problem 3. Analysis

a

τ^weighting=1N∑i[WiYie^(Xi)−(1−Wi)Yi1−e^(Xi)]=0.000313\hat{\tau}^{\mathrm{weighting}}=\frac1N\sum_i\left[ \frac{W_iY_i}{\hat e(X_{i})} -\frac{(1-W_i)Y_i}{1-\hat e(X_{i})} \right] =0.000313

b

i

strata N(j)/NN(j) / N τ^(j)\hat{\tau}(j) V^[τ^(j)]\hat{\mathbb{V}}[\hat{\tau}(j)]
1 0.200100 0.024565 0.000793038
2 0.200000 0.008326 0.000857657
3 0.199900 −0.006266 0.000779215
4 0.200200 −0.011931 0.000781163
5 0.199800 −0.039529 0.000851155

ii

τ^strata=∑jN(j)Nτ^(j)=−0.004958V^[τ^strata]=∑j(N(j)N)2V^[τ^(j)]=0.0001624\hat{\tau}^{\mathrm{strata}}=\sum _{j} \frac{N(j)}{N}\hat{\tau}(j)=-0.004958\\ \hat{\mathbb{V}}[\hat{\tau}^{\mathrm{strata}}]=\sum _{j} \left( \frac{N(j)}{N} \right)^{2}\hat{\mathbb{V}}[\hat{\tau}(j)]=0.0001624

c

The approximated CI for τ\tau is

τ^strata±1.96V^[τ^strata]=[−0.029942, 0.020025]\hat{\tau}^{\mathrm{strata}}\pm 1.96 \sqrt{\hat{\mathbb{V}}[\hat{\tau}^{\mathrm{strata}}]}=[-0.029942,\ 0.020025]

So no treatment effect is believed. The conclusion is the same as that of raw regression, but this one is more reasonable.


CI-HW6
https://wtx17.github.io/2026/11/23/CI-HW6/
作者
wtx
发布于
2026年11月23日
更新于
2026年12月2日
许可协议