| OR | Lower 95% CI | Upper 95% CI | p | ||
|---|---|---|---|---|---|
| smoking | current | 1.000 | < .001 | ||
| smoking | former | 0.663 | 0.455 | 0.966 | .032 |
| smoking | never | 0.393 | 0.264 | 0.585 | < .001 |
A Nested Case-Control Study
1:4 matching with a variable ratio, simulated data
The study
These data are simulated, so that the true odds ratios are known. They mimic a case-control study nested in a cohort. For each of 200 people who developed a disease (the cases), four controls were drawn from the members of the cohort of the same sex and age group who were still free of it. In some sets only two or three suitable controls were found. Download nested.csv.
| Variable | Content |
|---|---|
set |
matched set, 1–200 |
case |
1 = case, 0 = control |
sex, agegrp |
the matching factors |
smoking |
never, former, current |
coffee |
cups per day (missing for 8 subjects) |
active |
physically active: yes, no |
The data were generated with true odds ratios of 1.5 for former and 2.5 for current smoking (both against never), 0.6 for being active, and 1 for coffee. But smokers drink more coffee (on average 2.8 cups a day for current smokers against 1.6 for never smokers), so smoking confounds the effect of coffee.
Step 1: the reference level of a text factor
- Analyses ▸ Regression ▸ Logistic Regression ▸ Conditional (Matched).
caseto Dependent Variable,setto Matching Variable,coffeeto Covariates,smokingandactiveto Factors.
jamovi orders the levels of a text variable alphabetically, so smoking starts with current, and that becomes the reference level:
These odds ratios are correct, but they compare the wrong way round for this question. Open Reference Levels and set never for smoking (and no for active).
Step 2: blocks to see confounding
- In the Model Builder, keep
coffeein block 1. Click Add New Block and movesmokingandactiveinto block 2. - In Model Coefficients, tick Likelihood ratio tests. The odds ratios, with their 95% confidence intervals, are shown by default.
| Per set = Cases | Controls | Sets | Observations |
|---|---|---|---|
| 0 | 4 | 2 | 8 |
| 1 | 2 | 16 | 48 |
| 1 | 3 | 34 | 136 |
| 1 | 4 | 148 | 740 |
Note. 2 uninformative sets (no case or no control left)
| Model | Model | χ² | df | p | |
|---|---|---|---|---|---|
| 1 | - | 2 | 20.288 | 3 | < .001 |
| OR | Lower 95% CI | Upper 95% CI | p | ||
|---|---|---|---|---|---|
| coffee | per unit | 1.197 | 1.036 | 1.384 | .015 |
| OR | Lower 95% CI | Upper 95% CI | p | ||
|---|---|---|---|---|---|
| coffee | per unit | 1.039 | 0.883 | 1.222 | .648 |
| smoking | never | 1.000 | < .001 | ||
| smoking | current | 2.333 | 1.491 | 3.650 | < .001 |
| smoking | former | 1.690 | 1.095 | 2.608 | .018 |
| active | no | 1.000 | |||
| active | yes | 0.662 | 0.477 | 0.920 | .014 |
Alone (model 1), each daily cup of coffee seems to raise the odds of disease by 20% (OR 1.20, p = .015). Once smoking and activity are in the model (model 2), the odds ratio for coffee is 1.04 (0.88–1.22): the crude association was smoking. The smoking odds ratios, 2.33 for current and 1.69 for former smokers, and 0.66 for activity, are compatible with the values used to simulate the data. The model comparison (χ² = 20.3, 3 df, p < .001) tests both added terms together.
Step 3: what the matched-set table tells
The table above shows the variable matching ratio: 148 sets with four controls, 34 with three and 16 with two. The conditional likelihood handles any mix of ratios: no weighting or special option is needed.
It also shows 2 sets with no case. In those sets the case has no coffee value, so the case’s row is dropped. The controls left behind have nobody to be compared with, and those sets contribute nothing to the estimates. Whenever the table shows sets with 0 cases or 0 controls, check the missing values of the case and controls in those sets. If the variable with missing values is not needed, leaving it out of the analysis brings those sets back.
Step 4: collinearity
Tick Collinearity statistics in Assumption Checks:
| VIF | Tolerance | |
|---|---|---|
| coffee | 1.238 | 0.808 |
| smoking | 1.239 | 0.807 |
| active | 1.002 | 0.998 |
coffee and smoking are correlated, which is the confounding seen above, but their VIFs are far from the values (5 or 10) usually taken as a warning. smoking has two coefficients, so its VIF is the generalised VIF of the factor as a whole.