This function computes the \(\kappa = \kappa (Z, A, X) = 1 - \frac{A(1-Z)}{1 - \Pr(Z = 1 \mid X)} - \frac{(1-A)Z}{\Pr(Z = 1 \mid X)}\) defined in Abadie, Angrist & Imbens (2002), and Abadie (2003). The expected value of \(\kappa\) is the probability of complier.

abadie_k(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_k(1, 1, 0.5)
#> [1] 1
abadie_k(1, 0, 0.5)
#> [1] -1
abadie_k(0, 1, 0.5)
#> [1] -1
abadie_k(0, 0, 0.5)
#> [1] 1
abadie_k(c(1, 1, 0, 0), c(1, 0, 1, 0), 0.5)
#> [1]  1 -1 -1  1
abadie_k(c(1, 1), c(1, 1), c(0.4, 0.6))
#> [1] 1 1
abadie_k(c(1, 1), c(0, 0), c(0.4, 0.6))
#> [1] -1.5000000 -0.6666667