mtch: Match

Description Usage Arguments Value Author(s) See Also


This function finds matches for the events without a strata and withing a time window. The Mahalanobis-metric can be used to match on other variables as well. It is a wrapper for the matchit function from the MatchIt package.


mtch(date, casecontrol, matchvars = NULL, mahdoy = FALSE, caldays = Inf,
  by, ratio = 1, seed, ...)



A vector of dates.


A vector where 1 indentifies events, 0 identifies potential controls, and NA represent non-event days that are not eligible to be matched (e.g. missing data, or excluded for some other reason).


A matrix where the columns represent variables that will be matched on using the Mahalanobis distrance and nearest neighbor.


A logical indicating if the day of year should be included in the Mahalanobis-metric matching within the caliper. The default is FALSE. If TRUE then the distance to the treatment day based on day of year will be included with the other matching variables.


The number of days that matched value will be selected from. This ignors year but only looks at date and month. For example, if caldays=7 then the pairs will be from within 7 days of the control (inclusive).


A vector of ids or a matrix with columns as the id variables. The events will be found separately within each unique combination of id variables. This is optional.


The number of control units to be matched to each case. The default is 1. See documentation for matchit for more details.


A seed for a random number generator.


data A data.table of matched cases and controls.

nn A summary of the number if cases and controls that were matched. See documentation for matchit for more details.

sum.matched A summary of the quality of each match. See documentation for matchit for more details.


Ander Wilson

See Also


AnderWilson/smurf documentation built on May 5, 2019, 4:57 a.m.