`matchOnPsAndCovariates`

uses the provided propensity scores and a set of covariates to match
target to comparator persons.

matchOnPsAndCovariates(
population,
caliper = 0.2,
caliperScale = "standardized logit",
maxRatio = 1,
cohortMethodData,
covariateIds
)

## Arguments

population |
A data frame with the three columns described below. |

caliper |
The caliper for matching. A caliper is the distance which is acceptable
for any match. Observations which are outside of the caliper are dropped.
A caliper of 0 means no caliper is used. |

caliperScale |
The scale on which the caliper is defined. Three scales are supported:
`caliperScale = 'propensity score'` , ```
caliperScale =
'standardized'
``` , or
`caliperScale = 'standardized logit'` .
On the standardized scale, the caliper is interpreted in standard
deviations of the propensity score distribution. 'standardized logit'
is similar, except that the propensity score is transformed to the logit
scale because the PS is more likely to be normally distributed on that scale
(Austin, 2011). |

maxRatio |
The maximum number of persons int the comparator arm to be matched to each
person in the treatment arm. A maxRatio of 0 means no maximum: all
comparators will be assigned to a target person. |

cohortMethodData |
An object of type `cohortMethodData` as generated using
`getDbCohortMethodData` . |

covariateIds |
One or more covariate IDs in the `cohortMethodData` object on which
subjects should be also matched. |

## Value

Returns a date frame with the same columns as the input data plus one extra column: stratumId. Any
rows that could not be matched are removed

## Details

The data frame should have at least the following three columns:

`rowId` | (numeric) | A unique identifier for each row (e.g. the person ID) |

`treatment` | (integer) | Column indicating whether the person is in the target (1) or comparator |

| | (0) group |

`propensityScore` | (numeric) | Propensity score |

This function
implements the greedy variable-ratio matching algorithm described in Rassen et al (2012).

The default caliper (0.2 on the standardized logit scale) is the one recommended by Austin (2011).

## References

Rassen JA, Shelat AA, Myers J, Glynn RJ, Rothman KJ, Schneeweiss S. (2012) One-to-many propensity
score matching in cohort studies, Pharmacoepidemiology and Drug Safety, May, 21 Suppl 2:69-80.

Austin, PC. (2011) Optimal caliper widths for propensity-score matching when estimating differences in
means and differences in proportions in observational studies, Pharmaceutical statistics, March, 10(2):150-161.

## Examples

# todo