Learn R Programming

CLRtools (version 0.1.0)

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.

Usage

discordant.pairs(data, outcome, strata, variables = NULL)

Value

A named numeric vector:

  • 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.

Examples

Run this code
# Example from Hosmer et al., 2013
# Applied Logistic Regression (3rd ed.), Chapter 7, Table 7.1

discordant.pairs(glow11m, outcome = 'fracture', strata = 'pair')

Run the code above in your browser using DataLab