csregion {vecmatch} | R Documentation |
Filter the data based on common support region
Description
The csregion()
function estimates the boundaries of the
rectangular common support region, as defined by Lopez and Gutman (2017),
and filters the matrix of generalized propensity scores based on these
boundaries. The function returns a matrix of observations whose generalized
propensity scores lie within the treatment group-specific boundaries.
Usage
csregion(gps_matrix, borders = "include", refit = TRUE)
Arguments
gps_matrix |
An object of classes |
borders |
A character string specifying how to handle observations at
the edges of the Common Support Region (CSR). Acceptable values are
|
refit |
Logical. If |
Value
A numeric matrix similar to the one returned by estimate_gps()
,
but with the number of rows reduced to exclude those observations that do
not fit within the common support region (CSR) boundaries. The returned
object also possesses additional attributes that summarize the calculation
process of the CSR boundaries:
-
filter_matrix
- A logical matrix with the same dimensions as the gps-part ofgps_matrix
, indicating which treatment assignment probabilities fall within the CSR boundaries, -
filter_vector
- A vector indicating whether each observation was kept (TRUE
) or removed (FALSE
), essentially a row-wise sum offilter_matrix
, -
csr_summary
- A summary of the CSR calculation process, including details of the boundaries and the number of observations filtered. -
csr_data
- The original dataset used for the estimation of generalized propensity scores (original_data
attribute of thegps
object) filtered by thefilter_vector
Examples
# We could estimate simples generalized propensity scores for the `iris`
# dataset
gps <- estimate_gps(Species ~ Sepal.Length, data = iris)
# And then define the common support region boundaries using `csregion()`
gps_csr <- csregion(gps)
# The additional information of the CSR-calculation process are
# accessible through the attributes described in the `*Value*` section
attr(gps_csr, "filter_matrix")
attr(gps_csr, "csr_summary")
attr(gps_csr, "csr_data")