visualize {MultiObjMatch} | R Documentation |
Visualize tradeoffs
Description
Main visualization functions for showing the tradeoffs between two of the three objective functions.
Usage
visualize(
matchingResult,
x_axis = "dist1",
y_axis = "dist2",
xlab = NULL,
ylab = NULL,
main = NULL,
display_all = FALSE,
cond = NULL,
xlim = NULL,
ylim = NULL,
display_index = TRUE,
average_cost = FALSE
)
Arguments
matchingResult |
the matching result returned by either distBalMatch or twoDistMatch. |
x_axis |
character, naming the objective function shown on x-axis; one of ("pair", "marginal", "dist1", "dist2", "exclude"), "dist1" by default. |
y_axis |
character, naming the objective function shown on y-axis; one of ("pair", "marginal", "dist1", "dist2", "exclude"), "dist2" by default. |
xlab |
(optional) the axis label for x-axis; NULL by default. |
ylab |
(optional) the axis label for y-axis; NULL by default. |
main |
(optional) the title of the graph; NULL by default. |
display_all |
(optional) whether to show all the labels for match index; FALSE by default, which indicates the visualization function only labels matches at quantiles of number of treated units being excluded. |
cond |
(optional) NULL by default, which denotes all the matches are shown; otherwise, takes a list of boolean values indicating whether to include each match |
xlim |
(optional) NULL by default; function automatically takes the max of the first objective function values being plotted on x-axis; if specified otherwise, pass in the numeric vector c(lower_bound, upper_bound) |
ylim |
(optional) NULL by default; function automatically takes the max of the first objective function values being plotted on y-axis; if specified otherwise, pass in the numeric vector c(lower_bound, upper_bound) |
display_index |
(optional) TRUE by default; whether to display match index |
average_cost |
(optional) FALSE by default; whether to show mean cost |
Details
By default, the plotting function will show the tradeoff between the first distance objective function and the marginal balance (if distBalMatch) is used; or simply the second distance objective function, if twoDistMatch is used.
Value
No return value, called for visualization of match result
Examples
## Generate matches
data("lalonde", package="cobalt")
psCols <- c("age", "educ", "married", "nodegree", "race")
treatVal <- "treat"
responseVal <- "re78"
pairDistVal <- c("age", "married", "educ", "nodegree", "race")
myBalVal <- c("race")
r1s <- c(0.01,1,2,4,4.4,5.2,5.4,5.6,5.8,6)
r2s <- c(0.001)
matchResult <- distBalMatch(df=lalonde, treatCol= treatVal,
myBalCol = myBalVal, rhoExclude=r1s, rhoBalance=r2s, distList = pairDistVal,
propensityCols = psCols, maxIter=0)
## Visualization
visualize(matchResult, "marginal", "exclude")
visualize(matchResult, "pair", "exclude")