in_convex_hull {pensynth}R Documentation

Check whether treated unit is in the convex hull of donors

Description

This function finds out if the treated unit is in the convex hull of the donor units.

Usage

in_convex_hull(X1, X0, ...)

Arguments

X1

⁠N_covars by 1 matrix⁠ of treated unit covariates

X0

⁠N_covars by N_donors matrix⁠ of donor unit covariates

...

additional arguments passed to clarabel::clarabel()

Details

This function does not actually construct the convex hull (which is infeasible in higher dimensions), but rather it checks whether the following linear program has a feasible solution:

min q'w s.t. Aw = b

with w constrained to be above 0 and sum to 1, the feasibility of this linear program directly corresponds to whether the treated is in the convex hull

When the treated unit very close to the boundary of the convex hull this method usually cannot determine this exactly and this function may return NA with the warning "Solver terminated due to lack of progress"

Value

bool whether the treated unit is in the convex hull of the donor units. NA if this cannot be determined. Vector if X1 has multiple columns.

Examples

# create some data
set.seed(45)
X0 <- matrix(runif(20), nrow = 2)
X1 <- matrix(c(.5, .5))

# test if X1 is in the convex hull:
in_convex_hull(X1, X0)

# also works with multiple units in X1:
X1 <- cbind(X1, c(1.3, -3))
in_convex_hull(X1, X0)

[Package pensynth version 0.5.1 Index]