This function computes the derivative of Abadie's kappa, $$\nu(\pi)=\dot{\kappa}(\pi)=\frac{Z(1-A)}{\pi^{2}}-\frac{A(1-Z)}{(1-\pi)^{2}}$$.

abadie_v(z, a, ps)

Arguments

z

numeric A binary instrument, e.g., randomized treatment assignment.

a

numeric The actual received treatment, must be the same length as z.

ps

numeric The propensity scores \(\Pr(Z = 1 \mid X)\).

Value

numeric The formula defined above.

Examples

abadie_v(1, 1, 0.5)
#> [1] 0
abadie_v(1, 0, 0.5)
#> [1] 4
abadie_v(0, 1, 0.5)
#> [1] -4
abadie_v(0, 0, 0.5)
#> [1] 0
abadie_v(c(1, 1, 0, 0), c(1, 0, 1, 0), 0.5)
#> [1]  0  4 -4  0
abadie_v(c(1, 1), c(1, 1), c(0.4, 0.6))
#> [1] 0 0
abadie_v(c(1, 1), c(0, 0), c(0.4, 0.6))
#> [1] 6.250000 2.777778