mtch: Match

Description Usage Arguments Value Author(s) See Also

Description

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.

Usage

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

Arguments

date

A vector of dates.

casecontrol

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).

matchvars

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

mahdoy

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.

caldays

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).

by

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.

ratio

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

seed

A seed for a random number generator.

Value

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.

Author(s)

Ander Wilson

See Also

MatchIt


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