Skip to contents

Assigns each place the exposure used by the P3 theorems: 2 if treated, 1 if untreated with at least one treated neighbour, 0 if untreated and isolated from treatment. Pass the adjacency of the ring you are willing to assume spillover stops at (distance-1 edges, or the union of rings up to distance d).

Usage

morie_spillover_exposure(treated, edges)

Arguments

treated

Integer or logical vector, one entry per place.

edges

Two-column matrix or data frame of place indices (1-based) giving the undirected adjacency.

Value

A data frame with place, treated, treated_neighbours and exposure (0, 1 or 2).

Examples

edges <- rbind(c(1, 2), c(2, 3), c(3, 4))
morie_spillover_exposure(c(1, 0, 0, 0), edges)
#>   place treated treated_neighbours exposure
#> 1     1       1                  0        2
#> 2     2       0                  1        1
#> 3     3       0                  0        0
#> 4     4       0                  0        0