
Horvitz-Thompson totals and contrasts under a randomised deployment
Source:R/spillover.R
morie_spillover_ht.RdWhen the deployment was randomised, every place's exposure probability
\(\pi_i(\ell) = P(E_i = \ell)\) is known from the design (or can be
computed by re-drawing assignments, see
morie_spillover_exposure_probs). The estimator
\(\hat T(\ell) = \sum_i 1\{E_i=\ell\}\, y_i / \pi_i(\ell)\) is unbiased
for the population total of \(Y(\ell)\) whenever every
\(\pi_i(\ell) > 0\), and so is any contrast between levels
(Research.P3.Design.ht_unbiased,
Research.P3.Design.ht_contrast_unbiased). No ignorability
assumption is used: the design supplies it.
Arguments
- y
Observed outcome per place.
- exposure
Realised exposure per place (0, 1, 2).
- probs
Matrix with one row per place and columns
"0","1","2"giving \(\pi_i(\ell)\); all entries positive.- joint
Optional
nbynby 3 array of joint exposure probabilities \(\pi_{ij}(\ell)\), as returned in thejointelement ofmorie_spillover_exposure_probs(..., joint = TRUE).
Value
A list with totals (\(\hat T(0), \hat T(1), \hat T(2)\)),
means (totals divided by the number of places), spillover,
direct, total_effect (per-place means), and when
joint is given variance and se of the three
totals (NA where a joint probability is zero), and
theorems.
Details
When the joint exposure probabilities \(\pi_{ij}(\ell) = P(E_i = \ell, E_j = \ell)\)
are supplied, the variance of each total is estimated by the
Horvitz-Thompson variance estimator
\(\hat V(\ell) = \sum_{i,j} 1\{E_i = E_j = \ell\}\,(\pi_{ij} - \pi_i\pi_j)/\pi_{ij}\; y_i y_j/(\pi_i \pi_j)\),
which is unbiased for
\(\mathrm{Var}\,\hat T(\ell) = \sum_{i,j} (\pi_{ij} - \pi_i\pi_j)\, Y_i(\ell) Y_j(\ell)/(\pi_i\pi_j)\)
whenever every \(\pi_{ij}(\ell) > 0\)
(Research.P3.Design.ht_variance,
Research.P3.Design.ht_variance_estimator_unbiased). A pair of
places that can never share a level leaves that variance unidentified,
and the function then reports NA for it rather than a number.
Examples
set.seed(2)
edges <- cbind(1:19, 2:20)
pr <- morie_spillover_exposure_probs(n = 20, edges, n_treated = 6, n_draws = 2000, joint = TRUE)
trt <- sample(20, 6); exposure <- morie_spillover_exposure(seq_len(20) %in% trt, edges)$exposure
y <- 5 - 1.5 * (exposure == 2) - 0.5 * (exposure == 1)
morie_spillover_ht(y, exposure, pr$marginal,
pr$joint)[c("spillover", "direct", "total_effect", "se")]
#> $spillover
#> [1] 1.841628
#>
#> $direct
#> [1] -2.226164
#>
#> $total_effect
#> [1] -0.3845363
#>
#> $se
#> T0 T1 T2
#> 12.328835 36.572164 7.322717
#>