Code
library(tidyverse)
library(nnet)
library(epiDisplay)
library(lmtest)
library(gt)Tzu-Yao Lin
September 18, 2024
September 1, 2026
This page documents analyses conducted during the preparation of a collaborative study of coffee consumption, polygenic risk score, and diabetes using data from The Maastricht Study. It is retained as a public record of the analytical workflow and is not intended as a complete tutorial or as the definitive report of the study.
The final methods, results, and interpretations are reported in Rao et al. (2025), Interaction between coffee consumption and polygenic risk score in relation to diabetes: insights from the Maastricht study.
This record arose while checking and developing the statistical analyses for a collaborative cross-sectional study using data from The Maastricht Study. The outcome distinguished participants with normal glucose metabolism (NGM), prediabetes, and type 2 diabetes mellitus (T2DM). The main exposures were habitual coffee consumption and a polygenic risk score (PRS) for T2DM.
The scientific questions were whether coffee consumption and PRS were separately associated with the prevalence of prediabetes and T2DM, and whether the association between PRS and glucose-metabolism status differed across levels of coffee consumption. Because these analyses use cross-sectional observational data, the estimates describe associations with prevalent glucose-metabolism categories; they do not by themselves establish causal or preventive effects.
The working analysis focused on five practical questions that arose during manuscript preparation:
This page concentrates on these model-development questions and the construction of working result tables. It does not document every analysis reported in the published article. In particular, the published study also reports dose-response and sensitivity analyses that are outside the scope of this record. Some sections below preserve working questions, intermediate comparisons, and decisions that differ from the final publication.
The participant-level dataset used for this analysis is restricted and is not distributed with this public website repository. The file contains individual-level health, demographic, behavioral, medication, socioeconomic, and polygenic-risk variables. Whether any subset may be shared depends on the original consent, data-use agreement, ethics approval, and applicable institutional requirements; repository publication should not be assumed to be permitted.
For local reproduction by an authorized researcher, the dataset must be stored outside the repository and supplied through the CDP_DATA_PATH environment variable. The analysis rejects paths inside the website project. Public outputs should contain aggregate summaries and model results rather than participant-level records.
The restricted dataset used below was supplied as a preprocessed analysis file through CDP_DATA_PATH.
data_path <- Sys.getenv("CDP_DATA_PATH")
if (!nzchar(data_path)) {
stop("Set CDP_DATA_PATH to the restricted dataset outside this project.")
}
data_path <- normalizePath(data_path, mustWork = TRUE)
project_dir <- Sys.getenv(
"QUARTO_PROJECT_DIR",
unset = normalizePath("../..", mustWork = TRUE)
)
project_dir <- normalizePath(project_dir, mustWork = TRUE)
if (
identical(data_path, project_dir) ||
startsWith(data_path, paste0(project_dir, .Platform$file.sep))
) {
stop("CDP_DATA_PATH must point outside the public website project.")
}
analysis_variables <- c(
"N_Diabetes_WHO", "N_DIABETES_2b", "PRS_tertiles",
"coffee_tertiles", "SEX", "Age", "bmi", "NIT_alcoholtot",
"smoking_3cat", "mean_step_min_wake_T", "DHD_sum", "NIT_kcal",
"N_CVD", "Tot_chol", "N_OMAP", "med_HT", "med_LP",
"FIT_suikerg", "B1_VD1_2.6.29", "N_Education_3cat"
)
data <- read_csv(
data_path,
na = c("", "NA", "-999", "-888"),
col_select = all_of(analysis_variables)
)Only variables needed for the working analyses below are loaded. Public outputs should contain aggregate summaries and model results rather than participant-level records.
The variables required for the candidate outcome, exposure, and covariate specifications are then recoded for analysis.
diabetes_with_na <- data |>
mutate(Diabetes = factor(N_Diabetes_WHO, labels = c("NGM", "Pre", "T2DM"), ordered = TRUE),
IsDiabetes = factor(N_DIABETES_2b),
PRS = factor(PRS_tertiles, labels = c("Low", "Medium", "High")),
Coffee = factor(coffee_tertiles, labels = c("Low", "Medium", "High")),
Sex = factor(SEX, labels = c("Male", "Female")),
Age = Age,
BMI = bmi,
Alcohol = NIT_alcoholtot,
Smoking = factor(smoking_3cat, labels = c("Never", "Former", "Current")),
Step_wake = mean_step_min_wake_T,
DHD = DHD_sum,
KCal = NIT_kcal,
CVD = factor(N_CVD, labels = c("No", "Yes")),
Chol = Tot_chol,
# HT = factor(N_HT, labels = c("No", "Yes")),
OMAP = N_OMAP,
Med_HT = factor(med_HT, labels = c("No", "Yes")),
Med_LP = factor(med_LP, labels = c("No", "Yes")),
Sugar = FIT_suikerg,
B1_VD1 = factor(B1_VD1_2.6.29, labels = c("Yes", "No", "Unknow")),
Education = factor(N_Education_3cat, labels = c("Low", "Medium", "High")),
.keep = "none")
skimr::skim(diabetes_with_na)| Name | diabetes_with_na |
| Number of rows | 7668 |
| Number of columns | 20 |
| _______________________ | |
| Column type frequency: | |
| factor | 11 |
| numeric | 9 |
| ________________________ | |
| Group variables | None |
Variable type: factor
| skim_variable | n_missing | complete_rate | ordered | n_unique | top_counts |
|---|---|---|---|---|---|
| Diabetes | 0 | 1.00 | TRUE | 3 | NGM: 4868, T2D: 1641, Pre: 1159 |
| IsDiabetes | 0 | 1.00 | FALSE | 2 | 0: 6027, 1: 1641 |
| PRS | 0 | 1.00 | FALSE | 3 | Med: 2561, Low: 2556, Hig: 2551 |
| Coffee | 0 | 1.00 | FALSE | 3 | Low: 2949, Med: 2369, Hig: 2350 |
| Sex | 0 | 1.00 | FALSE | 2 | Fem: 3858, Mal: 3810 |
| Smoking | 56 | 0.99 | FALSE | 3 | For: 3764, Nev: 2911, Cur: 937 |
| CVD | 86 | 0.99 | FALSE | 2 | No: 6342, Yes: 1240 |
| Med_HT | 7 | 1.00 | FALSE | 2 | No: 4904, Yes: 2757 |
| Med_LP | 7 | 1.00 | FALSE | 2 | No: 5390, Yes: 2271 |
| B1_VD1 | 97 | 0.99 | FALSE | 3 | No: 4082, Yes: 2417, Unk: 1072 |
| Education | 100 | 0.99 | FALSE | 3 | Hig: 2984, Low: 2511, Med: 2073 |
Variable type: numeric
| skim_variable | n_missing | complete_rate | mean | sd | p0 | p25 | p50 | p75 | p100 | hist |
|---|---|---|---|---|---|---|---|---|---|---|
| Age | 0 | 1.00 | 59.93 | 8.64 | 39.00 | 54.00 | 61.00 | 67.00 | 79.00 | ▃▅▇▇▂ |
| BMI | 2 | 1.00 | 26.80 | 4.41 | 14.40 | 23.80 | 26.20 | 29.10 | 56.30 | ▂▇▂▁▁ |
| Alcohol | 0 | 1.00 | 11.82 | 13.35 | 0.00 | 1.60 | 8.10 | 18.01 | 197.53 | ▇▁▁▁▁ |
| Step_wake | 1295 | 0.83 | 118.91 | 40.26 | 5.14 | 90.72 | 116.32 | 144.69 | 314.36 | ▁▇▅▁▁ |
| DHD | 0 | 1.00 | 84.02 | 15.26 | 10.76 | 73.60 | 84.30 | 94.91 | 131.17 | ▁▁▇▇▁ |
| KCal | 0 | 1.00 | 2121.23 | 603.92 | 594.18 | 1691.53 | 2048.51 | 2491.85 | 4178.56 | ▁▇▇▂▁ |
| Chol | 1 | 1.00 | 5.22 | 1.10 | 2.10 | 4.40 | 5.20 | 6.00 | 10.40 | ▂▇▆▁▁ |
| OMAP | 5 | 1.00 | 94.70 | 11.38 | 61.00 | 87.00 | 94.00 | 102.00 | 145.00 | ▁▇▇▁▁ |
| Sugar | 0 | 1.00 | 2.62 | 7.22 | 0.00 | 0.00 | 0.00 | 2.15 | 120.00 | ▇▁▁▁▁ |
Missingness was not evenly distributed across the selected variables. In particular, Step_wake had more than 1,000 missing observations, so requiring complete data on all 20 variables substantially reduced the analysis sample.
# A tibble: 1 × 2
complete_cases excluded_rows
<int> <int>
1 6224 1444
At this stage of the analysis, the treatment of missing observations in the source preprocessing was not fully documented. For the model comparisons below, I constructed one complete-case dataset by excluding any participant with NA, -999, or -888 on at least one of the 20 selected variables.
Using a common analysis sample ensured that differences in AIC or likelihood-ratio tests across the candidate models were not caused by fitting the models to different sets of participants. This produced a working sample of 6,224 complete cases after excluding 1,444 rows. By comparison, the published article reports an included study sample of 7,668 and labels its main association table as \(n = 7{,}668\). This record does not establish how the difference between that reporting and the complete-case workflow shown here was resolved.
Complete-case analysis was a working decision for comparability, not a general recommendation that it is optimal. The substantial missingness in Step_wake may affect precision and the population represented by the fitted models, and this page does not include a missing-data sensitivity analysis.
The following questions were recorded before the manuscript decisions were finalized:
What was the substantive reason for categorizing PRS and coffee consumption into low, medium, and high groups rather than retaining continuous measures? If tertiles were retained, should an additional trend or dose-response analysis be reported?
What interpretive advantage did tertiles provide, and how should their simpler presentation be weighed against the loss of information caused by categorization?
The published study subsequently described both variables as study-population tertiles and additionally examined coffee consumption using a continuous dose-response analysis. The final article should therefore be used for the definitive rationale and specification.
The outcome categories—NGM, prediabetes, and T2DM—have a clinical ordering, so an ordinal logistic model was considered first. A proportional-odds model assumes that each predictor has the same coefficient across the cumulative comparisons induced by the ordered outcome. This restriction was checked using the Brant test.
----------------------------------------------------
Test for X2 df probability
----------------------------------------------------
Omnibus 208.92 23 0
PRSMedium 4.41 1 0.04
PRSHigh 6.4 1 0.01
CoffeeMedium 0.86 1 0.36
CoffeeHigh 0.25 1 0.62
Age 6.87 1 0.01
SexFemale 7.62 1 0.01
BMI 0.21 1 0.65
Alcohol 5.78 1 0.02
SmokingFormer 0.58 1 0.45
SmokingCurrent 1.04 1 0.31
Step_wake 5.9 1 0.02
DHD 1.88 1 0.17
KCal 0.95 1 0.33
CVDYes 1.21 1 0.27
Chol 57.18 1 0
OMAP 0.24 1 0.62
Med_HTYes 0.4 1 0.53
Med_LPYes 4.93 1 0.03
Sugar 9.85 1 0
B1_VD1No 29.36 1 0
B1_VD1Unknow 4.06 1 0.04
EducationMedium 0.96 1 0.33
EducationHigh 0.52 1 0.47
----------------------------------------------------
H0: Parallel Regression Assumption holds
The omnibus Brant test rejected the proportional-odds assumption for this model (\(\chi^2 = 208.92\), \(df = 23\), \(p < .001\)). Several predictor-specific tests also indicated nonproportionality. The proportional-odds specification was therefore not retained for the working analyses below.
At this stage, a baseline-category multinomial logistic model was adopted with NGM as the reference outcome. This allowed the association of each predictor with prediabetes versus NGM to differ from its association with T2DM versus NGM.
For outcome category \(j \in \{\text{Pre}, \text{T2DM}\}\), the baseline-category logit can be written as
\[ \eta_j(\mathbf{x}) = \log\left(\frac{p_j}{p_{\text{NGM}}}\right) = \alpha_j + \mathbf{x}^{\mathsf T}\boldsymbol{\beta}_j, \]
where \(\mathbf{x}\) contains the exposure indicators and covariates included in a given candidate model. Each outcome contrast therefore has its own coefficient vector.
Separate binary models and one multinomial model were compared as an implementation check. The candidate exposure and covariate specifications discussed during manuscript preparation are summarized below.
| Exposure | Covariate set 1 | Covariate set 2 | Covariate set 3 |
|---|---|---|---|
| PRS | prs1 | prs2 | prs3 |
| Coffee | cof1 | cof2 | cof3 |
| PRS + Coffee | prs_cof1 | prs_cof2 | prs_cof3 |
| PRS + Coffee + PRS \(\times\) Coffee | prs_cof_i1 | prs_cof_i2 | prs_cof_i3 |
## PRS-only candidate models
prs1 <- formula(Diabetes ~ PRS + Age + Sex)
prs2 <- update(prs1, . ~ . + BMI + Alcohol + Smoking + Step_wake + DHD + KCal)
prs3 <- update(prs2, . ~ . + CVD + Chol + OMAP + Med_HT + Med_LP + Sugar + B1_VD1 + Education)
## Coffee-only candidate models
cof1 <- update(prs1, . ~ Coffee - PRS + .)
cof2 <- update(prs2, . ~ Coffee - PRS + .)
cof3 <- update(prs3, . ~ Coffee - PRS + .)
## Joint main-effects and interaction candidate models
prs_cof1 <- update(prs1, . ~ Coffee + .)
prs_cof2 <- update(prs2, . ~ Coffee + .)
prs_cof3 <- update(prs3, . ~ Coffee + .)
prs_cof_i1 <- update(prs_cof1, . ~ PRS:Coffee + .)
prs_cof_i2 <- update(prs_cof2, . ~ PRS:Coffee + .)
prs_cof_i3 <- update(prs_cof3, . ~ PRS:Coffee + .)[1] 4889 20
NGM Pre T2DM
3944 945 0
Call:
glm(formula = prs3, family = binomial(link = "logit"), data = prediabetes)
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -8.004e+00 7.002e-01 -11.432 < 2e-16 ***
PRSMedium 3.017e-01 9.634e-02 3.131 0.001740 **
PRSHigh 4.352e-01 9.676e-02 4.498 6.85e-06 ***
Age 4.734e-02 5.518e-03 8.579 < 2e-16 ***
SexFemale -2.683e-01 9.477e-02 -2.831 0.004642 **
BMI 1.116e-01 1.070e-02 10.425 < 2e-16 ***
Alcohol 2.683e-03 3.236e-03 0.829 0.407153
SmokingFormer 9.964e-02 8.678e-02 1.148 0.250907
SmokingCurrent -4.150e-02 1.396e-01 -0.297 0.766183
Step_wake -1.806e-03 1.065e-03 -1.696 0.089835 .
DHD -9.282e-03 2.966e-03 -3.129 0.001752 **
KCal -1.092e-04 7.306e-05 -1.495 0.135044
CVDYes -1.994e-01 1.157e-01 -1.722 0.085002 .
Chol 9.577e-02 4.290e-02 2.232 0.025597 *
OMAP 1.457e-02 3.767e-03 3.869 0.000109 ***
Med_HTYes 4.078e-01 9.238e-02 4.414 1.01e-05 ***
Med_LPYes 6.212e-01 1.076e-01 5.774 7.75e-09 ***
Sugar -3.767e-03 5.763e-03 -0.654 0.513348
B1_VD1No -5.004e-01 9.011e-02 -5.553 2.80e-08 ***
B1_VD1Unknow -3.051e-01 1.245e-01 -2.450 0.014305 *
EducationMedium -2.258e-02 1.053e-01 -0.214 0.830219
EducationHigh -6.935e-02 9.790e-02 -0.708 0.478690
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 4800.6 on 4888 degrees of freedom
Residual deviance: 4151.3 on 4867 degrees of freedom
AIC: 4195.3
Number of Fisher Scoring iterations: 5
Logistic regression predicting Diabetes
crude OR(95%CI) adj. OR(95%CI)
PRS: ref.=Low
Medium 1.36 (1.14,1.62) 1.35 (1.12,1.63)
High 1.58 (1.33,1.89) 1.55 (1.28,1.87)
Age (cont. var.) 1.06 (1.06,1.07) 1.05 (1.04,1.06)
Sex: Female vs Male 0.62 (0.54,0.72) 0.76 (0.64,0.92)
BMI (cont. var.) 1.16 (1.14,1.18) 1.12 (1.09,1.14)
Alcohol (cont. var.) 1.0125 (1.0073,1.0176) 1.0027 (0.9963,1.0091)
Smoking: ref.=Never
Former 1.52 (1.3,1.77) 1.1 (0.93,1.31)
Current 1.17 (0.92,1.5) 0.96 (0.73,1.26)
Step_wake (cont. var.) 0.9939 (0.992,0.9958) 0.9982 (0.9961,1.0003)
DHD (cont. var.) 0.9869 (0.9824,0.9915) 0.9908 (0.985,0.9965)
KCal (cont. var.) 1 (0.9998,1.0001) 0.9999 (0.9997,1)
CVD: Yes vs No 1.53 (1.27,1.86) 0.82 (0.65,1.03)
Chol (cont. var.) 0.93 (0.86,0.99) 1.1 (1.01,1.2)
OMAP (cont. var.) 1.03 (1.03,1.04) 1.01 (1.01,1.02)
Med_HT: Yes vs No 2.99 (2.58,3.47) 1.5 (1.25,1.8)
Med_LP: Yes vs No 2.92 (2.49,3.43) 1.86 (1.51,2.3)
Sugar (cont. var.) 0.9994 (0.9893,1.0096) 0.9962 (0.985,1.0076)
B1_VD1: ref.=Yes
No 0.6 (0.51,0.7) 0.61 (0.51,0.72)
Unknow 0.78 (0.62,0.97) 0.74 (0.58,0.94)
Education: ref.=Low
Medium 0.62 (0.51,0.74) 0.98 (0.8,1.2)
High 0.58 (0.49,0.68) 0.93 (0.77,1.13)
P(Wald's test) P(LR-test)
PRS: ref.=Low < 0.001
Medium 0.002
High < 0.001
Age (cont. var.) < 0.001 < 0.001
Sex: Female vs Male 0.005 0.005
BMI (cont. var.) < 0.001 < 0.001
Alcohol (cont. var.) 0.407 0.409
Smoking: ref.=Never 0.377
Former 0.251
Current 0.766
Step_wake (cont. var.) 0.09 0.089
DHD (cont. var.) 0.002 0.002
KCal (cont. var.) 0.135 0.134
CVD: Yes vs No 0.085 0.082
Chol (cont. var.) 0.026 0.026
OMAP (cont. var.) < 0.001 < 0.001
Med_HT: Yes vs No < 0.001 < 0.001
Med_LP: Yes vs No < 0.001 < 0.001
Sugar (cont. var.) 0.513 0.51
B1_VD1: ref.=Yes < 0.001
No < 0.001
Unknow 0.014
Education: ref.=Low 0.768
Medium 0.83
High 0.479
Log-likelihood = -2075.635
No. of observations = 4889
AIC value = 4195.2701
[1] 5279 20
NGM Pre T2DM
3944 0 1335
Call:
glm(formula = prs3, family = binomial(link = "logit"), data = t2dm)
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -7.540e+00 8.516e-01 -8.854 < 2e-16 ***
PRSMedium 8.101e-01 1.240e-01 6.531 6.53e-11 ***
PRSHigh 1.198e+00 1.215e-01 9.860 < 2e-16 ***
Age 5.366e-02 6.552e-03 8.189 2.63e-16 ***
SexFemale -8.024e-01 1.156e-01 -6.942 3.87e-12 ***
BMI 1.741e-01 1.239e-02 14.055 < 2e-16 ***
Alcohol -7.559e-03 3.878e-03 -1.949 0.051299 .
SmokingFormer 1.074e-01 1.051e-01 1.022 0.306925
SmokingCurrent 3.982e-01 1.571e-01 2.534 0.011270 *
Step_wake -6.260e-03 1.294e-03 -4.836 1.33e-06 ***
DHD -1.135e-02 3.545e-03 -3.202 0.001363 **
KCal -7.423e-05 8.491e-05 -0.874 0.382003
CVDYes -4.544e-01 1.250e-01 -3.636 0.000277 ***
Chol -4.487e-01 5.425e-02 -8.270 < 2e-16 ***
OMAP 2.329e-02 4.630e-03 5.030 4.90e-07 ***
Med_HTYes 7.470e-01 1.046e-01 7.141 9.28e-13 ***
Med_LPYes 1.473e+00 1.128e-01 13.058 < 2e-16 ***
Sugar -4.791e-02 8.685e-03 -5.516 3.47e-08 ***
B1_VD1No -1.620e+00 1.055e-01 -15.353 < 2e-16 ***
B1_VD1Unknow -1.023e+00 1.399e-01 -7.317 2.54e-13 ***
EducationMedium -1.917e-02 1.203e-01 -0.159 0.873423
EducationHigh -2.835e-01 1.187e-01 -2.388 0.016922 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 5970.4 on 5278 degrees of freedom
Residual deviance: 3007.7 on 5257 degrees of freedom
AIC: 3051.7
Number of Fisher Scoring iterations: 6
Logistic regression predicting Diabetes
crude OR(95%CI) adj. OR(95%CI)
PRS: ref.=Low
Medium 2.41 (2.02,2.86) 2.25 (1.76,2.87)
High 3.49 (2.95,4.12) 3.31 (2.61,4.2)
Age (cont. var.) 1.08 (1.07,1.09) 1.06 (1.04,1.07)
Sex: Female vs Male 0.34 (0.3,0.38) 0.45 (0.36,0.56)
BMI (cont. var.) 1.28 (1.26,1.31) 1.19 (1.16,1.22)
Alcohol (cont. var.) 0.9985 (0.9936,1.0033) 0.9925 (0.985,1)
Smoking: ref.=Never
Former 1.72 (1.49,1.97) 1.11 (0.91,1.37)
Current 1.68 (1.37,2.05) 1.49 (1.09,2.03)
Step_wake (cont. var.) 0.9836 (0.9818,0.9854) 0.9938 (0.9912,0.9963)
DHD (cont. var.) 0.98 (0.97,0.98) 0.99 (0.98,1)
KCal (cont. var.) 0.9999 (0.9998,1) 0.9999 (0.9998,1.0001)
CVD: Yes vs No 2.71 (2.33,3.16) 0.63 (0.5,0.81)
Chol (cont. var.) 0.35 (0.33,0.38) 0.64 (0.57,0.71)
OMAP (cont. var.) 1.05 (1.04,1.05) 1.02 (1.01,1.03)
Med_HT: Yes vs No 8.82 (7.67,10.15) 2.11 (1.72,2.59)
Med_LP: Yes vs No 14.31 (12.35,16.59) 4.36 (3.5,5.44)
Sugar (cont. var.) 0.97 (0.95,0.98) 0.95 (0.94,0.97)
B1_VD1: ref.=Yes
No 0.19 (0.16,0.22) 0.2 (0.16,0.24)
Unknow 0.41 (0.34,0.5) 0.36 (0.27,0.47)
Education: ref.=Low
Medium 0.57 (0.49,0.67) 0.98 (0.77,1.24)
High 0.36 (0.31,0.42) 0.75 (0.6,0.95)
P(Wald's test) P(LR-test)
PRS: ref.=Low < 0.001
Medium < 0.001
High < 0.001
Age (cont. var.) < 0.001 < 0.001
Sex: Female vs Male < 0.001 < 0.001
BMI (cont. var.) < 0.001 < 0.001
Alcohol (cont. var.) 0.051 0.05
Smoking: ref.=Never 0.041
Former 0.307
Current 0.011
Step_wake (cont. var.) < 0.001 < 0.001
DHD (cont. var.) 0.001 0.001
KCal (cont. var.) 0.382 0.382
CVD: Yes vs No < 0.001 < 0.001
Chol (cont. var.) < 0.001 < 0.001
OMAP (cont. var.) < 0.001 < 0.001
Med_HT: Yes vs No < 0.001 < 0.001
Med_LP: Yes vs No < 0.001 < 0.001
Sugar (cont. var.) < 0.001 < 0.001
B1_VD1: ref.=Yes < 0.001
No < 0.001
Unknow < 0.001
Education: ref.=Low 0.03
Medium 0.873
High 0.017
Log-likelihood = -1503.8424
No. of observations = 5279
AIC value = 3051.6849
# weights: 69 (44 variable)
initial value 6837.762885
iter 10 value 5215.529946
iter 20 value 4639.168406
iter 30 value 4273.319863
iter 40 value 4017.408486
iter 50 value 3983.845642
final value 3983.621664
converged
Call:
multinom(formula = prs3, data = diabetes)
Coefficients:
(Intercept) PRSMedium PRSHigh Age SexFemale BMI
Pre -7.993443 0.3048323 0.4590396 0.04691694 -0.269743 0.1105872
T2DM -7.530014 0.8205179 1.1457251 0.04937704 -0.845876 0.1727318
Alcohol SmokingFormer SmokingCurrent Step_wake DHD
Pre 0.003132189 0.1205212 0.03541554 -0.001591920 -0.008673513
T2DM -0.008483711 0.1014127 0.28413325 -0.007081803 -0.008881605
KCal CVDYes Chol OMAP Med_HTYes Med_LPYes
Pre -1.252987e-04 -0.2092194 0.09181539 0.01470355 0.4051368 0.647377
T2DM -8.870268e-05 -0.5104388 -0.41867134 0.02422280 0.7199281 1.508455
Sugar B1_VD1No B1_VD1Unknow EducationMedium EducationHigh
Pre -0.004413489 -0.4966035 -0.3253156 -0.06624586 -0.107326
T2DM -0.044371036 -1.6066637 -0.9962776 0.04357004 -0.277215
Std. Errors:
(Intercept) PRSMedium PRSHigh Age SexFemale BMI
Pre 0.005541274 0.08199097 0.08180552 0.004718533 0.08838194 0.009288211
T2DM 0.004586410 0.06104669 0.06058859 0.005198003 0.09790667 0.010027835
Alcohol SmokingFormer SmokingCurrent Step_wake DHD
Pre 0.003071018 0.07749479 0.09140973 0.001011571 0.002726991
T2DM 0.003585977 0.08396675 0.07539267 0.001174780 0.003033971
KCal CVDYes Chol OMAP Med_HTYes Med_LPYes
Pre 6.883390e-05 0.07184194 0.03926264 0.003353974 0.07653429 0.07178370
T2DM 7.598204e-05 0.06452109 0.04711608 0.003757188 0.07818381 0.06507821
Sugar B1_VD1No B1_VD1Unknow EducationMedium EducationHigh
Pre 0.005542964 0.0740401 0.08135444 0.07884324 0.07481118
T2DM 0.008251040 0.0811196 0.07534407 0.07216372 0.07256924
Residual Deviance: 7967.243
AIC: 8055.243
Outcome =Diabetes; Referent group = NGM
Pre T2DM
Coeff./SE RRR(95%CI) Coeff./SE RRR(95%CI)
(Intercept) -7.99/0.006NA - -7.53/0.005NA -
PRSMedium 0.3/0.082*** 1.36(1.16,1.59) 0.82/0.061*** 2.27(2.02,2.56)
PRSHigh 0.46/0.082*** 1.58(1.35,1.86) 1.15/0.061*** 3.14(2.79,3.54)
Age 0.05/0.005*** 1.05(1.04,1.06) 0.05/0.005*** 1.05(1.04,1.06)
SexFemale -0.27/0.088** 0.76(0.64,0.91) -0.85/0.098*** 0.43(0.35,0.52)
BMI 0.11/0.009*** 1.12(1.1,1.14) 0.17/0.01*** 1.19(1.17,1.21)
Alcohol 0/0.003 1(1,1.01) -0.01/0.004* 0.99(0.98,1)
SmokingFormer 0.12/0.077 1.13(0.97,1.31) 0.1/0.084 1.11(0.94,1.3)
SmokingCurrent 0.04/0.091 1.04(0.87,1.24) 0.28/0.075*** 1.33(1.15,1.54)
Step_wake 0/0.001 1(1,1) -0.01/0.001*** 0.99(0.99,1)
DHD -0.01/0.003** 0.99(0.99,1) -0.01/0.003** 0.99(0.99,1)
KCal 0/0 1(1,1) 0/0 1(1,1)
CVDYes -0.21/0.072** 0.81(0.7,0.93) -0.51/0.065*** 0.6(0.53,0.68)
Chol 0.09/0.039* 1.1(1.01,1.18) -0.42/0.047*** 0.66(0.6,0.72)
OMAP 0.01/0.003*** 1.01(1.01,1.02) 0.02/0.004*** 1.02(1.02,1.03)
Med_HTYes 0.41/0.077*** 1.5(1.29,1.74) 0.72/0.078*** 2.05(1.76,2.39)
Med_LPYes 0.65/0.072*** 1.91(1.66,2.2) 1.51/0.065*** 4.52(3.98,5.13)
Sugar 0/0.006 1(0.98,1.01) -0.04/0.008*** 0.96(0.94,0.97)
B1_VD1No -0.5/0.074*** 0.61(0.53,0.7) -1.61/0.081*** 0.2(0.17,0.24)
B1_VD1Unknow -0.33/0.081*** 0.72(0.62,0.85) -1/0.075*** 0.37(0.32,0.43)
EducationMedium -0.07/0.079 0.94(0.8,1.09) 0.04/0.072 1.04(0.91,1.2)
EducationHigh -0.11/0.075 0.9(0.78,1.04) -0.28/0.073*** 0.76(0.66,0.87)
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual Deviance: 7967.24
AIC = 8055.24
In this dataset, the estimated PRS associations from the multinomial model were similar to those obtained from the two separate binary models. This was a descriptive implementation check and does not establish that the approaches are generally equivalent. The binary models use different outcome-specific subsets, whereas the multinomial model represents all three outcome categories within one model. The subsequent working tables therefore use the multinomial implementation.
# weights: 18 (10 variable)
initial value 6837.762885
iter 10 value 5404.157593
final value 5164.014496
converged
# weights: 39 (24 variable)
initial value 6837.762885
iter 10 value 5290.331013
iter 20 value 4842.276842
iter 30 value 4605.592708
final value 4605.590003
converged
Likelihood ratio test
Model 1: Diabetes ~ PRS + Age + Sex
Model 2: Diabetes ~ PRS + Age + Sex + BMI + Alcohol + Smoking + Step_wake +
DHD + KCal
Model 3: Diabetes ~ PRS + Age + Sex + BMI + Alcohol + Smoking + Step_wake +
DHD + KCal + CVD + Chol + OMAP + Med_HT + Med_LP + Sugar +
B1_VD1 + Education
#Df LogLik Df Chisq Pr(>Chisq)
1 10 -5164.0
2 24 -4605.6 14 1116.8 < 2.2e-16 ***
3 44 -3983.6 20 1243.9 < 2.2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
get_OR_CI <- function(multi_model, DV_level, EV_level, alpha = 0.05) {
esti <- coef(multi_model)[DV_level, , drop = FALSE]
.cov_mat <- vcov(multi_model)
.select_variable <- str_detect(colnames(.cov_mat), DV_level)
cov_mat <- .cov_mat[.select_variable, .select_variable]
cont <- matrix(multi_model$coefnames %in% EV_level, nrow = 1)
l <- cont %*% t(esti)
OR <- exp(l) |> round(2)
SE <- sqrt(cont %*% cov_mat %*% t(cont))
lower_CI <- exp(l - qnorm(1-alpha/2) * SE) |> round(2)
upper_CI <- exp(l + qnorm(1-alpha/2) * SE) |> round(2)
str_glue("{OR} <br> ({lower_CI}, {upper_CI})")
}levels <- c("Low", "Medium", "High")
PRSlevels <- str_glue("PRS{levels}")
prs_OR_table <- tibble(
level = levels ,
Pre_prs1 = map_chr(PRSlevels, ~ get_OR_CI(prs1_ml, "Pre", .)),
Pre_prs2 = map_chr(PRSlevels, ~ get_OR_CI(prs2_ml, "Pre", .)),
Pre_prs3 = map_chr(PRSlevels, ~ get_OR_CI(prs3_ml, "Pre", .)),
T2DM_prs1 = map_chr(PRSlevels, ~ get_OR_CI(prs1_ml, "T2DM", .)),
T2DM_prs2 = map_chr(PRSlevels, ~ get_OR_CI(prs2_ml, "T2DM", .)),
T2DM_prs3 = map_chr(PRSlevels, ~ get_OR_CI(prs3_ml, "T2DM", .)))
gt(prs_OR_table, rowname_col = "level") |>
tab_stubhead(label = "PRS") |>
tab_spanner(label = "Pre", columns = starts_with("Pre")) |>
tab_spanner(label = "T2DM", columns = starts_with("T2DM")) |>
cols_label(ends_with("1") ~ "M1",
ends_with("2") ~ "M2",
ends_with("3") ~ "M3") |>
fmt_markdown()| PRS |
Pre
|
T2DM
|
||||
|---|---|---|---|---|---|---|
| M1 | M2 | M3 | M1 | M2 | M3 | |
| Low | 1 (1, 1) |
1 (1, 1) |
1 (1, 1) |
1 (1, 1) |
1 (1, 1) |
1 (1, 1) |
| Medium | 1.38 (1.15, 1.65) |
1.4 (1.21, 1.62) |
1.36 (1.16, 1.59) |
2.45 (2.05, 2.94) |
2.54 (2.26, 2.86) |
2.27 (2.02, 2.56) |
| High | 1.66 (1.39, 1.99) |
1.74 (1.5, 2.01) |
1.58 (1.35, 1.86) |
3.76 (3.16, 4.49) |
4.18 (3.72, 4.7) |
3.14 (2.79, 3.54) |
# weights: 24 (14 variable)
initial value 6837.762885
iter 10 value 5398.637887
iter 20 value 5159.349831
final value 5159.349135
converged
# weights: 45 (28 variable)
initial value 6837.762885
iter 10 value 5290.261102
iter 20 value 4845.902793
iter 30 value 4641.391553
final value 4601.460847
converged
# weights: 75 (48 variable)
initial value 6837.762885
iter 10 value 5215.456459
iter 20 value 4635.906609
iter 30 value 4251.564367
iter 40 value 4014.806998
iter 50 value 3985.463039
final value 3978.814138
converged
Coflevels <- str_glue("Coffee{levels}")
cof_OR_table <- tibble(
level = levels ,
Pre_cof1 = map_chr(Coflevels, ~ get_OR_CI(cof1_ml, "Pre", .)),
Pre_cof2 = map_chr(Coflevels, ~ get_OR_CI(cof2_ml, "Pre", .)),
Pre_cof3 = map_chr(Coflevels, ~ get_OR_CI(cof3_ml, "Pre", .)),
T2DM_cof1 = map_chr(Coflevels, ~ get_OR_CI(cof1_ml, "T2DM", .)),
T2DM_cof2 = map_chr(Coflevels, ~ get_OR_CI(cof2_ml, "T2DM", .)),
T2DM_cof3 = map_chr(Coflevels, ~ get_OR_CI(cof3_ml, "T2DM", .)))
gt(cof_OR_table, rowname_col = "level") |>
tab_stubhead(label = "Coffee") |>
tab_spanner(label = "Pre", columns = starts_with("Pre")) |>
tab_spanner(label = "T2DM", columns = starts_with("T2DM")) |>
cols_label(ends_with("1") ~ "M1",
ends_with("2") ~ "M2",
ends_with("3") ~ "M3") |>
fmt_markdown()| Coffee |
Pre
|
T2DM
|
||||
|---|---|---|---|---|---|---|
| M1 | M2 | M3 | M1 | M2 | M3 | |
| Low | 1 (1, 1) |
1 (1, 1) |
1 (1, 1) |
1 (1, 1) |
1 (1, 1) |
1 (1, 1) |
| Medium | 0.81 (0.68, 0.97) |
0.8 (0.7, 0.92) |
0.8 (0.69, 0.92) |
0.82 (0.7, 0.97) |
0.83 (0.73, 0.94) |
0.8 (0.7, 0.91) |
| High | 0.9 (0.75, 1.08) |
0.85 (0.74, 0.97) |
0.83 (0.72, 0.96) |
0.97 (0.82, 1.14) |
0.87 (0.76, 0.99) |
0.8 (0.7, 0.91) |
# weights: 24 (14 variable)
initial value 6837.762885
iter 10 value 5398.637887
iter 20 value 5159.349831
final value 5159.349135
converged
# weights: 36 (22 variable)
initial value 6837.762885
iter 10 value 5465.181242
iter 20 value 5199.344506
iter 30 value 5154.011791
iter 30 value 5154.011788
iter 30 value 5154.011788
final value 5154.011788
converged
Call:
multinom(formula = prs_cof1, data = diabetes)
Coefficients:
(Intercept) CoffeeMedium CoffeeHigh PRSMedium PRSHigh Age
Pre -5.127968 -0.2087765 -0.10369891 0.3228881 0.5081659 0.06163677
T2DM -5.901011 -0.1941127 -0.03432375 0.8988806 1.3236497 0.07414162
SexFemale
Pre -0.3943786
T2DM -1.0023219
Residual Deviance: 10318.7
AIC: 10346.7
Outcome =Diabetes; Referent group = NGM
Pre T2DM
Coeff./SE RRR(95%CI) Coeff./SE RRR(95%CI)
(Intercept) -5.13/0.305*** - -5.9/0.29*** -
CoffeeMedium -0.21/0.089* 0.81(0.68,0.97) -0.19/0.083* 0.82(0.7,0.97)
CoffeeHigh -0.1/0.091 0.9(0.75,1.08) -0.03/0.083 0.97(0.82,1.14)
PRSMedium 0.32/0.092*** 1.38(1.15,1.65) 0.9/0.092*** 2.46(2.05,2.94)
PRSHigh 0.51/0.091*** 1.66(1.39,1.99) 1.32/0.09*** 3.76(3.15,4.48)
Age 0.06/0.005*** 1.06(1.05,1.07) 0.07/0.004*** 1.08(1.07,1.09)
SexFemale -0.39/0.075*** 0.67(0.58,0.78) -1/0.071*** 0.37(0.32,0.42)
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual Deviance: 10318.7
AIC = 10346.7
Outcome =Diabetes; Referent group = NGM
Pre T2DM
Coeff./SE RRR(95%CI) Coeff./SE
(Intercept) -5.13/0.311*** - -5.75/0.297***
CoffeeMedium -0.31/0.159* 0.73(0.53,1) -0.5/0.174**
CoffeeHigh -0.01/0.158 0.99(0.72,1.34) -0.26/0.174
PRSMedium 0.28/0.148 1.32(0.99,1.76) 0.76/0.146***
PRSHigh 0.52/0.144*** 1.68(1.27,2.23) 1.06/0.142***
Age 0.06/0.005*** 1.06(1.05,1.07) 0.07/0.004***
SexFemale -0.39/0.075*** 0.67(0.58,0.78) -1/0.071***
CoffeeMedium:PRSMedium 0.14/0.221 1.16(0.75,1.78) 0.24/0.222
CoffeeHigh:PRSMedium 0/0.222 1(0.65,1.54) 0.23/0.222
CoffeeMedium:PRSHigh 0.19/0.219 1.21(0.79,1.86) 0.54/0.217*
CoffeeHigh:PRSHigh -0.24/0.221 0.79(0.51,1.21) 0.33/0.215
RRR(95%CI)
(Intercept) -
CoffeeMedium 0.61(0.43,0.85)
CoffeeHigh 0.77(0.55,1.08)
PRSMedium 2.13(1.6,2.84)
PRSHigh 2.88(2.18,3.8)
Age 1.08(1.07,1.09)
SexFemale 0.37(0.32,0.42)
CoffeeMedium:PRSMedium 1.27(0.82,1.97)
CoffeeHigh:PRSMedium 1.26(0.81,1.94)
CoffeeMedium:PRSHigh 1.71(1.12,2.61)
CoffeeHigh:PRSHigh 1.4(0.92,2.13)
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual Deviance: 10308.02
AIC = 10352.02
Likelihood ratio test
Model 1: Diabetes ~ Coffee + PRS + Age + Sex
Model 2: Diabetes ~ Coffee + PRS + Age + Sex + PRS:Coffee
#Df LogLik Df Chisq Pr(>Chisq)
1 14 -5159.3
2 22 -5154.0 8 10.675 0.2208
# weights: 45 (28 variable)
initial value 6837.762885
iter 10 value 5290.261102
iter 20 value 4845.902793
iter 30 value 4641.391553
final value 4601.460847
converged
# weights: 57 (36 variable)
initial value 6837.762885
iter 10 value 5289.996854
iter 20 value 4847.821699
iter 30 value 4690.907647
iter 40 value 4596.380913
final value 4595.158389
converged
Likelihood ratio test
Model 1: Diabetes ~ Coffee + PRS + Age + Sex + BMI + Alcohol + Smoking +
Step_wake + DHD + KCal
Model 2: Diabetes ~ Coffee + PRS + Age + Sex + BMI + Alcohol + Smoking +
Step_wake + DHD + KCal + PRS:Coffee
#Df LogLik Df Chisq Pr(>Chisq)
1 28 -4601.5
2 36 -4595.2 8 12.605 0.1262
# weights: 75 (48 variable)
initial value 6837.762885
iter 10 value 5215.456459
iter 20 value 4635.906609
iter 30 value 4251.564367
iter 40 value 4014.806998
iter 50 value 3985.463039
final value 3978.814138
converged
# weights: 87 (56 variable)
initial value 6837.762885
iter 10 value 5215.195654
iter 20 value 4636.177404
iter 30 value 4155.562209
iter 40 value 4066.224939
iter 50 value 3998.661572
iter 60 value 3975.634350
final value 3973.411479
converged
Likelihood ratio test
Model 1: Diabetes ~ Coffee + PRS + Age + Sex + BMI + Alcohol + Smoking +
Step_wake + DHD + KCal + CVD + Chol + OMAP + Med_HT + Med_LP +
Sugar + B1_VD1 + Education
Model 2: Diabetes ~ Coffee + PRS + Age + Sex + BMI + Alcohol + Smoking +
Step_wake + DHD + KCal + CVD + Chol + OMAP + Med_HT + Med_LP +
Sugar + B1_VD1 + Education + PRS:Coffee
#Df LogLik Df Chisq Pr(>Chisq)
1 48 -3978.8
2 56 -3973.4 8 10.805 0.213
For the candidate models shown above, the likelihood-ratio tests did not provide evidence that adding the categorical coffee-by-PRS interaction terms improved model fit. The corresponding main-effects models (prs_cof1, prs_cof2, and prs_cof3) were therefore retained for the working association tables. This decision should not be interpreted as proof that interaction is absent; the published article reports the final interaction analysis and its interpretation.
The next section reconstructs a working joint-category table considered during manuscript preparation. Model prs_cof1 includes categorical indicators for coffee consumption and PRS, with low coffee consumption and low PRS as the reference combination. For prediabetes versus NGM, its linear predictor is
\[ \ln\left(\frac{p_{\text{Pre}}}{p_{\text{NGM}}} \right) = \alpha_{11} + \beta_{11} \text{CoffeeMedium} + \beta_{12} \text{CoffeeHigh} + \beta_{13} \text{PRSMedium} + \beta_{14} \text{PRSHigh} + \gamma_{11} \text{Age} + \gamma_{12} \text{SexFemale} \]
For either outcome contrast \(j\), let \(\mathbf{c}_{c,p}\) select the coefficients needed to compare coffee category \(c\) and PRS category \(p\) with the low-coffee, low-PRS reference combination while holding covariates fixed. The estimated log odds ratio is
\[ \widehat{\ell}_{j,c,p} = \mathbf{c}_{c,p}^{\mathsf T}\widehat{\boldsymbol{\beta}}_j, \]
and the corresponding odds ratio is
\[ \widehat{\operatorname{OR}}_{j,c,p} = \exp\left(\widehat{\ell}_{j,c,p}\right). \]
Its estimated variance and 95% Wald confidence interval are
\[ \widehat{\operatorname{Var}}\left(\widehat{\ell}_{j,c,p}\right) = \mathbf{c}_{c,p}^{\mathsf T} \widehat{\operatorname{Var}}\left(\widehat{\boldsymbol{\beta}}_j\right) \mathbf{c}_{c,p}, \]
\[ 95\%\ \operatorname{CI} = \exp\left[ \widehat{\ell}_{j,c,p} \mathbin{\pm} z_{.975} \sqrt{\widehat{\operatorname{Var}}\left(\widehat{\ell}_{j,c,p}\right)} \right]. \]
For example, the medium-coffee, high-PRS contrast under this main-effects model is
\[ \widehat{\ell}_{j,M,H} = \widehat{\beta}_{j,\text{CoffeeMedium}} + \widehat{\beta}_{j,\text{PRSHigh}}, \]
so that
\[ \widehat{\operatorname{OR}}_{j,M,H} = \exp\left( \widehat{\beta}_{j,\text{CoffeeMedium}} + \widehat{\beta}_{j,\text{PRSHigh}} \right). \]
The variance of this sum includes both coefficient variances and twice their covariance. Because this working model contains no coffee-by-PRS interaction, effects combine additively on the log-odds scale and multiplicatively on the odds scale for each outcome contrast. This is a model-based association, not a causal effect.
PRSlevels = paste0("PRS", rep(levels, times = 3))
Coflevels = paste0("Coffee", rep(levels, each = 3))
prs_cof_OR_table <- tibble(
Cof_levels = rep(levels, each = 3),
PRS_levels = rep(levels, times = 3),
Pre_prs_cof1 = map2_chr(PRSlevels, Coflevels, ~ get_OR_CI(prs_cof1_ml, "Pre", c(.x, .y))),
Pre_prs_cof2 = map2_chr(PRSlevels, Coflevels, ~ get_OR_CI(prs_cof2_ml, "Pre", c(.x, .y))),
Pre_prs_cof3 = map2_chr(PRSlevels, Coflevels, ~ get_OR_CI(prs_cof3_ml, "Pre", c(.x, .y))),
T2DM_prs_cof1 = map2_chr(PRSlevels, Coflevels, ~ get_OR_CI(prs_cof1_ml, "T2DM", c(.x, .y))),
T2DM_prs_cof2 = map2_chr(PRSlevels, Coflevels, ~ get_OR_CI(prs_cof2_ml, "T2DM", c(.x, .y))),
T2DM_prs_cof3 = map2_chr(PRSlevels, Coflevels, ~ get_OR_CI(prs_cof3_ml, "T2DM", c(.x, .y))))
gt(prs_cof_OR_table,
rowname_col = "PRS_levels",
groupname_col = "Cof_levels",
row_group_as_column = TRUE) |>
tab_stubhead(label = c("Coffee", "PRS")) |>
tab_spanner(label = "Pre", columns = starts_with("Pre")) |>
tab_spanner(label = "T2DM", columns = starts_with("T2DM")) |>
cols_label(ends_with("1") ~ "M1",
ends_with("2") ~ "M2",
ends_with("3") ~ "M3") |>
fmt_markdown()| Coffee |
Pre
|
T2DM
|
|||||
|---|---|---|---|---|---|---|---|
| M1 | M2 | M3 | M1 | M2 | M3 | ||
| Low | Low | 1 (1, 1) |
1 (1, 1) |
1 (1, 1) |
1 (1, 1) |
1 (1, 1) |
1 (1, 1) |
| Medium | 1.38 (1.15, 1.65) |
1.4 (1.21, 1.63) |
1.36 (1.16, 1.59) |
2.46 (2.05, 2.94) |
2.55 (2.26, 2.87) |
2.28 (2.02, 2.57) |
|
| High | 1.66 (1.39, 1.99) |
1.74 (1.5, 2.01) |
1.58 (1.35, 1.86) |
3.76 (3.15, 4.48) |
4.19 (3.73, 4.71) |
3.16 (2.8, 3.56) |
|
| Medium | Low | 0.81 (0.68, 0.97) |
0.8 (0.7, 0.92) |
0.8 (0.69, 0.92) |
0.82 (0.7, 0.97) |
0.83 (0.73, 0.94) |
0.8 (0.7, 0.91) |
| Medium | 1.12 (0.87, 1.44) |
1.13 (0.93, 1.37) |
1.08 (0.88, 1.34) |
2.02 (1.59, 2.57) |
2.11 (1.78, 2.51) |
1.82 (1.52, 2.17) |
|
| High | 1.35 (1.05, 1.73) |
1.4 (1.15, 1.7) |
1.26 (1.02, 1.56) |
3.09 (2.44, 3.93) |
3.47 (2.92, 4.13) |
2.51 (2.1, 3.01) |
|
| High | Low | 0.9 (0.75, 1.08) |
0.85 (0.74, 0.97) |
0.83 (0.72, 0.96) |
0.97 (0.82, 1.14) |
0.87 (0.76, 0.99) |
0.8 (0.7, 0.91) |
| Medium | 1.25 (0.97, 1.6) |
1.19 (0.97, 1.45) |
1.13 (0.91, 1.39) |
2.37 (1.87, 3.02) |
2.22 (1.86, 2.64) |
1.82 (1.53, 2.18) |
|
| High | 1.5 (1.17, 1.92) |
1.47 (1.21, 1.79) |
1.31 (1.06, 1.62) |
3.63 (2.86, 4.6) |
3.64 (3.07, 4.32) |
2.53 (2.12, 3.01) |
|
These joint-category contrasts can be calculated from a single multinomial model; separate stratification of the dataset is not required for this table.
This page preserves a subset of the analyses and decisions considered during manuscript preparation. It is an analytical record rather than a reconstruction of every final analysis, and the published article is the definitive source for the study methods, results, and interpretation.
Several features of the final analysis are important when reading this record:
Education in the third covariate set.In the final results, medium and high coffee-consumption categories were associated with lower odds of prevalent prediabetes and T2DM, whereas higher PRS categories were associated with higher odds. The dose-response analysis suggested a potentially U-shaped association between coffee consumption and both outcomes. These cross-sectional associations should not be interpreted as evidence that coffee consumption causes a reduction in diabetes risk.
For the complete methods, results, sensitivity analyses, and interpretation, see Rao et al. (2025), Interaction between coffee consumption and polygenic risk score in relation to diabetes: insights from the Maastricht study.
---
title: "Analysis Notes on Coffee Consumption, Polygenic Risk Score, and Diabetes"
author: "Tzu-Yao Lin"
date: 2024-09-18
date-modified: 2026-09-01
description: "A public record of analyses conducted during the preparation of a collaborative study using data from The Maastricht Study."
categories:
- "r"
- "statistics"
- "research notes"
image: CDP.jpg
image-alt: "Illustration linking a polygenic risk score (DNA helix) and coffee consumption to diabetes risk, with covariates shown below."
execute:
warning: false
freeze: true
format:
html:
toc: true
toc-depth: 3
number-sections: true
code-fold: true
code-tools: true
---
::: callout-note
## About this analysis record
This page documents analyses conducted during the preparation of a collaborative study of coffee consumption, polygenic risk score, and diabetes using data from The Maastricht Study. It is retained as a public record of the analytical workflow and is not intended as a complete tutorial or as the definitive report of the study.
The final methods, results, and interpretations are reported in [Rao et al. (2025), *Interaction between coffee consumption and polygenic risk score in relation to diabetes: insights from the Maastricht study*](https://doi.org/10.1007/s00394-025-03782-y).
:::
# Purpose and analytical scope
This record arose while checking and developing the statistical analyses for a collaborative cross-sectional study using data from The Maastricht Study. The outcome distinguished participants with normal glucose metabolism (NGM), prediabetes, and type 2 diabetes mellitus (T2DM). The main exposures were habitual coffee consumption and a polygenic risk score (PRS) for T2DM.
The scientific questions were whether coffee consumption and PRS were separately associated with the prevalence of prediabetes and T2DM, and whether the association between PRS and glucose-metabolism status differed across levels of coffee consumption. Because these analyses use cross-sectional observational data, the estimates describe associations with prevalent glucose-metabolism categories; they do not by themselves establish causal or preventive effects.
## Questions documented in this record
The working analysis focused on five practical questions that arose during manuscript preparation:
1. How should missing observations be handled so that candidate models are fitted to comparable data?
2. Is an ordinal logistic model appropriate for the three glucose-metabolism categories?
3. If the proportional-odds assumption is not tenable, should the outcome be analyzed using two binary logistic regressions or one multinomial logistic regression?
4. How do estimates for coffee consumption and PRS change across the proposed covariate sets?
5. How should the coffee-by-PRS interaction and odds ratios for joint exposure categories be evaluated and presented?
This page concentrates on these model-development questions and the construction of working result tables. It does not document every analysis reported in the published article. In particular, the published study also reports dose-response and sensitivity analyses that are outside the scope of this record. Some sections below preserve working questions, intermediate comparisons, and decisions that differ from the final publication.
# Data availability and privacy
The participant-level dataset used for this analysis is restricted and is not distributed with this public website repository. The file contains individual-level health, demographic, behavioral, medication, socioeconomic, and polygenic-risk variables. Whether any subset may be shared depends on the original consent, data-use agreement, ethics approval, and applicable institutional requirements; repository publication should not be assumed to be permitted.
For local reproduction by an authorized researcher, the dataset must be stored outside the repository and supplied through the `CDP_DATA_PATH` environment variable. The analysis rejects paths inside the website project. Public outputs should contain aggregate summaries and model results rather than participant-level records.
# Data preprocessing
The restricted dataset used below was supplied as a preprocessed analysis file through `CDP_DATA_PATH`.
```{r}
#| label: load-packages-and-settings
#| warning: false
#| message: false
library(tidyverse)
library(nnet)
library(epiDisplay)
library(lmtest)
library(gt)
```
```{r}
#| label: load-data
data_path <- Sys.getenv("CDP_DATA_PATH")
if (!nzchar(data_path)) {
stop("Set CDP_DATA_PATH to the restricted dataset outside this project.")
}
data_path <- normalizePath(data_path, mustWork = TRUE)
project_dir <- Sys.getenv(
"QUARTO_PROJECT_DIR",
unset = normalizePath("../..", mustWork = TRUE)
)
project_dir <- normalizePath(project_dir, mustWork = TRUE)
if (
identical(data_path, project_dir) ||
startsWith(data_path, paste0(project_dir, .Platform$file.sep))
) {
stop("CDP_DATA_PATH must point outside the public website project.")
}
analysis_variables <- c(
"N_Diabetes_WHO", "N_DIABETES_2b", "PRS_tertiles",
"coffee_tertiles", "SEX", "Age", "bmi", "NIT_alcoholtot",
"smoking_3cat", "mean_step_min_wake_T", "DHD_sum", "NIT_kcal",
"N_CVD", "Tot_chol", "N_OMAP", "med_HT", "med_LP",
"FIT_suikerg", "B1_VD1_2.6.29", "N_Education_3cat"
)
data <- read_csv(
data_path,
na = c("", "NA", "-999", "-888"),
col_select = all_of(analysis_variables)
)
```
Only variables needed for the working analyses below are loaded. Public outputs should contain aggregate summaries and model results rather than participant-level records.
The variables required for the candidate outcome, exposure, and covariate specifications are then recoded for analysis.
```{r}
#| label: transform-variables
diabetes_with_na <- data |>
mutate(Diabetes = factor(N_Diabetes_WHO, labels = c("NGM", "Pre", "T2DM"), ordered = TRUE),
IsDiabetes = factor(N_DIABETES_2b),
PRS = factor(PRS_tertiles, labels = c("Low", "Medium", "High")),
Coffee = factor(coffee_tertiles, labels = c("Low", "Medium", "High")),
Sex = factor(SEX, labels = c("Male", "Female")),
Age = Age,
BMI = bmi,
Alcohol = NIT_alcoholtot,
Smoking = factor(smoking_3cat, labels = c("Never", "Former", "Current")),
Step_wake = mean_step_min_wake_T,
DHD = DHD_sum,
KCal = NIT_kcal,
CVD = factor(N_CVD, labels = c("No", "Yes")),
Chol = Tot_chol,
# HT = factor(N_HT, labels = c("No", "Yes")),
OMAP = N_OMAP,
Med_HT = factor(med_HT, labels = c("No", "Yes")),
Med_LP = factor(med_LP, labels = c("No", "Yes")),
Sugar = FIT_suikerg,
B1_VD1 = factor(B1_VD1_2.6.29, labels = c("Yes", "No", "Unknow")),
Education = factor(N_Education_3cat, labels = c("Low", "Medium", "High")),
.keep = "none")
skimr::skim(diabetes_with_na)
```
Missingness was not evenly distributed across the selected variables. In particular, `Step_wake` had more than 1,000 missing observations, so requiring complete data on all 20 variables substantially reduced the analysis sample.
```{r}
#| label: remove-na-data
diabetes <- diabetes_with_na |> drop_na()
tibble(
complete_cases = nrow(diabetes),
excluded_rows = nrow(diabetes_with_na) - nrow(diabetes)
)
```
::: callout-warning
## Working decision: complete-case dataset
At this stage of the analysis, the treatment of missing observations in the source preprocessing was not fully documented. For the model comparisons below, I constructed one complete-case dataset by excluding any participant with `NA`, `-999`, or `-888` on at least one of the 20 selected variables.
Using a common analysis sample ensured that differences in AIC or likelihood-ratio tests across the candidate models were not caused by fitting the models to different sets of participants. This produced a working sample of 6,224 complete cases after excluding 1,444 rows. By comparison, the published article reports an included study sample of 7,668 and labels its main association table as $n = 7{,}668$. This record does not establish how the difference between that reporting and the complete-case workflow shown here was resolved.
Complete-case analysis was a working decision for comparability, not a general recommendation that it is optimal. The substantial missingness in `Step_wake` may affect precision and the population represented by the fitted models, and this page does not include a missing-data sensitivity analysis.
:::
::: callout-important
## Open questions recorded during analysis
The following questions were recorded before the manuscript decisions were finalized:
1. What was the substantive reason for categorizing PRS and coffee consumption into low, medium, and high groups rather than retaining continuous measures? If tertiles were retained, should an additional trend or dose-response analysis be reported?
2. What interpretive advantage did tertiles provide, and how should their simpler presentation be weighed against the loss of information caused by categorization?
The published study subsequently described both variables as study-population tertiles and additionally examined coffee consumption using a continuous dose-response analysis. The final article should therefore be used for the definitive rationale and specification.
:::
# Model development record
## Outcome-model choice
The outcome categories---NGM, prediabetes, and T2DM---have a clinical ordering, so an ordinal logistic model was considered first. A proportional-odds model assumes that each predictor has the same coefficient across the cumulative comparisons induced by the ordered outcome. This restriction was checked using the Brant test.
```{r}
#| label: check-proportional-assumption
olm <- MASS::polr(Diabetes ~ PRS + Coffee + Age + Sex + BMI + Alcohol + Smoking + Step_wake + DHD + KCal + CVD + Chol + OMAP + Med_HT + Med_LP + Sugar + B1_VD1 + Education, data = diabetes, Hess = TRUE)
brant::brant(olm)
```
The omnibus Brant test rejected the proportional-odds assumption for this model ($\chi^2 = 208.92$, $df = 23$, $p < .001$). Several predictor-specific tests also indicated nonproportionality. The proportional-odds specification was therefore not retained for the working analyses below.
::: callout-note
## Working decision: baseline-category multinomial model
At this stage, a baseline-category multinomial logistic model was adopted with NGM as the reference outcome. This allowed the association of each predictor with prediabetes versus NGM to differ from its association with T2DM versus NGM.
:::
For outcome category $j \in \{\text{Pre}, \text{T2DM}\}$, the baseline-category logit can be written as
$$
\eta_j(\mathbf{x})
= \log\left(\frac{p_j}{p_{\text{NGM}}}\right)
= \alpha_j + \mathbf{x}^{\mathsf T}\boldsymbol{\beta}_j,
$$
where $\mathbf{x}$ contains the exposure indicators and covariates included in a given candidate model. Each outcome contrast therefore has its own coefficient vector.
### Analysis question: two binary models or one multinomial model?
Separate binary models and one multinomial model were compared as an implementation check. The candidate exposure and covariate specifications discussed during manuscript preparation are summarized below.
| Exposure | Covariate set 1 | Covariate set 2 | Covariate set 3 |
|:----------------:|:---------------:|:---------------:|:---------------:|
| PRS | prs1 | prs2 | prs3 |
| Coffee | cof1 | cof2 | cof3 |
| PRS + Coffee | prs_cof1 | prs_cof2 | prs_cof3 |
| PRS + Coffee + PRS $\times$ Coffee | prs_cof_i1 | prs_cof_i2 | prs_cof_i3 |
: Candidate models {#tbl-models}
```{r}
#| label: formula
## PRS-only candidate models
prs1 <- formula(Diabetes ~ PRS + Age + Sex)
prs2 <- update(prs1, . ~ . + BMI + Alcohol + Smoking + Step_wake + DHD + KCal)
prs3 <- update(prs2, . ~ . + CVD + Chol + OMAP + Med_HT + Med_LP + Sugar + B1_VD1 + Education)
## Coffee-only candidate models
cof1 <- update(prs1, . ~ Coffee - PRS + .)
cof2 <- update(prs2, . ~ Coffee - PRS + .)
cof3 <- update(prs3, . ~ Coffee - PRS + .)
## Joint main-effects and interaction candidate models
prs_cof1 <- update(prs1, . ~ Coffee + .)
prs_cof2 <- update(prs2, . ~ Coffee + .)
prs_cof3 <- update(prs3, . ~ Coffee + .)
prs_cof_i1 <- update(prs_cof1, . ~ PRS:Coffee + .)
prs_cof_i2 <- update(prs_cof2, . ~ PRS:Coffee + .)
prs_cof_i3 <- update(prs_cof3, . ~ PRS:Coffee + .)
```
## PRS association: comparison of implementations
### Two binary logistic regressions
#### NGM vs. Prediabetes
```{r}
#| label: prediabetes-dataset
prediabetes <- diabetes |> filter(Diabetes %in% c("NGM", "Pre"))
dim(prediabetes)
table(prediabetes$Diabetes)
```
```{r}
#| label: prs-bl-pre
prs3_bl_pre <- glm(prs3, family = binomial(link = "logit"), data = prediabetes)
summary(prs3_bl_pre)
logistic.display(prs3_bl_pre)
```
#### NGM vs. T2DM
```{r}
#| label: t2dm-dataset
t2dm <- diabetes |> filter(Diabetes %in% c("NGM", "T2DM"))
dim(t2dm)
table(t2dm$Diabetes)
```
```{r}
#| label: prs-bl-t2dm
prs3_bl_t2dm <- glm(prs3, family = binomial(link = "logit"), data = t2dm)
summary(prs3_bl_t2dm)
logistic.display(prs3_bl_t2dm)
```
### Multinomial logistic regression
```{r}
#| label: prs-ml
prs3_ml <- multinom(prs3, data = diabetes)
summary(prs3_ml)
mlogit.display(prs3_ml)
```
::: callout-note
## Intermediate comparison
In this dataset, the estimated PRS associations from the multinomial model were similar to those obtained from the two separate binary models. This was a descriptive implementation check and does not establish that the approaches are generally equivalent. The binary models use different outcome-specific subsets, whereas the multinomial model represents all three outcome categories within one model. The subsequent working tables therefore use the multinomial implementation.
:::
```{r}
#| label: prs-ml-comp
prs1_ml <- multinom(prs1, data = diabetes)
prs2_ml <- multinom(prs2, data = diabetes)
lrtest(prs1_ml, prs2_ml, prs3_ml)
```
```{r}
#| label: get-or-ci
get_OR_CI <- function(multi_model, DV_level, EV_level, alpha = 0.05) {
esti <- coef(multi_model)[DV_level, , drop = FALSE]
.cov_mat <- vcov(multi_model)
.select_variable <- str_detect(colnames(.cov_mat), DV_level)
cov_mat <- .cov_mat[.select_variable, .select_variable]
cont <- matrix(multi_model$coefnames %in% EV_level, nrow = 1)
l <- cont %*% t(esti)
OR <- exp(l) |> round(2)
SE <- sqrt(cont %*% cov_mat %*% t(cont))
lower_CI <- exp(l - qnorm(1-alpha/2) * SE) |> round(2)
upper_CI <- exp(l + qnorm(1-alpha/2) * SE) |> round(2)
str_glue("{OR} <br> ({lower_CI}, {upper_CI})")
}
```
```{r}
#| label: tbl-prs-effect
#| tbl-cap: "Association between PRS and prediabetes/T2DM"
levels <- c("Low", "Medium", "High")
PRSlevels <- str_glue("PRS{levels}")
prs_OR_table <- tibble(
level = levels ,
Pre_prs1 = map_chr(PRSlevels, ~ get_OR_CI(prs1_ml, "Pre", .)),
Pre_prs2 = map_chr(PRSlevels, ~ get_OR_CI(prs2_ml, "Pre", .)),
Pre_prs3 = map_chr(PRSlevels, ~ get_OR_CI(prs3_ml, "Pre", .)),
T2DM_prs1 = map_chr(PRSlevels, ~ get_OR_CI(prs1_ml, "T2DM", .)),
T2DM_prs2 = map_chr(PRSlevels, ~ get_OR_CI(prs2_ml, "T2DM", .)),
T2DM_prs3 = map_chr(PRSlevels, ~ get_OR_CI(prs3_ml, "T2DM", .)))
gt(prs_OR_table, rowname_col = "level") |>
tab_stubhead(label = "PRS") |>
tab_spanner(label = "Pre", columns = starts_with("Pre")) |>
tab_spanner(label = "T2DM", columns = starts_with("T2DM")) |>
cols_label(ends_with("1") ~ "M1",
ends_with("2") ~ "M2",
ends_with("3") ~ "M3") |>
fmt_markdown()
```
## Coffee association: working table reproduction
```{r}
#| label: cof-ml
cof1_ml <- multinom(cof1, data = diabetes)
cof2_ml <- multinom(cof2, data = diabetes)
cof3_ml <- multinom(cof3, data = diabetes)
```
```{r}
#| label: tbl-cof-effect
#| tbl-cap: "Association between coffee consumption and prediabetes/T2DM"
Coflevels <- str_glue("Coffee{levels}")
cof_OR_table <- tibble(
level = levels ,
Pre_cof1 = map_chr(Coflevels, ~ get_OR_CI(cof1_ml, "Pre", .)),
Pre_cof2 = map_chr(Coflevels, ~ get_OR_CI(cof2_ml, "Pre", .)),
Pre_cof3 = map_chr(Coflevels, ~ get_OR_CI(cof3_ml, "Pre", .)),
T2DM_cof1 = map_chr(Coflevels, ~ get_OR_CI(cof1_ml, "T2DM", .)),
T2DM_cof2 = map_chr(Coflevels, ~ get_OR_CI(cof2_ml, "T2DM", .)),
T2DM_cof3 = map_chr(Coflevels, ~ get_OR_CI(cof3_ml, "T2DM", .)))
gt(cof_OR_table, rowname_col = "level") |>
tab_stubhead(label = "Coffee") |>
tab_spanner(label = "Pre", columns = starts_with("Pre")) |>
tab_spanner(label = "T2DM", columns = starts_with("T2DM")) |>
cols_label(ends_with("1") ~ "M1",
ends_with("2") ~ "M2",
ends_with("3") ~ "M3") |>
fmt_markdown()
```
## Coffee-by-PRS interaction: working table reproduction
```{r}
#| label: prs-cof-inter
prs_cof1_ml <- multinom(prs_cof1, data = diabetes)
prs_cof_i1_ml <- multinom(prs_cof_i1, data = diabetes)
prs_cof1_ml
mlogit.display(prs_cof1_ml)
mlogit.display(prs_cof_i1_ml)
lrtest(prs_cof1_ml, prs_cof_i1_ml)
prs_cof2_ml <- multinom(prs_cof2, data = diabetes)
prs_cof_i2_ml <- multinom(prs_cof_i2, data = diabetes)
lrtest(prs_cof2_ml, prs_cof_i2_ml)
prs_cof3_ml <- multinom(prs_cof3, data = diabetes)
prs_cof_i3_ml <- multinom(prs_cof_i3, data = diabetes)
lrtest(prs_cof3_ml, prs_cof_i3_ml)
```
::: callout-note
## Working decision on interaction terms
For the candidate models shown above, the likelihood-ratio tests did not provide evidence that adding the categorical coffee-by-PRS interaction terms improved model fit. The corresponding main-effects models (`prs_cof1`, `prs_cof2`, and `prs_cof3`) were therefore retained for the working association tables. This decision should not be interpreted as proof that interaction is absent; the published article reports the final interaction analysis and its interpretation.
:::
The next section reconstructs a working joint-category table considered during manuscript preparation. Model `prs_cof1` includes categorical indicators for coffee consumption and PRS, with low coffee consumption and low PRS as the reference combination. For prediabetes versus NGM, its linear predictor is
$$
\ln\left(\frac{p_{\text{Pre}}}{p_{\text{NGM}}} \right) = \alpha_{11} + \beta_{11} \text{CoffeeMedium} + \beta_{12} \text{CoffeeHigh} + \beta_{13} \text{PRSMedium} + \beta_{14} \text{PRSHigh} + \gamma_{11} \text{Age} + \gamma_{12} \text{SexFemale}
$$
For either outcome contrast $j$, let $\mathbf{c}_{c,p}$ select the coefficients needed to compare coffee category $c$ and PRS category $p$ with the low-coffee, low-PRS reference combination while holding covariates fixed. The estimated log odds ratio is
$$
\widehat{\ell}_{j,c,p}
= \mathbf{c}_{c,p}^{\mathsf T}\widehat{\boldsymbol{\beta}}_j,
$$
and the corresponding odds ratio is
$$
\widehat{\operatorname{OR}}_{j,c,p}
= \exp\left(\widehat{\ell}_{j,c,p}\right).
$$
Its estimated variance and 95% Wald confidence interval are
$$
\widehat{\operatorname{Var}}\left(\widehat{\ell}_{j,c,p}\right)
= \mathbf{c}_{c,p}^{\mathsf T}
\widehat{\operatorname{Var}}\left(\widehat{\boldsymbol{\beta}}_j\right)
\mathbf{c}_{c,p},
$$
$$
95\%\ \operatorname{CI}
= \exp\left[
\widehat{\ell}_{j,c,p}
\mathbin{\pm} z_{.975}
\sqrt{\widehat{\operatorname{Var}}\left(\widehat{\ell}_{j,c,p}\right)}
\right].
$$
For example, the medium-coffee, high-PRS contrast under this main-effects model is
$$
\widehat{\ell}_{j,M,H}
= \widehat{\beta}_{j,\text{CoffeeMedium}}
+ \widehat{\beta}_{j,\text{PRSHigh}},
$$
so that
$$
\widehat{\operatorname{OR}}_{j,M,H}
= \exp\left(
\widehat{\beta}_{j,\text{CoffeeMedium}}
+ \widehat{\beta}_{j,\text{PRSHigh}}
\right).
$$
The variance of this sum includes both coefficient variances and twice their covariance. Because this working model contains no coffee-by-PRS interaction, effects combine additively on the log-odds scale and multiplicatively on the odds scale for each outcome contrast. This is a model-based association, not a causal effect.
```{r}
#| label: tbl-pre-cof-effect
#| tbl-cap: "Joint associations of PRS and coffee consumption with prediabetes/T2DM"
PRSlevels = paste0("PRS", rep(levels, times = 3))
Coflevels = paste0("Coffee", rep(levels, each = 3))
prs_cof_OR_table <- tibble(
Cof_levels = rep(levels, each = 3),
PRS_levels = rep(levels, times = 3),
Pre_prs_cof1 = map2_chr(PRSlevels, Coflevels, ~ get_OR_CI(prs_cof1_ml, "Pre", c(.x, .y))),
Pre_prs_cof2 = map2_chr(PRSlevels, Coflevels, ~ get_OR_CI(prs_cof2_ml, "Pre", c(.x, .y))),
Pre_prs_cof3 = map2_chr(PRSlevels, Coflevels, ~ get_OR_CI(prs_cof3_ml, "Pre", c(.x, .y))),
T2DM_prs_cof1 = map2_chr(PRSlevels, Coflevels, ~ get_OR_CI(prs_cof1_ml, "T2DM", c(.x, .y))),
T2DM_prs_cof2 = map2_chr(PRSlevels, Coflevels, ~ get_OR_CI(prs_cof2_ml, "T2DM", c(.x, .y))),
T2DM_prs_cof3 = map2_chr(PRSlevels, Coflevels, ~ get_OR_CI(prs_cof3_ml, "T2DM", c(.x, .y))))
gt(prs_cof_OR_table,
rowname_col = "PRS_levels",
groupname_col = "Cof_levels",
row_group_as_column = TRUE) |>
tab_stubhead(label = c("Coffee", "PRS")) |>
tab_spanner(label = "Pre", columns = starts_with("Pre")) |>
tab_spanner(label = "T2DM", columns = starts_with("T2DM")) |>
cols_label(ends_with("1") ~ "M1",
ends_with("2") ~ "M2",
ends_with("3") ~ "M3") |>
fmt_markdown()
```
These joint-category contrasts can be calculated from a single multinomial model; separate stratification of the dataset is not required for this table.
# Relation to the published article
This page preserves a subset of the analyses and decisions considered during manuscript preparation. It is an analytical record rather than a reconstruction of every final analysis, and the published article is the definitive source for the study methods, results, and interpretation.
Several features of the final analysis are important when reading this record:
1. The published article reports an included sample of 7,668 and labels its main association table as $n = 7{,}668$, whereas the complete-case working models on this page use 6,224 participants. The available record does not reconcile this difference.
2. The final article used multinomial logistic regression with NGM as the reference outcome and reported three sequential covariate-adjustment sets.
3. Education was included in Model 1 of the published analysis. By contrast, the working candidate formulas preserved above add `Education` in the third covariate set.
4. The final categorical coffee-by-PRS interaction was evaluated in the fully adjusted model using a likelihood-ratio test. The reported $p$ value was .21, providing no evidence of multiplicative interaction in that analysis.
5. The published work additionally examined coffee consumption using restricted cubic splines and conducted sensitivity analyses focused on newly diagnosed diabetes and recruitment period. Those analyses are not reproduced on this page.
In the final results, medium and high coffee-consumption categories were associated with lower odds of prevalent prediabetes and T2DM, whereas higher PRS categories were associated with higher odds. The dose-response analysis suggested a potentially U-shaped association between coffee consumption and both outcomes. These cross-sectional associations should not be interpreted as evidence that coffee consumption causes a reduction in diabetes risk.
For the complete methods, results, sensitivity analyses, and interpretation, see [Rao et al. (2025), *Interaction between coffee consumption and polygenic risk score in relation to diabetes: insights from the Maastricht study*](https://doi.org/10.1007/s00394-025-03782-y).