Learn R Programming

MatchIt (version 3.0.2)

get_matches: Get matches from matchit object

Description

Get the resulting matches from a matchit model object. This function allows the user to extract the matches from the original dataset used in model building or from a new dataset that has a matching set of key column(s) (id_cols).

Usage

get_matches(object, model_frame, id_cols = NULL, newdata = NULL)

Arguments

object

The 'matchit' class model object

model_frame

The 'data.frame' class object used in creation of object.

id_cols

A string indicating the ID for the datset used in the call to matchit. This can be used in combination with newdata to return the base dataset. Defaults to NULL.

newdata

A new data.frame object to extract matched observations from. Used in conjunction with id_cols. Defaults to NULL.

Value

If newdata is NULL, a subset of model_frame containing the rows corresponding to the matched treatement and control observations with weights appended. If newdata is not NULL, an equivalent subset of newdata is returned.