Show code
spearman_results <- spearman_nutrient_alpha(sample_nutrients)IBD Capstone team
May 29, 2026
Are certain nutrients associated with fungal alpha diversity, and do those associations differ across disease groups?
Null (overall): No monotonic association between each nutrient and each alpha diversity metric across all samples.
Null (stratified): Within each study group, no monotonic association between nutrient intake and alpha diversity.
Comparing overall vs group-specific Spearman () is exploratory (small n per group); formal tests of correlation differences were not run.
| Role | Source |
|---|---|
| Mycobiome (alpha) | data/intermediate/alpha_long.rds (make wrangle) |
| Diet | data/processed/dietary_cleaned.xlsx (make dietary on data/raw/SYN_dietary data(ALL).csv) |
| Disease group | Study_group_new on mycobiome metadata (from SYN_MBI sample IDs meta.xlsx) |
merge_files.R).Participant_ID = Participant ID (ESHA ID) (normalized SYN codes).02_data_wrangling.R removals.Coverage: 16 samples, 12 participants, 16 samples with fiber data; study groups: Active IBD, Non-IBD, Quiescent.
| Item | Choice |
|---|---|
| Test | Spearman rank correlation (cor.test, method = "spearman") |
| Response | Shannon, Simpson, Chao1 |
| Predictors | Participant-mean nutrient intake (g, kcal, mg as recorded) |
| Stratification | Study_group_new (Active IBD, Quiescent, Non-IBD) + Overall |
| Multiple testing | Benjamini–Hochberg within each stratum (across nutrient × metric pairs) |
| Minimum n | Correlation only if ≥ 4 complete pairs |
| Significance | α = 0.05 |
NA correlations.| Nutrient | Alpha metric | n | Spearman rho | p | BH-adjusted p |
|---|---|---|---|---|---|
| Total fiber (g/day) | Shannon | 16 | 0.0000 | 1.0000 | 1.0000 |
| Total fiber (g/day) | Simpson | 16 | -0.0605 | 0.8239 | 0.9376 |
| Total fiber (g/day) | Chao1 | 16 | 0.1932 | 0.4734 | 0.9376 |
| Tryptophan (g/day) | Shannon | 16 | -0.2330 | 0.3851 | 0.9376 |
| Tryptophan (g/day) | Simpson | 16 | -0.0723 | 0.7903 | 0.9376 |
| Tryptophan (g/day) | Chao1 | 16 | 0.0723 | 0.7903 | 0.9376 |
| Calories (kcal/day) | Shannon | 16 | 0.0354 | 0.8964 | 0.9644 |
| Calories (kcal/day) | Simpson | 16 | -0.1431 | 0.5971 | 0.9376 |
| Calories (kcal/day) | Chao1 | 16 | -0.0752 | 0.7819 | 0.9376 |
| Artificial sweeteners (mg/day) | Shannon | 16 | 0.0973 | 0.7199 | 0.9376 |
| Artificial sweeteners (mg/day) | Simpson | 16 | 0.0310 | 0.9093 | 0.9644 |
| Artificial sweeteners (mg/day) | Chao1 | 16 | -0.1136 | 0.6754 | 0.9376 |
| Sugar (g/day) | Shannon | 16 | 0.1298 | 0.6319 | 0.9376 |
| Sugar (g/day) | Simpson | 16 | 0.2286 | 0.3944 | 0.9376 |
| Sugar (g/day) | Chao1 | 16 | 0.2168 | 0.4199 | 0.9376 |
| Added sugar (g/day) | Shannon | 16 | -0.5339 | 0.0331 | 0.9376 |
| Added sugar (g/day) | Simpson | 16 | 0.1903 | 0.4803 | 0.9376 |
| Added sugar (g/day) | Chao1 | 16 | -0.1519 | 0.5744 | 0.9376 |
| Fat (g/day) | Shannon | 16 | -0.3864 | 0.1393 | 0.9376 |
| Fat (g/day) | Simpson | 16 | 0.1932 | 0.4734 | 0.9376 |
| Fat (g/day) | Chao1 | 16 | -0.1755 | 0.5156 | 0.9376 |
| Omega-3 (g/day) | Shannon | 16 | 0.0885 | 0.7445 | 0.9376 |
| Omega-3 (g/day) | Simpson | 16 | -0.0693 | 0.7986 | 0.9376 |
| Omega-3 (g/day) | Chao1 | 16 | -0.1726 | 0.5228 | 0.9376 |
| Omega-6 (g/day) | Shannon | 16 | -0.3363 | 0.2028 | 0.9376 |
| Omega-6 (g/day) | Simpson | 16 | -0.1932 | 0.4734 | 0.9376 |
| Omega-6 (g/day) | Chao1 | 16 | 0.1637 | 0.5446 | 0.9376 |
| Vitamin D (mcg/day) | Shannon | 16 | 0.4690 | 0.0668 | 0.9376 |
| Vitamin D (mcg/day) | Simpson | 16 | -0.0929 | 0.7321 | 0.9376 |
| Vitamin D (mcg/day) | Chao1 | 16 | -0.0929 | 0.7321 | 0.9376 |
| Folate (mcg/day) | Shannon | 16 | 0.1681 | 0.5336 | 0.9376 |
| Folate (mcg/day) | Simpson | 16 | 0.0221 | 0.9352 | 0.9644 |
| Folate (mcg/day) | Chao1 | 16 | -0.1578 | 0.5594 | 0.9376 |
| Study group | Nutrient | Alpha metric | n | Spearman rho | p | BH-adjusted p |
|---|---|---|---|---|---|---|
| Active IBD | Total fiber (g/day) | Shannon | 6 | 0.1471 | 0.7809 | 0.8951 |
| Active IBD | Total fiber (g/day) | Simpson | 6 | 0.0883 | 0.8679 | 0.8951 |
| Active IBD | Total fiber (g/day) | Chao1 | 6 | -0.0883 | 0.8679 | 0.8951 |
| Active IBD | Tryptophan (g/day) | Shannon | 6 | -0.2648 | 0.6121 | 0.8951 |
| Active IBD | Tryptophan (g/day) | Simpson | 6 | 0.0883 | 0.8679 | 0.8951 |
| Active IBD | Tryptophan (g/day) | Chao1 | 6 | 0.2648 | 0.6121 | 0.8951 |
| Active IBD | Calories (kcal/day) | Shannon | 6 | 0.5591 | 0.2488 | 0.8951 |
| Active IBD | Calories (kcal/day) | Simpson | 6 | -0.4414 | 0.3809 | 0.8951 |
| Active IBD | Calories (kcal/day) | Chao1 | 6 | -0.8533 | 0.0307 | 0.5065 |
| Active IBD | Artificial sweeteners (mg/day) | Shannon | 6 | -0.6179 | 0.1911 | 0.8951 |
| Active IBD | Artificial sweeteners (mg/day) | Simpson | 6 | 0.0883 | 0.8679 | 0.8951 |
| Active IBD | Artificial sweeteners (mg/day) | Chao1 | 6 | 0.6179 | 0.1911 | 0.8951 |
| Active IBD | Sugar (g/day) | Shannon | 6 | -0.5591 | 0.2488 | 0.8951 |
| Active IBD | Sugar (g/day) | Simpson | 6 | 0.4414 | 0.3809 | 0.8951 |
| Active IBD | Sugar (g/day) | Chao1 | 6 | 0.8533 | 0.0307 | 0.5065 |
| Active IBD | Added sugar (g/day) | Shannon | 6 | -0.1471 | 0.7809 | 0.8951 |
| Active IBD | Added sugar (g/day) | Simpson | 6 | -0.4414 | 0.3809 | 0.8951 |
| Active IBD | Added sugar (g/day) | Chao1 | 6 | -0.2648 | 0.6121 | 0.8951 |
| Active IBD | Fat (g/day) | Shannon | 6 | 0.1471 | 0.7809 | 0.8951 |
| Active IBD | Fat (g/day) | Simpson | 6 | 0.0883 | 0.8679 | 0.8951 |
| Active IBD | Fat (g/day) | Chao1 | 6 | -0.0883 | 0.8679 | 0.8951 |
| Active IBD | Omega-3 (g/day) | Shannon | 6 | -0.0883 | 0.8679 | 0.8951 |
| Active IBD | Omega-3 (g/day) | Simpson | 6 | -0.4414 | 0.3809 | 0.8951 |
| Active IBD | Omega-3 (g/day) | Chao1 | 6 | -0.2648 | 0.6121 | 0.8951 |
| Active IBD | Omega-6 (g/day) | Shannon | 6 | -0.1471 | 0.7809 | 0.8951 |
| Active IBD | Omega-6 (g/day) | Simpson | 6 | -0.4414 | 0.3809 | 0.8951 |
| Active IBD | Omega-6 (g/day) | Chao1 | 6 | -0.2648 | 0.6121 | 0.8951 |
| Active IBD | Vitamin D (mcg/day) | Shannon | 6 | -0.1471 | 0.7809 | 0.8951 |
| Active IBD | Vitamin D (mcg/day) | Simpson | 6 | -0.0883 | 0.8679 | 0.8951 |
| Active IBD | Vitamin D (mcg/day) | Chao1 | 6 | 0.0883 | 0.8679 | 0.8951 |
| Active IBD | Folate (mcg/day) | Shannon | 6 | 0.3237 | 0.5314 | 0.8951 |
| Active IBD | Folate (mcg/day) | Simpson | 6 | 0.2648 | 0.6121 | 0.8951 |
| Active IBD | Folate (mcg/day) | Chao1 | 6 | -0.0294 | 0.9559 | 0.9559 |
| Non-IBD | Total fiber (g/day) | Shannon | 5 | -0.5643 | 0.3217 | 0.7016 |
| Non-IBD | Total fiber (g/day) | Simpson | 5 | -0.0513 | 0.9347 | 0.9347 |
| Non-IBD | Total fiber (g/day) | Chao1 | 5 | 0.6669 | 0.2189 | 0.6020 |
| Non-IBD | Tryptophan (g/day) | Shannon | 5 | 0.1539 | 0.8048 | 0.9347 |
| Non-IBD | Tryptophan (g/day) | Simpson | 5 | -0.3591 | 0.5528 | 0.7016 |
| Non-IBD | Tryptophan (g/day) | Chao1 | 5 | 0.9747 | 0.0048 | 0.0530 |
| Non-IBD | Calories (kcal/day) | Shannon | 5 | -0.3591 | 0.5528 | 0.7016 |
| Non-IBD | Calories (kcal/day) | Simpson | 5 | -0.3591 | 0.5528 | 0.7016 |
| Non-IBD | Calories (kcal/day) | Chao1 | 5 | -0.3591 | 0.5528 | 0.7016 |
| Non-IBD | Artificial sweeteners (mg/day) | Shannon | 5 | -0.0513 | 0.9347 | 0.9347 |
| Non-IBD | Artificial sweeteners (mg/day) | Simpson | 5 | -0.0513 | 0.9347 | 0.9347 |
| Non-IBD | Artificial sweeteners (mg/day) | Chao1 | 5 | -0.8721 | 0.0539 | 0.2539 |
| Non-IBD | Sugar (g/day) | Shannon | 5 | 0.3591 | 0.5528 | 0.7016 |
| Non-IBD | Sugar (g/day) | Simpson | 5 | 0.3591 | 0.5528 | 0.7016 |
| Non-IBD | Sugar (g/day) | Chao1 | 5 | 0.3591 | 0.5528 | 0.7016 |
| Non-IBD | Added sugar (g/day) | Shannon | 5 | -0.6669 | 0.2189 | 0.6020 |
| Non-IBD | Added sugar (g/day) | Simpson | 5 | 0.8721 | 0.0539 | 0.2539 |
| Non-IBD | Added sugar (g/day) | Chao1 | 5 | -0.6669 | 0.2189 | 0.6020 |
| Non-IBD | Fat (g/day) | Shannon | 5 | -0.5643 | 0.3217 | 0.7016 |
| Non-IBD | Fat (g/day) | Simpson | 5 | 0.9747 | 0.0048 | 0.0530 |
| Non-IBD | Fat (g/day) | Chao1 | 5 | -0.3591 | 0.5528 | 0.7016 |
| Non-IBD | Omega-3 (g/day) | Shannon | 5 | -0.0513 | 0.9347 | 0.9347 |
| Non-IBD | Omega-3 (g/day) | Simpson | 5 | -0.0513 | 0.9347 | 0.9347 |
| Non-IBD | Omega-3 (g/day) | Chao1 | 5 | -0.8721 | 0.0539 | 0.2539 |
| Non-IBD | Omega-6 (g/day) | Shannon | 5 | -0.3591 | 0.5528 | 0.7016 |
| Non-IBD | Omega-6 (g/day) | Simpson | 5 | -0.3591 | 0.5528 | 0.7016 |
| Non-IBD | Omega-6 (g/day) | Chao1 | 5 | -0.3591 | 0.5528 | 0.7016 |
| Non-IBD | Vitamin D (mcg/day) | Shannon | 5 | 0.9747 | 0.0048 | 0.0530 |
| Non-IBD | Vitamin D (mcg/day) | Simpson | 5 | -0.5643 | 0.3217 | 0.7016 |
| Non-IBD | Vitamin D (mcg/day) | Chao1 | 5 | 0.1539 | 0.8048 | 0.9347 |
| Non-IBD | Folate (mcg/day) | Shannon | 5 | 0.6669 | 0.2189 | 0.6020 |
| Non-IBD | Folate (mcg/day) | Simpson | 5 | -0.8721 | 0.0539 | 0.2539 |
| Non-IBD | Folate (mcg/day) | Chao1 | 5 | 0.6669 | 0.2189 | 0.6020 |
| Quiescent | Total fiber (g/day) | Shannon | 5 | -0.0513 | 0.9347 | 0.9347 |
| Quiescent | Total fiber (g/day) | Simpson | 5 | -0.0513 | 0.9347 | 0.9347 |
| Quiescent | Total fiber (g/day) | Chao1 | 5 | 0.4104 | 0.4925 | 0.7932 |
| Quiescent | Tryptophan (g/day) | Shannon | 5 | -0.4617 | 0.4338 | 0.7932 |
| Quiescent | Tryptophan (g/day) | Simpson | 5 | -0.1539 | 0.8048 | 0.9347 |
| Quiescent | Tryptophan (g/day) | Chao1 | 5 | -0.8208 | 0.0886 | 0.7308 |
| Quiescent | Calories (kcal/day) | Shannon | 5 | 0.4617 | 0.4338 | 0.7932 |
| Quiescent | Calories (kcal/day) | Simpson | 5 | -0.0513 | 0.9347 | 0.9347 |
| Quiescent | Calories (kcal/day) | Chao1 | 5 | 0.4104 | 0.4925 | 0.7932 |
| Quiescent | Artificial sweeteners (mg/day) | Shannon | 5 | 0.5643 | 0.3217 | 0.7932 |
| Quiescent | Artificial sweeteners (mg/day) | Simpson | 5 | 0.3591 | 0.5528 | 0.7932 |
| Quiescent | Artificial sweeteners (mg/day) | Chao1 | 5 | 0.2052 | 0.7406 | 0.9052 |
| Quiescent | Sugar (g/day) | Shannon | 5 | 0.5643 | 0.3217 | 0.7932 |
| Quiescent | Sugar (g/day) | Simpson | 5 | 0.3591 | 0.5528 | 0.7932 |
| Quiescent | Sugar (g/day) | Chao1 | 5 | 0.2052 | 0.7406 | 0.9052 |
| Quiescent | Added sugar (g/day) | Shannon | 5 | -0.4617 | 0.4338 | 0.7932 |
| Quiescent | Added sugar (g/day) | Simpson | 5 | 0.0513 | 0.9347 | 0.9347 |
| Quiescent | Added sugar (g/day) | Chao1 | 5 | -0.4104 | 0.4925 | 0.7932 |
| Quiescent | Fat (g/day) | Shannon | 5 | -0.6669 | 0.2189 | 0.7932 |
| Quiescent | Fat (g/day) | Simpson | 5 | -0.8721 | 0.0539 | 0.7308 |
| Quiescent | Fat (g/day) | Chao1 | 5 | -0.2052 | 0.7406 | 0.9052 |
| Quiescent | Omega-3 (g/day) | Shannon | 5 | 0.5643 | 0.3217 | 0.7932 |
| Quiescent | Omega-3 (g/day) | Simpson | 5 | 0.5643 | 0.3217 | 0.7932 |
| Quiescent | Omega-3 (g/day) | Chao1 | 5 | 0.6156 | 0.2690 | 0.7932 |
| Quiescent | Omega-6 (g/day) | Shannon | 5 | -0.4617 | 0.4338 | 0.7932 |
| Quiescent | Omega-6 (g/day) | Simpson | 5 | -0.9747 | 0.0048 | 0.1590 |
| Quiescent | Omega-6 (g/day) | Chao1 | 5 | 0.1026 | 0.8696 | 0.9347 |
| Quiescent | Vitamin D (mcg/day) | Shannon | 5 | 0.3591 | 0.5528 | 0.7932 |
| Quiescent | Vitamin D (mcg/day) | Simpson | 5 | 0.6669 | 0.2189 | 0.7932 |
| Quiescent | Vitamin D (mcg/day) | Chao1 | 5 | 0.3078 | 0.6144 | 0.8448 |
| Quiescent | Folate (mcg/day) | Shannon | 5 | -0.3591 | 0.5528 | 0.7932 |
| Quiescent | Folate (mcg/day) | Simpson | 5 | 0.3591 | 0.5528 | 0.7932 |
| Quiescent | Folate (mcg/day) | Chao1 | 5 | -0.8208 | 0.0886 | 0.7308 |
No nutrient × diversity pairs were significant after BH adjustment (q < 0.05) in any stratum.
Total fiber × Shannon (all strata):
Overall: rho = 0.000 (n = 16, p = 1.0000) Active IBD: rho = 0.147 (n = 6, p = 0.7809) Non-IBD: rho = -0.564 (n = 5, p = 0.3217) Quiescent: rho = -0.051 (n = 5, p = 0.9347)
Overall Spearman correlations pool all study groups; stratified correlations describe associations within Active IBD, Quiescent, and Non-IBD separately. A nutrient may correlate with diversity overall but not within groups (or vice versa) when group-specific slopes differ or sample sizes are small.
These results do not test whether two correlation coefficients differ significantly between groups; that would require larger n or dedicated methods (e.g. comparing dependent correlations).
stats/R/nutrient_association_helpers.Rsrc/diet/dietary.pysrc/merge_files.R (aggregate_dietary)quarto render stats from repository root