MatchedDataMap: Plot matches.

Description Usage Arguments Value Examples

View source: R/MatchedDataMap.R

Description

Plots a map of the US of the matched pairs with color corresponding to which unit is treated and which is the control and lines connecting matched pairs.

Usage

1
2
MatchedDataMap(x, trt_coords, con_coords, plot.title = "",
  point_data = TRUE)

Arguments

x

A data frame where the number of rows corresponds to the number of matches. There are at least four columns in the data frame and correspond to longitude and latitude information of the treated and the control unit. Within the same row, we must have the coordinate information of treated and control that are matched to each other.

trt_coords

Indeces of the columns including the longitude and latitude (with this order) of the treated unit.

con_coords

Indeces of the columns including the longitude and latitude (with this order) of the control unit.

point_data

Whether we want to print points of the treated and control observations. Treated units are green points and control units are red points.

plot_title

Title of the plot.

Value

Plot of matched pairs.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
data('toyData2')
toyData2$prop.scores <- glm(Z ~ X1 + X2 + X3 + X4, family = binomial,
                            data = toyData2)$fitted.values
daps1 <- DAPSest(toyData2, out.col = 2, trt.col = 1, caliper = 0.5,
                 weight = 0.2, coords.columns = c(4, 5),
                 pairsRet = TRUE, cov.cols = 6:9, cutoff = 0.1,
                 w_tol = 0.001, coord_dist = TRUE, caliper_type = 'DAPS',
                 matching_algorithm = 'greedy')
MatchedDataMap(x = daps1$pairs, trt_coords = c(3, 4), con_coords = c(7, 8))
# For a larger weight, less weight is given to distance, so matches will
# further apart.
daps2 <- DAPSest(toyData2, out.col = 2, trt.col = 1, caliper = 0.5,
                 weight = 0.8, coords.columns = c(4, 5),
                 pairsRet = TRUE, cov.cols = 6:9, cutoff = 0.1,
                 w_tol = 0.001, coord_dist = TRUE, caliper_type = 'DAPS')
MatchedDataMap(x = daps2$pairs, trt_coords = c(3, 4), con_coords = c(7, 8))

gpapadog/DAPSm documentation built on May 17, 2019, 8 a.m.