Description Usage Arguments Details Author(s) Examples

View source: R/matched_set_obj.R

Visualizing the standardized mean differences for covariates via a scatter plot.

1 2 3 4 |

`non_refined_set` |
a |

`refined_list` |
a list of one or two |

`xlim` |
xlim of the scatter plot. This is the same as the |

`ylim` |
ylim of the scatter plot. This is the same as the |

`main` |
title of the scatter plot. This is the same as the |

`pchs` |
one or two pch indicators for the symbols on the scatter plot. See |

`covariates` |
variables for which balance is displayed |

`data` |
the same time series cross sectional data set used to create the matched sets. |

`x.axis.label` |
x axis label |

`y.axis.label` |
y axis label |

`...` |
optional arguments to be passed to |

`balance_scatter`

visualizes the standardized mean differences for each covariate.
Although users can use the scatter plot in a variety of ways, it is recommended that
the x-axis refers to balance for covariates before refinement, and y-axis
refers to balance after refinement. Users can utilize parameters powered by `plot`

in base R to further customize the figure.

In Song Kim <insong@mit.edu>, Erik Wang <haixiao@Princeton.edu>, Adam Rauh <adamrauh@mit.edu>, and Kosuke Imai <imai@harvard.edu>

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | ```
# get a matched set without refinement
sets0 <- PanelMatch(lag = 4, time.id = "year", unit.id = "wbcode2",
treatment = "dem", refinement.method = "none",
data = dem, match.missing = FALSE,
covs.formula = ~ I(lag(y, 1:4)) + I(lag(tradewb, 1:4)),
size.match = 5, qoi = "att",
outcome.var = "y",
lead = 0:4, forbid.treatment.reversal = FALSE)
# get a matched set with refinement using CBPS.match, setting the
# size of matched set to 5
sets1 <- PanelMatch(lag = 4, time.id = "year", unit.id = "wbcode2",
treatment = "dem", refinement.method = "mahalanobis",
data = dem, match.missing = FALSE,
covs.formula = ~ I(lag(y, 1:4)) + I(lag(tradewb, 1:4)),
size.match = 5, qoi = "att",
outcome.var = "y",
lead = 0:4, forbid.treatment.reversal = FALSE)
# get another matched set with refinement using CBPS.weight
sets2 <- PanelMatch(lag = 4, time.id = "year", unit.id = "wbcode2",
treatment = "dem", refinement.method = "ps.weight",
data = dem, match.missing = FALSE,
covs.formula = ~ I(lag(y, 1:4)) + I(lag(tradewb, 1:4)),
size.match = 10, qoi = "att",
outcome.var = "y",
lead = 0:4, forbid.treatment.reversal = FALSE)
# use the function to produce the scatter plot
balance_scatter(non_refined_set = sets0$att,
refined_list = list(sets1$att, sets2$att),
data = dem,
covariates = c("y", "tradewb"))
# add legend
legend(x = 0, y = 0.8,
legend = c("mahalanobis",
"PS weighting"),
y.intersp = 0.65,
x.intersp = 0.3,
xjust = 0,
pch = c(1, 3), pt.cex = 1,
bty = "n", ncol = 1, cex = 1, bg = "white")
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.