library("corrkit")
d <- simulate_cor_data(150)
lab <- attr(d, "labels")
cm <- cor_compute(d, c("CRP", "IL6", "BDNF", "NfL", "BIN_CRP"), labels = lab)
tbl_cor(cm) # matrix| Correlation matrix | |||||
| Spearman correlation, unadjusted | pairwise complete N = 142–146 | Computed with psych::corr.test() {psych}; p adjustment: none (raw p-values) | |||||
| CRP | IL-6 | BDNF | NfL | CRP high [0/1] | |
|---|---|---|---|---|---|
| CRP | 1 | ||||
| IL-6 | 0.41*** | 1 | |||
| BDNF | -0.14 | -0.23** | 1 | ||
| NfL | 0.12 | 0.08 | -0.05 | 1 | |
| CRP high [0/1]1 | 0.87*** | 0.30*** | -0.10 | 0.12 | 1 |
| 1 Binary variable [0/1], coded 0/1 (upper level = 1). | |||||
| Raw p (no multiple-testing adjustment): * < 0.05, ** < 0.01, *** < 0.001; no star = p ≥ 0.05. | |||||
| Continuous: r_s = cov(rank_x, rank_y) / (SD(rank_x) × SD(rank_y)); t-test, n − 2 df. | |||||
| Binary [0/1]: r_s = r_rb × √(3pq), r_rb = 2 AUC − 1 (rank-biserial, ≡ Mann-Whitney test), p, q = group proportions; |r_s| ≤ 0.87, not comparable with continuous pairs. | |||||
| Confidence intervals: tbl_cor(layout = "long"). | |||||
| Notation: Makowski D, Ben-Shachar MS, Patil I, Lüdecke D (2020), J Open Source Softw 5(51):2306, doi:10.21105/joss.02306. | |||||
tbl_cor(cm, layout = "long")| Spearman correlations | ||||||
| Spearman correlation, unadjusted | pairwise complete N = 142–146 | Computed with psych::corr.test() {psych}; p adjustment: none (raw p-values) | ||||||
| Variable 1 | Variable 2 | Pair | n | rₛ | 95% CI | p (raw) |
|---|---|---|---|---|---|---|
| CRP | IL-6 | cont × cont | 142 | 0.41 | [0.26, 0.54] | < 0.001 *** |
| CRP | BDNF | cont × cont | 142 | -0.14 | [-0.30, 0.03] | 0.099 |
| CRP | NfL | cont × cont | 142 | 0.12 | [-0.05, 0.29] | 0.145 |
| CRP | CRP high [0/1] | cont × bin | 146 | 0.87 | [0.82, 0.90] | < 0.001 *** |
| IL-6 | BDNF | cont × cont | 142 | -0.23 | [-0.38, -0.06] | 0.007 ** |
| IL-6 | NfL | cont × cont | 142 | 0.08 | [-0.09, 0.25] | 0.344 |
| IL-6 | CRP high [0/1] | cont × bin | 142 | 0.30 | [0.14, 0.45] | < 0.001 *** |
| BDNF | NfL | cont × cont | 142 | -0.05 | [-0.21, 0.12] | 0.581 |
| BDNF | CRP high [0/1] | cont × bin | 142 | -0.10 | [-0.26, 0.07] | 0.239 |
| NfL | CRP high [0/1] | cont × bin | 142 | 0.12 | [-0.05, 0.29] | 0.145 |
| Pair: cont = continuous, bin = binary[0/1]. Bold = p < 0.05. | ||||||
| Raw p (no multiple-testing adjustment): * < 0.05, ** < 0.01, *** < 0.001; no star = p ≥ 0.05. | ||||||
| Continuous: r_s = cov(rank_x, rank_y) / (SD(rank_x) × SD(rank_y)); t-test, n − 2 df. | ||||||
| 95% CI: Fisher z transformation, SE = √(1.06 / (n − 3)) (Fieller et al. 1957); computed with correlation::cor_to_ci() {correlation}. | ||||||
| Binary [0/1]: r_s = r_rb × √(3pq), r_rb = 2 AUC − 1 (rank-biserial, ≡ Mann-Whitney test), p, q = group proportions; |r_s| ≤ 0.87, not comparable with continuous pairs. | ||||||
| Notation: Makowski D, Ben-Shachar MS, Patil I, Lüdecke D (2020), J Open Source Softw 5(51):2306, doi:10.21105/joss.02306. | ||||||
cc <- cor_compute(d, c("CRP", "IL6", "BIN_CRP"), c("depression", "fatigue"),
covariates = "age", labels = lab)
tbl_cor(cc) # wide| Spearman correlations | ||
| Spearman correlation, partial, adjusted for Age | N = 142–143 | Computed with ppcor::pcor.test() {ppcor}; p adjustment: none (raw p-values) | ||
| Depression score | Fatigue score | |
|---|---|---|
| Continuous | ||
| CRP | 0.22** | 0.07 |
| IL-6 | 0.35*** | 0.38*** |
| Binary [0/1] | ||
| CRP high [0/1]1 | 0.18* | 0.07 |
| 1 [0/1] binary: r_s ≈ Mann-Whitney (rank difference between groups); |r_s| ≤ √(3pq) ≤ 0.87, not comparable with continuous variables | ||
| Cells: r_s and stars; colour = same scale as the heatmap (blue < 0 < red). Confidence intervals: tbl_cor(layout = "long"). | ||
| Raw p (no multiple-testing adjustment): * < 0.05, ** < 0.01, *** < 0.001; no star = p ≥ 0.05. | ||
| Continuous: r_s = cov(rank_x, rank_y) / (SD(rank_x) × SD(rank_y)); partial: r_s,xy.z = r(e_x.z, e_y.z), residuals of the ranks on the k = 1 covariate terms z; t-test, n − 2 − k df. | ||
| Binary [0/1]: r_s = r_rb × √(3pq), r_rb = 2 AUC − 1 (rank-biserial, ≡ Mann-Whitney test), p, q = group proportions; |r_s| ≤ 0.87, not comparable with continuous pairs. | ||
| Notation: Makowski D, Ben-Shachar MS, Patil I, Lüdecke D (2020), J Open Source Softw 5(51):2306, doi:10.21105/joss.02306. | ||