discordant.pairs: Count Discordant Pairs in Matched Case-Control Data
Description
This function identifies and counts discordant/non-informative pairs for categorical variables within matched case-control data.
It supports flexible matching designs, including 1:1 and 1:m, by evaluating each stratum individually.
Only strata with both case and control observations are included in the evaluation.
Each element corresponds to the number of discordant strata for one variable.
The final element, total.valid.pairs, gives the total number of strata that were eligible for evaluation.
Arguments
data
A data frame containing the matched dataset.
outcome
A character string giving the name of the binary outcome variable.
strata
A character string giving the name of the variable that identifies matched strata or sets.
variables
Optional. A character vector of variable names to evaluate for discordant pairs. If NULL, all categorical (factor or character) variables in data are used.