matchmahal: Match with Mahalanobis

Description Usage Arguments Value Author(s) See Also

Description

This function finds matches for the events without a strata sing the Mahalanobis distrance and nearest neighbor. It is a wrapper for the matchit function from the MatchIt package.

Usage

1
matchmahal(date, casecontrol, matchvars, by, ratio = 1, datewindow, ...)

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.

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.

datewindow

A scalar that limits the potential control days to be within a a particular number of days of the range of events. For example, if the events occur on days 100, 101, 150, 151, 152 of the year and datewindow=7 then control days will have day of years in the range of 93 to 159. If missing then all days are eligible.

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.