Skip to contents

Matching removes confounding by design, but it introduces one nuisance parameter per matched set, and those parameters do not go away as the sample grows – there is always one more per new set. Ordinary logistic regression therefore returns an odds ratio biased away from one, badly so for 1:1 pairs. Conditioning on the number of cases in each set cancels the nuisance parameters exactly, leaving a likelihood in the exposure effect alone.

Usage

Matccd(
  cases,
  controls,
  matching_id,
  exposure,
  level = 0.95,
  max_iter = 100,
  tol = 1e-12
)

Arguments

cases

Per-observation case indicator, 1 for a case, 0 otherwise.

controls

Optional control indicator; if supplied it must be 1 - cases, and it is checked.

matching_id

Matched-set label per observation, one case per set.

exposure

Exposure value per observation; binary or continuous.

level

Confidence level.

max_iter

Newton steps.

tol

Convergence tolerance on the score.

Value

List with estimate, log_or, se, ci, information, loglik, n_sets, n_obs, iters, converged.

Details

Formula: for a set with one case, \(L_s(beta) = exp(beta x_case) / sum_j exp(beta x_j)\); the maximum is found by Newton-Raphson – Breslow and Day (1980), Chapter 7.

References

Breslow, N. E. and Day, N. E. (1980). Statistical Methods in Cancer Research, Volume I. IARC Scientific Publications No. 32, Lyon, Chapter 7.

Examples

set.seed(10)
sets <- rep(1:60, each = 3)
cases <- rep(c(1, 0, 0), 60)
exposure <- rbinom(180, 1, ifelse(cases == 1, 0.5, 0.3))
Matccd(cases, NULL, sets, exposure)$estimate
#> [1] 1.685254