# Notes from Week III

## Randomization inference with $$H_0: \tau_i=7$$

In Q.7, the sharp null is $$\tau_i = 7$$ $$\forall i$$. How do we test this? One approach is to rescale the treated potential outcomes in such a way that the null hypothesis becomes $$\tau_i=0$$. For example, if we construct $$Y_i(1)^* = Y_i(1) - 7$$, then $$E[Y_i(1)^* - Y_i(0)] = 0$$

Lets work through the logic of this by creating the data:

D Y Y0 Y1 Y0.null7 Y1.null7 Y1.null0 Y_obs
0 1 1 NA 1 8 1 1
0 0 0 NA 0 7 0 0
0 0 0 NA 0 7 0 0
0 4 4 NA 4 11 4 4
0 3 3 NA 3 10 3 3
1 2 NA 2 -5 2 -5 -5
1 11 NA 11 4 11 4 4
1 14 NA 14 7 14 7 7
1 0 NA 0 -7 0 -7 -7
1 3 NA 3 -4 3 -4 -4

After rescaling $$Y_i(1)$$, the observed difference in means is:

out1 <- dat1 %>% summarise(DIM = mean(Y_obs[D == 1]) - mean(Y_obs[D == 0]))
out1$DIM ## [1] -2.6 It is not the same as the difference means prior to rescaling: out2 <- dat1 %>% summarise(DIM = mean(Y[D == 1]) - mean(Y[D == 0])) out2$DIM
## [1] 4.4

Now onto the hypothesis test using ri2

# Specify the randomization procedure
declaration <- declare_ra(N = nrow(dat1), m = 5)

# To conduct randomization inference use the 'conduct_ri' command:

q7_ri <- conduct_ri(Y_obs ~ D, declaration = declaration, assignment = "D",
sharp_hypothesis = 0, data = dat1)
summary(q7_ri, p = "lower")
##   coefficient estimate lower_p_value null_ci_lower null_ci_upper
## 1           D     -2.6     0.2063492          -5.4           5.4
plot(q7_ri)