Declares a counter-matched nested case-control (NCC) sample: a stratified risk-set design in which controls are drawn from the opposite surrogate stratum to the case, so each sampled risk set is balanced across surrogate exposure values. The analysis is a weighted Cox partial likelihood using log-sampling-weights as an offset (Langholz & Borgan 1995); the counter- matching weights enter as offset(weights) in survival::coxph, and the result is a hazard ratio.
Usage
counter_matched(strata, time, weights = NULL, ratio = NULL)
Arguments
strata
A non-empty character vector naming the column(s) that identify the sampled risk sets (the matched-set id, e.g. “set”). Same role as the strata argument of nested_cc().
time
A single character string naming the risk-time column that defines the failure time for each set (e.g. “risk_time”).
weights
NULL or a single character string naming the log-weight column in the data. sample_ncc_counter_matched() appends a “log_w” column carrying log(n_stratum / m_stratum) for each sampled subject; supply its name here so the analysis engine can enter it as a Cox offset. Required for matcha() to fit the weighted partial likelihood.
ratio
NULL or a single whole number >= 1. Controls sampled per case (from the opposite surrogate stratum).
Value
A matchatr_design object of type“counter_matched” carrying the strata, time, weights, and ratio, with a weight_spec flagged for counter-matching weights.
References
Langholz B, Borgan O (1995). Counter-matching: a stratified nested case-control sampling method. Biometrika 82(1):69-79.