Skip to contents

Compares participants included in Cohort A only, Cohort B only, or both, computing Jaccard similarity indices and event rate deltas.

Usage

cohort_overlap(
  con = NULL,
  cohort_a,
  cohort_b,
  by = "site",
  person_col = "subject_id",
  outcome_col = NULL
)

Arguments

con

Optional DuckDB DBI connection (if cohort_a/b are table names).

cohort_a

First cohort data frame or table name.

cohort_b

Second cohort data frame or table name.

by

Optional site column to stratify by (default 'site').

person_col

Person identifier column name (default 'subject_id').

outcome_col

Optional binary outcome column name to compare event rates.

Value

A data frame with columns site, n_cohort_a, n_cohort_b, both_count, a_only_count, b_only_count, jaccard_index, concordance_rate.