Skip to content

PanelMatch and Refining Matched Set Objects

adamrauh edited this page May 2, 2019 · 4 revisions

The PanelMatch function performs two major operations:

  1. Identifies treated units and matched sets of control units, which are matched only on the basis of having identical treatment histories over the specified lag window.

  2. Refines the matched sets based on the user defined method and parameters.

The nature and details of the refinement process depend mostly on (up to) three arguments arguments:

  1. refinement.method -- Users can choose between ps.weight, ps.match, CBPS.weight, CBPS.match, or mahalanobis
  • ps.weight or CBPS.weight: Use standard or covariate balanced propensity scores for weighting. Units will be assigned a propensity score. Weights are then assigned to control units based on the size of the difference in propensity scores between the controls and treated unit in a matched set. Higher weights are assigned to control units that correspond to smaller differences. The size.match argument is not used, as there is no explicit cut off set for the size of matched sets.
  • ps.match or CBPS.match: Use standard or covariate balanced propensity score matching. These work very similiarly to their weighting counterparts. However, after determining the most similar control units within a matched set, the closest N (where N = size.match) control units are given a weight of 1/N, and all other units are given a weight of 0.
  • mahalanobis: This will apply a matching technique using the mahalanobis distance to calculate and determine the most similar control units in a matched set. The N (where N = size.match) control units with the smallest mahalanobis distance to their corresponding treated unit receive a weight of 1/N, while the others receive a weight of 0.
  1. covs.formula: This argument specifies the covariates that are used in calculating the propensity scores or mahalanobis distances discussed above. It is structured as a one sided formula object. Users are also able to specify lags for variables in this argument. For instance, using the example provided dem data set, one could specify: ~ tradewb + lag("tradewb", 1:4) + lag("y", 1:4). Currently the lag function takes two unnamed, positional arguments -- specify the name of the variable as a string in the first position and the period over which you would like to like in the second.

which would include the tradewb variable at time from t-4 to t, and the y variable from time t-4 to t-1 in the similarity and weight calculations.

  1. size.match This variable is used for setting the maximum size of matched sets as described above. It only affects the refinement process for the ps.match, CBPS.match and mahalanobis methods. For the weighting methods, this argument is not used and will have no impact if provided.

Implementation details

The output of a PanelMatch call is a PanelMatch object, which is just a list with some additional attributes and structure. One of the elements in this list is a matched.set object. This object can be found under the names of either "att", "atc" or both if "ate" is provided to PanelMatch.

A number of the arguments provided to the PanelMatch function will be attached to the returned matched.set object. Additionally, each entry (a vector of control unit ids) will have an attribute called "weights" which will contain the weights assigned according to the specified parameters. This takes the form of a named vector. Furthermore, if the "verbose" option is enabled on PanelMatch, there will also be a "distances" attribute, containing the raw similarity calculations used to assign the weights.

PM.results <- PanelMatch(lag = 4, lead = 0:4, time.id = "year", unit.id = "wbcode2", 
                          treatment = "dem", outcome = "y", refinement.method = "mahalanobis", 
                          data = dem, match.missing = T, forbid.treatment.reversal = F,
                          covs.formula = ~ lag("tradewb", 1:4) + lag("y", 1:4), size.match = 5, qoi = "att")

attributes(PM.results)
$names
[1] "att"

$class
[1] "PanelMatch"

$qoi
[1] "att"

$outcome.var
[1] "y"

$lead
[1] 0 1 2 3 4

$forbid.treatment.reversal
[1] FALSE

mset.obj <- PM.results$att
attributes(mset.obj)
$names
  [1] "4.1992"   "4.1997"   "6.1973"   "6.1983"   "7.1991"   "7.1998"   "12.1992"  "13.2003"  "15.1991"  "16.1977" 
 [11] "17.1991"  "18.1991"  "22.1991"  "25.1982"  "26.1985"  "31.1993"  "34.1990"  "36.2000"  "38.1992"  "40.1990" 
 [21] "40.1996"  "40.2002"  "41.1991"  "45.1993"  "47.1999"  "50.1978"  "52.1979"  "55.1978"  "56.1992"  "57.1995" 
 [31] "59.1990"  "64.1995"  "65.1970"  "65.1979"  "65.1996"  "70.1994"  "70.2005"  "72.1975"  "73.1984"  "75.1966" 
 [41] "75.1986"  "78.1992"  "80.1982"  "81.2000"  "82.2006"  "83.1990"  "84.1999"  "96.2002"  "97.2005"  "101.1988"
 [51] "104.2005" "105.2004" "109.1993" "110.1993" "112.1993" "115.1994" "116.1993" "118.1997" "119.1991" "120.1992"
 [61] "123.1993" "124.1994" "128.1994" "133.1991" "134.1979" "134.1999" "135.1990" "138.1991" "138.2006" "141.1972"
 [71] "141.1988" "142.1994" "143.1980" "144.1987" "149.1976" "150.1993" "154.1990" "155.1993" "158.1965" "158.1986"
 [81] "159.2000" "162.2004" "163.1996" "163.2001" "164.1982" "167.1988" "168.1993" "169.1992" "177.1974" "177.1978"
 [91] "183.1983" "187.1994" "188.1985" "199.1994" "201.1991" "202.1978" "17.2009"  "70.1999"  "82.1994"  "109.1999"
[101] "133.1999" "143.1993" "167.1991" "177.1992" "183.1973"

$lag
[1] 4

$t.var
[1] "year"

$id.var
[1] "wbcode2"

$treated.var
[1] "dem"

$class
[1] "matched.set"

$refinement.method
[1] "mahalanobis"

$covs.formula
~lag("tradewb", 1:4) + lag("y", 1:4)

$match.missing
[1] TRUE

mset.obj[[1]]
 [1] "3"   "13"  "16"  "19"  "28"  "29"  "31"  "35"  "36"  "37"  "43"  "45"  "47"  "51"  "53"  "57"  "62"  "64"  "65" 
[20] "67"  "70"  "71"  "81"  "84"  "87"  "93"  "95"  "96"  "97"  "103" "104" "105" "109" "110" "112" "114" "115" "116"
[39] "118" "123" "124" "125" "128" "129" "134" "140" "142" "150" "155" "156" "157" "159" "161" "163" "168" "171" "172"
[58] "173" "175" "176" "178" "179" "180" "182" "184" "186" "187" "190" "193" "196" "197" "199" "200" "202"
attr(,"weights")
  3  13  16  19  28  29  31  35  36  37  43  45  47  51  53  57  62  64  65  67  70  71  81  84  87  93  95  96  97 103 
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.2 0.2 0.0 0.0 0.2 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.2 0.0 0.0 
104 105 109 110 112 114 115 116 118 123 124 125 128 129 134 140 142 150 155 156 157 159 161 163 168 171 172 173 175 176 
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.2 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 
178 179 180 182 184 186 187 190 193 196 197 199 200 202 
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 
Clone this wiki locally