For every covariate, prevalence in treatment and comparator groups before and after matching/trimming are computed. When variable ratio matching was used the balance score will be corrected according the method described in Austin et al (2008).

computeCovariateBalance(
  population,
  cohortMethodData,
  subgroupCovariateId = NULL,
  maxCohortSize = 250000,
  covariateFilter = NULL
)

Arguments

population

A data frame containing the people that are remaining after matching and/or trimming.

cohortMethodData

An object of type CohortMethodData as generated using getDbCohortMethodData().

subgroupCovariateId

Optional: a covariate ID of a binary covariate that indicates a subgroup of interest. Both the before and after populations will be restricted to this subgroup before computing covariate balance.

maxCohortSize

If the target or comparator cohort are larger than this number, they will be downsampled before computing covariate balance to save time. Setting this number to 0 means no downsampling will be applied.

covariateFilter

Determines the covariates for which to compute covariate balance. Either a vector of covariate IDs, or a table 1 specifications object as generated for example using FeatureExtraction::getDefaultTable1Specifications(). If covariateFilter = NULL, balance will be computed for all variables found in the data.

Value

Returns a tibble describing the covariate balance before and after matching/trimming.

Details

The population data frame should have 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.

References

Austin, P.C. (2008) Assessing balance in measured baseline covariates when using many-to-one matching on the propensity-score. Pharmacoepidemiology and Drug Safety, 17: 1218-1225.