Shared Decision-Making, Decisional Conflict, and Decisional Regret in Rectal Cancer Watch-and-Wait

Author

Oduyale O, Gaetani R, et al.

Published

December 1, 2026

1. Setup & Data Preparation

Load required packages, ensure all scale columns are stored as numeric vectors, and isolate the time-stratified subgroups (<= 3 months for Decisional Conflict; > 3 months for Decisional Regret).

Code
library(dplyr)
library(DescTools)

library(readxl)
clean_washuv2 <- read_excel("~/Desktop/clean_washuv2.xls")

# Ensure all continuous score columns are strictly numeric
score_cols <- c("sdm_9_100", "dcs_score100", "drs_score100", "lars_score")

clean_washuv2[score_cols] <- lapply(clean_washuv2[score_cols], function(x) {
  as.numeric(as.character(x))
})

# Create clinical LARS severity categories
clean_washuv2$lars_cat <- cut(
  clean_washuv2$lars_score,
  breaks = c(-Inf, 20, 29, Inf),
  labels = c("No LARS (0-20)", "Minor LARS (21-29)", "Major LARS (30-42)")
)

# Isolate the DCS subgroup (<= 3 months post-enrollment, n = 22)
dcs_only <- subset(clean_washuv2, is.na(drs_score100) & !is.na(dcs_score100))

# Verify non-missing sample sizes across all scales
colSums(!is.na(clean_washuv2[score_cols]))
   sdm_9_100 dcs_score100 drs_score100   lars_score 
          53           22           31           51 

2. Normality Assessment (Shapiro-Wilk Tests)

All continuous patient-reported outcome scales are tested for normality to determine whether parametric (mean/SD) or non-parametric (median/IQR) methods are appropriate.

Code
normality_summary <- do.call(rbind, lapply(score_cols, function(col) {
  vec <- if (col == "dcs_score100") dcs_only[[col]] else clean_washuv2[[col]]
  test <- shapiro.test(vec)
  data.frame(
    Scale = col,
    N = sum(!is.na(vec)),
    W_Statistic = round(test$statistic, 3),
    P_Value = signif(test$p.value, 3),
    Distribution = ifelse(test$p.value > 0.05, "Normal", "Non-Normal (Use Median/IQR)")
  )
}))

knitr::kable(normality_summary, row.names = FALSE)
Scale N W_Statistic P_Value Distribution
sdm_9_100 53 0.807 7.00e-07 Non-Normal (Use Median/IQR)
dcs_score100 20 0.469 2.00e-07 Non-Normal (Use Median/IQR)
drs_score100 31 0.625 1.00e-07 Non-Normal (Use Median/IQR)
lars_score 51 0.928 4.05e-03 Non-Normal (Use Median/IQR)

3. Descriptive Statistics (Medians, IQRs, and Prevalence)

Because all four scales are non-normal (p < 0.01), scores are summarized using medians and interquartile ranges (25th–75th percentiles), alongside clinical threshold counts.

Code
# Helper function to format Median (IQR)
med_iqr <- function(x) {
  q <- quantile(x, probs = c(0.25, 0.50, 0.75), na.rm = TRUE)
  sprintf("%.1f (%.1f - %.1f)", q[2], q[1], q[3])
}

desc_table <- data.frame(
  Measure = c("SDM-Q-9 (0-100)", "LARS Score (0-42)", "DRS Score (>3 mo)", "DCS Score (<=3 mo)"),
  N = c(
    sum(!is.na(clean_washuv2$sdm_9_100)),
    sum(!is.na(clean_washuv2$lars_score)),
    sum(!is.na(clean_washuv2$drs_score100)),
    sum(!is.na(dcs_only$dcs_score100))
  ),
  Median_IQR = c(
    med_iqr(clean_washuv2$sdm_9_100),
    med_iqr(clean_washuv2$lars_score),
    med_iqr(clean_washuv2$drs_score100),
    med_iqr(dcs_only$dcs_score100)
  )
)

knitr::kable(desc_table, row.names = FALSE)
Measure N Median_IQR
SDM-Q-9 (0-100) 53 91.1 (77.8 - 100.0)
LARS Score (0-42) 51 22.0 (8.0 - 30.5)
DRS Score (>3 mo) 31 0.0 (0.0 - 10.0)
DCS Score (<=3 mo) 20 0.0 (0.0 - 1.2)
Code
# Categorical prevalence counts
table(SDM_Group = clean_washuv2$sdm_binary)
SDM_Group
High  Low 
  33   20 
Code
table(LARS_Severity = clean_washuv2$lars_cat, useNA = "ifany")
LARS_Severity
    No LARS (0-20) Minor LARS (21-29) Major LARS (30-42)               <NA> 
                25                 12                 14                  2 
Code
table(Any_Regret_DRS_gt_0 = clean_washuv2$drs_score100 > 0)
Any_Regret_DRS_gt_0
FALSE  TRUE 
   18    13 
Code
table(Strong_Regret_DRS_gt_25 = clean_washuv2$drs_score100 > 25)
Strong_Regret_DRS_gt_25
FALSE  TRUE 
   29     2 
Code
table(Any_Conflict_DCS_gt_0 = dcs_only$dcs_score100 > 0)
Any_Conflict_DCS_gt_0
FALSE  TRUE 
   15     5 
Code
table(High_Conflict_DCS_gt_30 = dcs_only$dcs_score100 > 30)
High_Conflict_DCS_gt_30
FALSE  TRUE 
   19     1 

4. Primary Analysis: Continuous SDM-Q-9 Associations

SDM-Q-9 is evaluated primarily on its native continuous 0–100 scale across sociodemographic factors, regret/conflict status, and rank correlations.

4A. SDM-Q-9 by Household Income (N = 53)

Code
tapply(clean_washuv2$sdm_9_100, clean_washuv2$income, med_iqr)
       Above $150,000        Below $150,000                    NA 
"98.9 (91.1 - 100.0)"  "86.7 (77.8 - 97.8)"  "75.6 (75.6 - 75.6)" 
 Prefer not to answer 
 "77.8 (76.7 - 80.0)" 
Code
kruskal.test(sdm_9_100 ~ income, data = clean_washuv2)

    Kruskal-Wallis rank sum test

data:  sdm_9_100 by income
Kruskal-Wallis chi-squared = 7.3283, df = 3, p-value = 0.06214

4B. Continuous SDM-Q-9 by Regret and Conflict Status

Code
# Zero Regret (DRS = 0) vs. Any Regret (DRS > 0)
tapply(clean_washuv2$sdm_9_100, clean_washuv2$drs_score100 > 0, med_iqr)
                FALSE                  TRUE 
"97.8 (91.1 - 100.0)" "80.0 (77.8 - 100.0)" 
Code
wilcox.test(sdm_9_100 ~ (drs_score100 > 0), data = clean_washuv2)

    Wilcoxon rank sum test with continuity correction

data:  sdm_9_100 by drs_score100 > 0
W = 155.5, p-value = 0.1208
alternative hypothesis: true location shift is not equal to 0
Code
# Zero Conflict (DCS = 0) vs. Any Conflict (DCS > 0)
tapply(dcs_only$sdm_9_100, dcs_only$dcs_score100 > 0, med_iqr)
               FALSE                 TRUE 
"84.4 (76.7 - 98.9)" "80.0 (75.6 - 86.7)" 
Code
wilcox.test(sdm_9_100 ~ (dcs_score100 > 0), data = dcs_only)

    Wilcoxon rank sum test with continuity correction

data:  sdm_9_100 by dcs_score100 > 0
W = 46, p-value = 0.4822
alternative hypothesis: true location shift is not equal to 0

4C. Spearman Rank Correlations (ρ with 95% CIs)

Code
# SDM-Q-9 vs. Decisional Regret (n = 31)
cor.test(clean_washuv2$sdm_9_100, clean_washuv2$drs_score100, method = "spearman", exact = FALSE)

    Spearman's rank correlation rho

data:  clean_washuv2$sdm_9_100 and clean_washuv2$drs_score100
S = 6180, p-value = 0.1823
alternative hypothesis: true rho is not equal to 0
sample estimates:
       rho 
-0.2459584 
Code
SpearmanRho(clean_washuv2$sdm_9_100, clean_washuv2$drs_score100, conf.level = 0.95, use = "complete.obs")
       rho     lwr.ci     upr.ci 
-0.2459584 -0.5521748  0.1187294 
Code
# SDM-Q-9 vs. Decisional Conflict (n = 22)
cor.test(dcs_only$sdm_9_100, dcs_only$dcs_score100, method = "spearman", exact = FALSE)

    Spearman's rank correlation rho

data:  dcs_only$sdm_9_100 and dcs_only$dcs_score100
S = 1547.5, p-value = 0.4909
alternative hypothesis: true rho is not equal to 0
sample estimates:
       rho 
-0.1635299 
Code
SpearmanRho(dcs_only$sdm_9_100, dcs_only$dcs_score100, conf.level = 0.95, use = "complete.obs")
       rho     lwr.ci     upr.ci 
-0.1635299 -0.5651531  0.3007552 
Code
# Bowel Function (LARS) vs. Regret & Conflict
cor.test(clean_washuv2$lars_score, clean_washuv2$drs_score100, method = "spearman", exact = FALSE)

    Spearman's rank correlation rho

data:  clean_washuv2$lars_score and clean_washuv2$drs_score100
S = 2811.9, p-value = 0.1048
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.3074021 
Code
cor.test(dcs_only$lars_score, dcs_only$dcs_score100, method = "spearman", exact = FALSE)

    Spearman's rank correlation rho

data:  dcs_only$lars_score and dcs_only$dcs_score100
S = 977.37, p-value = 0.2586
alternative hypothesis: true rho is not equal to 0
sample estimates:
      rho 
0.2651365 

5. Secondary Exploratory Analysis: Low vs. High SDM (<80.5 vs. ≥80.5)

Participants are stratified at the cohort mean (80.5) to evaluate threshold effects using Fisher’s exact test and Wilcoxon rank-sum tests.

Code
# Decisional Regret (> 3 months, n = 31)
table(SDM = clean_washuv2$sdm_binary, Any_Regret = clean_washuv2$drs_score100 > 0)
      Any_Regret
SDM    FALSE TRUE
  High    15    6
  Low      3    7
Code
fisher.test(table(clean_washuv2$sdm_binary, clean_washuv2$drs_score100 > 0))

    Fisher's Exact Test for Count Data

data:  table(clean_washuv2$sdm_binary, clean_washuv2$drs_score100 > 0)
p-value = 0.05155
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
  0.8845489 44.4908934
sample estimates:
odds ratio 
  5.467372 
Code
fisher.test(table(clean_washuv2$sdm_binary, clean_washuv2$drs_score100 > 25))

    Fisher's Exact Test for Count Data

data:  table(clean_washuv2$sdm_binary, clean_washuv2$drs_score100 > 25)
p-value = 1
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
   0.02550154 182.70459355
sample estimates:
odds ratio 
  2.160286 
Code
# Decisional Conflict (<= 3 months, n = 22)
table(SDM = dcs_only$sdm_binary, Any_Conflict = dcs_only$dcs_score100 > 0)
      Any_Conflict
SDM    FALSE TRUE
  High     8    2
  Low      7    3
Code
fisher.test(table(dcs_only$sdm_binary, dcs_only$dcs_score100 > 0))

    Fisher's Exact Test for Count Data

data:  table(dcs_only$sdm_binary, dcs_only$dcs_score100 > 0)
p-value = 1
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
  0.1441618 25.6043943
sample estimates:
odds ratio 
  1.668591 
Code
fisher.test(table(dcs_only$sdm_binary, dcs_only$dcs_score100 > 30))

    Fisher's Exact Test for Count Data

data:  table(dcs_only$sdm_binary, dcs_only$dcs_score100 > 30)
p-value = 1
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
  0.00000 39.00055
sample estimates:
odds ratio 
         0 
Code
# Bowel Function (LARS) by SDM Group and Regret Status
tapply(clean_washuv2$lars_score, clean_washuv2$sdm_binary, med_iqr)
               High                 Low 
"22.0 (9.0 - 31.0)" "21.0 (8.0 - 26.8)" 
Code
wilcox.test(lars_score ~ sdm_binary, data = clean_washuv2)

    Wilcoxon rank sum test with continuity correction

data:  lars_score by sdm_binary
W = 324, p-value = 0.6008
alternative hypothesis: true location shift is not equal to 0
Code
tapply(clean_washuv2$lars_score, clean_washuv2$drs_score100 > 0, med_iqr)
               FALSE                 TRUE 
 "16.0 (2.0 - 30.0)" "23.0 (20.2 - 33.0)" 
Code
wilcox.test(lars_score ~ (drs_score100 > 0), data = clean_washuv2)

    Wilcoxon rank sum test with continuity correction

data:  lars_score by drs_score100 > 0
W = 69, p-value = 0.1483
alternative hypothesis: true location shift is not equal to 0

6. Table 1 outputs

Code
# Helper function for Median (IQR)
med_iqr <- function(x) {
  q <- quantile(x, probs = c(0.25, 0.50, 0.75), na.rm = TRUE)
  sprintf("%.1f (%.1f-%.1f)", q, q, q)
}

# 1. Categorical Table 1 Variables (excluding SVI and nom_fail)
cat_vars <- c(
  "location", "gender", "race", "health_lit_group",
  "education_group", "income", "cps_role", "lars_category"
)

for (v in cat_vars) {
  cat("\n========================================\n")
  cat("VARIABLE:", v, "\n")
  cat("========================================\n")
  
  # Overall N (%)
  tbl_all <- table(clean_washuv2[[v]], useNA = "ifany")
  pct_all <- round(prop.table(table(clean_washuv2[[v]])) * 100, 1)
  print(cbind(Overall_N = tbl_all[names(pct_all)], Overall_Pct = pct_all))
  
  # Continuous SDM-Q-9 Median (IQR) per category + Kruskal/Wilcoxon p-value
  cat("\nContinuous SDM-Q-9 Median (IQR):\n")
  print(tapply(clean_washuv2$sdm_9_100, clean_washuv2[[v]], med_iqr))
  print(kruskal.test(clean_washuv2$sdm_9_100 ~ clean_washuv2[[v]]))
  
  # Exploratory Low vs High SDM counts (%) + Fisher's exact p-value
  cat("\nExploratory Low vs High SDM:\n")
  ct <- table(Category = clean_washuv2[[v]], SDM = clean_washuv2$sdm_binary)
  print(ct)
  print(round(prop.table(ct, margin = 2) * 100, 1))
  print(fisher.test(ct))
}

========================================
VARIABLE: location 
========================================
   Overall_N Overall_Pct
MA        29        54.7
MO        24        45.3

Continuous SDM-Q-9 Median (IQR):
$MA
[1] "80.0 (80.0-80.0)"    "95.6 (95.6-95.6)"    "100.0 (100.0-100.0)"

$MO
[1] "74.4 (74.4-74.4)"    "85.6 (85.6-85.6)"    "100.0 (100.0-100.0)"


    Kruskal-Wallis rank sum test

data:  clean_washuv2$sdm_9_100 by clean_washuv2[[v]]
Kruskal-Wallis chi-squared = 1.1087, df = 1, p-value = 0.2924


Exploratory Low vs High SDM:
        SDM
Category High Low
      MA   20   9
      MO   13  11
        SDM
Category High  Low
      MA 60.6 45.0
      MO 39.4 55.0

    Fisher's Exact Test for Count Data

data:  ct
p-value = 0.3937
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
 0.530542 6.717403
sample estimates:
odds ratio 
  1.857632 


========================================
VARIABLE: gender 
========================================
  Overall_N Overall_Pct
F        22        41.5
M        31        58.5

Continuous SDM-Q-9 Median (IQR):
$F
[1] "80.6 (80.6-80.6)" "94.4 (94.4-94.4)" "99.4 (99.4-99.4)"

$M
[1] "77.8 (77.8-77.8)"    "91.1 (91.1-91.1)"    "100.0 (100.0-100.0)"


    Kruskal-Wallis rank sum test

data:  clean_washuv2$sdm_9_100 by clean_washuv2[[v]]
Kruskal-Wallis chi-squared = 0.0068111, df = 1, p-value = 0.9342


Exploratory Low vs High SDM:
        SDM
Category High Low
       F   16   6
       M   17  14
        SDM
Category High  Low
       F 48.5 30.0
       M 51.5 70.0

    Fisher's Exact Test for Count Data

data:  ct
p-value = 0.2533
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
 0.5949816 8.6674680
sample estimates:
odds ratio 
  2.163729 


========================================
VARIABLE: race 
========================================
                   Overall_N Overall_Pct
Black                      1         1.9
Hispanic or Latino         1         1.9
White                     51        96.2

Continuous SDM-Q-9 Median (IQR):
$Black
[1] "60.0 (60.0-60.0)" "60.0 (60.0-60.0)" "60.0 (60.0-60.0)"

$`Hispanic or Latino`
[1] "68.9 (68.9-68.9)" "68.9 (68.9-68.9)" "68.9 (68.9-68.9)"

$White
[1] "78.9 (78.9-78.9)"    "93.3 (93.3-93.3)"    "100.0 (100.0-100.0)"


    Kruskal-Wallis rank sum test

data:  clean_washuv2$sdm_9_100 by clean_washuv2[[v]]
Kruskal-Wallis chi-squared = 5.0876, df = 2, p-value = 0.07857


Exploratory Low vs High SDM:
                    SDM
Category             High Low
  Black                 0   1
  Hispanic or Latino    0   1
  White                33  18
                    SDM
Category             High Low
  Black                 0   5
  Hispanic or Latino    0   5
  White               100  90

    Fisher's Exact Test for Count Data

data:  ct
p-value = 0.1379
alternative hypothesis: two.sided


========================================
VARIABLE: health_lit_group 
========================================
         Overall_N Overall_Pct
High            50        94.3
Low              1         1.9
Moderate         2         3.8

Continuous SDM-Q-9 Median (IQR):
$High
[1] "77.8 (77.8-77.8)"    "94.4 (94.4-94.4)"    "100.0 (100.0-100.0)"

$Low
[1] "80.0 (80.0-80.0)" "80.0 (80.0-80.0)" "80.0 (80.0-80.0)"

$Moderate
[1] "67.2 (67.2-67.2)" "74.4 (74.4-74.4)" "81.7 (81.7-81.7)"


    Kruskal-Wallis rank sum test

data:  clean_washuv2$sdm_9_100 by clean_washuv2[[v]]
Kruskal-Wallis chi-squared = 2.0404, df = 2, p-value = 0.3605


Exploratory Low vs High SDM:
          SDM
Category   High Low
  High       32  18
  Low         0   1
  Moderate    1   1
          SDM
Category   High Low
  High       97  90
  Low         0   5
  Moderate    3   5

    Fisher's Exact Test for Count Data

data:  ct
p-value = 0.4666
alternative hypothesis: two.sided


========================================
VARIABLE: education_group 
========================================
                       Overall_N Overall_Pct
College or higher             35          66
High school or less            9          17
Some college/technical         9          17

Continuous SDM-Q-9 Median (IQR):
$`College or higher`
[1] "77.8 (77.8-77.8)"    "97.8 (97.8-97.8)"    "100.0 (100.0-100.0)"

$`High school or less`
[1] "71.1 (71.1-71.1)" "80.0 (80.0-80.0)" "84.4 (84.4-84.4)"

$`Some college/technical`
[1] "80.0 (80.0-80.0)"    "86.7 (86.7-86.7)"    "100.0 (100.0-100.0)"


    Kruskal-Wallis rank sum test

data:  clean_washuv2$sdm_9_100 by clean_washuv2[[v]]
Kruskal-Wallis chi-squared = 5.1368, df = 2, p-value = 0.07666


Exploratory Low vs High SDM:
                        SDM
Category                 High Low
  College or higher        24  11
  High school or less       3   6
  Some college/technical    6   3
                        SDM
Category                 High  Low
  College or higher      72.7 55.0
  High school or less     9.1 30.0
  Some college/technical 18.2 15.0

    Fisher's Exact Test for Count Data

data:  ct
p-value = 0.1864
alternative hypothesis: two.sided


========================================
VARIABLE: income 
========================================
                     Overall_N Overall_Pct
Above $150,000              20        37.7
Below $150,000              29        54.7
NA                           1         1.9
Prefer not to answer         3         5.7

Continuous SDM-Q-9 Median (IQR):
$`Above $150,000`
[1] "91.1 (91.1-91.1)"    "98.9 (98.9-98.9)"    "100.0 (100.0-100.0)"

$`Below $150,000`
[1] "77.8 (77.8-77.8)" "86.7 (86.7-86.7)" "97.8 (97.8-97.8)"

$`NA`
[1] "75.6 (75.6-75.6)" "75.6 (75.6-75.6)" "75.6 (75.6-75.6)"

$`Prefer not to answer`
[1] "76.7 (76.7-76.7)" "77.8 (77.8-77.8)" "80.0 (80.0-80.0)"


    Kruskal-Wallis rank sum test

data:  clean_washuv2$sdm_9_100 by clean_washuv2[[v]]
Kruskal-Wallis chi-squared = 7.3283, df = 3, p-value = 0.06214


Exploratory Low vs High SDM:
                      SDM
Category               High Low
  Above $150,000         16   4
  Below $150,000         16  13
  NA                      0   1
  Prefer not to answer    1   2
                      SDM
Category               High  Low
  Above $150,000       48.5 20.0
  Below $150,000       48.5 65.0
  NA                    0.0  5.0
  Prefer not to answer  3.0 10.0

    Fisher's Exact Test for Count Data

data:  ct
p-value = 0.07034
alternative hypothesis: two.sided


========================================
VARIABLE: cps_role 
========================================
                   Overall_N Overall_Pct
Active role               29        54.7
Collaborative role        22        41.5
Passive role               2         3.8

Continuous SDM-Q-9 Median (IQR):
$`Active role`
[1] "77.8 (77.8-77.8)"    "95.6 (95.6-95.6)"    "100.0 (100.0-100.0)"

$`Collaborative role`
[1] "76.1 (76.1-76.1)" "82.2 (82.2-82.2)" "99.4 (99.4-99.4)"

$`Passive role`
[1] "86.7 (86.7-86.7)" "91.1 (91.1-91.1)" "95.6 (95.6-95.6)"


    Kruskal-Wallis rank sum test

data:  clean_washuv2$sdm_9_100 by clean_washuv2[[v]]
Kruskal-Wallis chi-squared = 1.0398, df = 2, p-value = 0.5946


Exploratory Low vs High SDM:
                    SDM
Category             High Low
  Active role          20   9
  Collaborative role   11  11
  Passive role          2   0
                    SDM
Category             High  Low
  Active role        60.6 45.0
  Collaborative role 33.3 55.0
  Passive role        6.1  0.0

    Fisher's Exact Test for Count Data

data:  ct
p-value = 0.3024
alternative hypothesis: two.sided


========================================
VARIABLE: lars_category 
========================================
      Overall_N Overall_Pct
major        14        27.5
minor        12        23.5
no           25        49.0

Continuous SDM-Q-9 Median (IQR):
$major
[1] "74.4 (74.4-74.4)" "90.0 (90.0-90.0)" "97.8 (97.8-97.8)"

$minor
[1] "77.2 (77.2-77.2)"    "96.7 (96.7-96.7)"    "100.0 (100.0-100.0)"

$no
[1] "80.0 (80.0-80.0)"    "95.6 (95.6-95.6)"    "100.0 (100.0-100.0)"


    Kruskal-Wallis rank sum test

data:  clean_washuv2$sdm_9_100 by clean_washuv2[[v]]
Kruskal-Wallis chi-squared = 0.54076, df = 2, p-value = 0.7631


Exploratory Low vs High SDM:
        SDM
Category High Low
   major   10   4
   minor    7   5
   no      16   9
        SDM
Category High  Low
   major 30.3 22.2
   minor 21.2 27.8
   no    48.5 50.0

    Fisher's Exact Test for Count Data

data:  ct
p-value = 0.866
alternative hypothesis: two.sided
Code
# 2. Continuous Table 1 Variables (Age and LARS Score only)
cont_vars <- c("age", "lars_score")

for (cv in cont_vars) {
  cat("\n========================================\n")
  cat("CONTINUOUS VARIABLE:", cv, "\n")
  cat("========================================\n")
  
  vec <- as.numeric(as.character(clean_washuv2[[cv]]))
  cat("Overall Median (IQR):", med_iqr(vec), "\n")
  cat("By SDM Group:\n")
  print(tapply(vec, clean_washuv2$sdm_binary, med_iqr))
  print(wilcox.test(vec ~ clean_washuv2$sdm_binary))
  cat("Spearman correlation with Continuous SDM-Q-9:\n")
  print(cor.test(vec, clean_washuv2$sdm_9_100, method = "spearman", exact = FALSE))
}

========================================
CONTINUOUS VARIABLE: age 
========================================
Overall Median (IQR): 55.7 (55.7-55.7) 61.4 (61.4-61.4) 71.4 (71.4-71.4) 
By SDM Group:
$High
[1] "54.1 (54.1-54.1)" "59.9 (59.9-59.9)" "67.7 (67.7-67.7)"

$Low
[1] "60.0 (60.0-60.0)" "67.2 (67.2-67.2)" "72.4 (72.4-72.4)"


    Wilcoxon rank sum exact test

data:  vec by clean_washuv2$sdm_binary
W = 245, p-value = 0.1217
alternative hypothesis: true location shift is not equal to 0

Spearman correlation with Continuous SDM-Q-9:

    Spearman's rank correlation rho

data:  vec and clean_washuv2$sdm_9_100
S = 28200, p-value = 0.3282
alternative hypothesis: true rho is not equal to 0
sample estimates:
       rho 
-0.1369329 


========================================
CONTINUOUS VARIABLE: lars_score 
========================================
Overall Median (IQR): 8.0 (8.0-8.0) 22.0 (22.0-22.0) 30.5 (30.5-30.5) 
By SDM Group:
$High
[1] "9.0 (9.0-9.0)"    "22.0 (22.0-22.0)" "31.0 (31.0-31.0)"

$Low
[1] "8.0 (8.0-8.0)"    "21.0 (21.0-21.0)" "26.8 (26.8-26.8)"

    Wilcoxon rank sum test with continuity correction

data:  vec by clean_washuv2$sdm_binary
W = 324, p-value = 0.6008
alternative hypothesis: true location shift is not equal to 0

Spearman correlation with Continuous SDM-Q-9:

    Spearman's rank correlation rho

data:  vec and clean_washuv2$sdm_9_100
S = 24049, p-value = 0.5383
alternative hypothesis: true rho is not equal to 0
sample estimates:
       rho 
-0.0881792 

7. Table 1 based on SDMQ9 binary

Code
# Run install.packages(c("gtsummary", "flextable", "dplyr")) once if not installed
library(gtsummary)
library(flextable)
library(dplyr)

# 1. Prepare clean labels and variable types
t1_data <- clean_washuv2 %>%
  mutate(
    age = as.numeric(as.character(age)),
    lars_score = as.numeric(as.character(lars_score)),
    sdm_9_100 = as.numeric(as.character(sdm_9_100)),
    sdm_binary = factor(sdm_binary, levels = c("Low", "High"), labels = c("Low SDM (<80.5)", "High SDM (>=80.5)"))
  ) %>%
  select(
    sdm_binary, sdm_9_100, age, gender, race, location,
    health_lit_group, education_group, income, cps_role,
    lars_score, lars_category
  )

# 2. Generate Table 1 (Overall + Stratified by Low vs. High SDM)
table1 <- t1_data %>%
  tbl_summary(
    by = sdm_binary,
    statistic = list(
      all_continuous() ~ "{median} ({p25}–{p75})",
      all_categorical() ~ "{n} ({p}%)"
    ),
    digits = list(
      all_continuous() ~ 1,
      all_categorical() ~ c(0, 1)
    ),
    label = list(
      sdm_9_100 ~ "SDM-Q-9 Score (0–100)",
      age ~ "Age, years",
      gender ~ "Gender",
      race ~ "Race",
      location ~ "Study Site",
      health_lit_group ~ "Health Literacy",
      education_group ~ "Education Level",
      income ~ "Annual Household Income",
      cps_role ~ "Control Preferences Role",
      lars_score ~ "LARS Score (0–42)",
      lars_category ~ "LARS Severity Category"
    ),
    missing = "ifany",
    missing_text = "Missing"
  ) %>%
  add_overall(last = FALSE) %>%
  add_p(test = list(
    all_continuous() ~ "wilcox.test",
    all_categorical() ~ "fisher.test"
  )) %>%
  bold_labels() %>%
  modify_header(label ~ "**Characteristic**")

# 3. View in RStudio Viewer
table1
Characteristic Overall
N = 531
Low SDM (<80.5)
N = 201
High SDM (>=80.5)
N = 331
p-value2
SDM-Q-9 Score (0–100) 91.1 (77.8–100.0) 75.6 (70.0–78.9) 97.8 (95.6–100.0) <0.001
Age, years 61.4 (55.7–71.4) 67.2 (59.3–72.4) 59.9 (54.1–67.7) 0.12
Gender


0.3
    F 22 (41.5%) 6 (30.0%) 16 (48.5%)
    M 31 (58.5%) 14 (70.0%) 17 (51.5%)
Race


0.14
    Black 1 (1.9%) 1 (5.0%) 0 (0.0%)
    Hispanic or Latino 1 (1.9%) 1 (5.0%) 0 (0.0%)
    White 51 (96.2%) 18 (90.0%) 33 (100.0%)
Study Site


0.4
    MA 29 (54.7%) 9 (45.0%) 20 (60.6%)
    MO 24 (45.3%) 11 (55.0%) 13 (39.4%)
Health Literacy


0.5
    High 50 (94.3%) 18 (90.0%) 32 (97.0%)
    Low 1 (1.9%) 1 (5.0%) 0 (0.0%)
    Moderate 2 (3.8%) 1 (5.0%) 1 (3.0%)
Education Level


0.2
    College or higher 35 (66.0%) 11 (55.0%) 24 (72.7%)
    High school or less 9 (17.0%) 6 (30.0%) 3 (9.1%)
    Some college/technical 9 (17.0%) 3 (15.0%) 6 (18.2%)
Annual Household Income


0.070
    Above $150,000 20 (37.7%) 4 (20.0%) 16 (48.5%)
    Below $150,000 29 (54.7%) 13 (65.0%) 16 (48.5%)
    NA 1 (1.9%) 1 (5.0%) 0 (0.0%)
    Prefer not to answer 3 (5.7%) 2 (10.0%) 1 (3.0%)
Control Preferences Role


0.3
    Active role 29 (54.7%) 9 (45.0%) 20 (60.6%)
    Collaborative role 22 (41.5%) 11 (55.0%) 11 (33.3%)
    Passive role 2 (3.8%) 0 (0.0%) 2 (6.1%)
LARS Score (0–42) 22.0 (7.0–31.0) 21.0 (7.0–27.0) 22.0 (9.0–31.0) 0.6
    Missing 2 2 0
LARS Severity Category


0.9
    major 14 (27.5%) 4 (22.2%) 10 (30.3%)
    minor 12 (23.5%) 5 (27.8%) 7 (21.2%)
    no 25 (49.0%) 9 (50.0%) 16 (48.5%)
    Missing 2 2 0
1 Median (Q1–Q3); n (%)
2 Wilcoxon rank sum test; Wilcoxon rank sum exact test; Fisher’s exact test
Code
# 4. Export directly to a formatted Word document
table1 %>%
  as_flex_table() %>%
  save_as_docx(path = "Table1_WatchAndWait.docx")

8. table 1 based on SDMQ9 continuous

Code
library(gtsummary)
library(flextable)
library(dplyr)

# 1. Prepare clean dataset
t1_data <- clean_washuv2 %>%
  mutate(
    age = as.numeric(as.character(age)),
    lars_score = as.numeric(as.character(lars_score)),
    sdm_9_100 = as.numeric(as.character(sdm_9_100))
  ) %>%
  select(
    sdm_9_100, age, gender, race, location,
    health_lit_group, education_group, income, cps_role,
    lars_score, lars_category
  )

# 2. Left side: Overall Cohort Summary (N = 53)
t1_overall <- t1_data %>%
  tbl_summary(
    statistic = list(
      all_continuous() ~ "{median} ({p25}-{p75})",
      all_categorical() ~ "{n} ({p}%)"
    ),
    digits = list(
      all_continuous() ~ 1,
      all_categorical() ~ c(0, 1)
    ),
    label = list(
      sdm_9_100 ~ "SDM-Q-9 Score (0-100)",
      age ~ "Age, years",
      gender ~ "Gender",
      race ~ "Race",
      location ~ "Study Site",
      health_lit_group ~ "Health Literacy",
      education_group ~ "Education Level",
      income ~ "Annual Household Income",
      cps_role ~ "Control Preferences Role",
      lars_score ~ "LARS Score (0-42)",
      lars_category ~ "LARS Severity Category"
    ),
    missing = "ifany",
    missing_text = "Missing"
  ) %>%
  bold_labels()

# 3. Right side: Continuous SDM-Q-9 Median (IQR) & p-values across subgroups
t1_cont <- t1_data %>%
  select(-age, -lars_score) %>%
  tbl_continuous(
    variable = sdm_9_100,
    statistic = ~ "{median} ({p25}-{p75})",
    digits = ~ 1,
    label = list(
      gender ~ "Gender",
      race ~ "Race",
      location ~ "Study Site",
      health_lit_group ~ "Health Literacy",
      education_group ~ "Education Level",
      income ~ "Annual Household Income",
      cps_role ~ "Control Preferences Role",
      lars_category ~ "LARS Severity Category"
    )
  ) %>%
  add_p(test = ~ "kruskal.test") %>%
  bold_labels()

# 4. Merge side-by-side and export to Word
table1_final <- tbl_merge(
  tbls = list(t1_overall, t1_cont),
  tab_spanner = c("**Overall Cohort (N = 53)**", "**Continuous SDM-Q-9 Score**")
)

table1_final
Characteristic
Overall Cohort (N = 53)
Continuous SDM-Q-9 Score
N = 531 N = 532 p-value3
SDM-Q-9 Score (0-100) 91.1 (77.8-100.0)

Age, years 61.4 (55.7-71.4)

Gender

>0.9
    F 22 (41.5%) 94.4 (80.0-100.0)
    M 31 (58.5%) 91.1 (77.8-100.0)
Race

0.079
    Black 1 (1.9%) 60.0 (60.0-60.0)
    Hispanic or Latino 1 (1.9%) 68.9 (68.9-68.9)
    White 51 (96.2%) 93.3 (77.8-100.0)
Study Site

0.3
    MA 29 (54.7%) 95.6 (80.0-100.0)
    MO 24 (45.3%) 85.6 (73.3-100.0)
Health Literacy

0.4
    High 50 (94.3%) 94.4 (77.8-100.0)
    Low 1 (1.9%) 80.0 (80.0-80.0)
    Moderate 2 (3.8%) 74.4 (60.0-88.9)
Education Level

0.077
    College or higher 35 (66.0%) 97.8 (77.8-100.0)
    High school or less 9 (17.0%) 80.0 (71.1-84.4)
    Some college/technical 9 (17.0%) 86.7 (80.0-100.0)
Annual Household Income

0.062
    Above $150,000 20 (37.7%) 98.9 (88.9-100.0)
    Below $150,000 29 (54.7%) 86.7 (77.8-97.8)
    NA 1 (1.9%) 75.6 (75.6-75.6)
    Prefer not to answer 3 (5.7%) 77.8 (75.6-82.2)
Control Preferences Role

0.6
    Active role 29 (54.7%) 95.6 (77.8-100.0)
    Collaborative role 22 (41.5%) 82.2 (75.6-100.0)
    Passive role 2 (3.8%) 91.1 (82.2-100.0)
LARS Score (0-42) 22.0 (7.0-31.0)

    Missing 2

LARS Severity Category

0.8
    major 14 (27.5%) 90.0 (71.1-97.8)
    minor 12 (23.5%) 96.7 (76.7-100.0)
    no 25 (49.0%) 95.6 (80.0-100.0)
    Missing 2

1 Median (Q1-Q3); n (%)
2 sdm_9_100: Median (Q1-Q3)
3 Kruskal-Wallis rank sum test
Code
table1_final %>%
  as_flex_table() %>%
  save_as_docx(path = "Table1_Continuous_SDM.docx")

9. Plots for DR and DC based on cont SDM

Code
library(ggplot2)
library(dplyr)

drs_cont <- clean_washuv2 %>%
  filter(!is.na(drs_score100)) %>%
  mutate(regret_grp = ifelse(drs_score100 > 0, "Any Regret (DRS > 0)\nn = 13", "Zero Regret (DRS = 0)\nn = 18"))

p1 <- ggplot(drs_cont, aes(x = regret_grp, y = sdm_9_100, fill = regret_grp)) +
  geom_boxplot(width = 0.45, alpha = 0.7, outlier.shape = NA) +
  geom_jitter(width = 0.12, size = 2.2, alpha = 0.8) +
  scale_fill_manual(values = c("#93c5fd", "#e5e7eb")) +
  scale_y_continuous(limits = c(0, 105), breaks = seq(0, 100, 20)) +
  labs(title = "Perceived SDM by Decisional Regret (>3 Months)",
       subtitle = "Median 97.8 vs. 80.0 (Wilcoxon p = 0.121)",
       x = "", y = "Continuous SDM-Q-9 Score (0-100)") +
  theme_classic() +
  theme(legend.position = "none")

p1

Code
dcs_cont <- dcs_only %>%
  mutate(conflict_grp = ifelse(dcs_score100 > 0, "Any Conflict (DCS > 0)\nn = 5", "Zero Conflict (DCS = 0)\nn = 17"))

p2 <- ggplot(dcs_cont, aes(x = conflict_grp, y = sdm_9_100, fill = conflict_grp)) +
  geom_boxplot(width = 0.45, alpha = 0.7, outlier.shape = NA) +
  geom_jitter(width = 0.12, size = 2.2, alpha = 0.8) +
  scale_fill_manual(values = c("#fde68a", "#e5e7eb")) +
  scale_y_continuous(limits = c(0, 105), breaks = seq(0, 100, 20)) +
  labs(title = "Perceived SDM by Decisional Conflict (<=3 Months)",
       subtitle = "Median 88.9 vs. 80.0 (Wilcoxon p = 0.303)",
       x = "", y = "Continuous SDM-Q-9 Score (0-100)") +
  theme_classic() +
  theme(legend.position = "none")

p2

10. Plots for DC and DR based on low and high SDM

Code
library(ggplot2)
library(dplyr)

drs_plot <- clean_washuv2 %>%
  filter(!is.na(drs_score100)) %>%
  mutate(
    sdm_grp = ifelse(sdm_binary == "Low", "Low SDM (n=10)", "High SDM (n=21)"),
    tier = cut(drs_score100, c(-1, 0, 25, 101), labels = c("None (0)", "Mild (5-25)", "Strong (>25)"))
  ) %>%
  count(sdm_grp, tier) %>%
  group_by(sdm_grp) %>%
  mutate(pct = n / sum(n), lbl = ifelse(pct > 0.08, paste0(round(pct * 100, 1), "%"), ""))
Code
p1 <- ggplot(drs_plot, aes(x = sdm_grp, y = pct, fill = tier)) +
  geom_col(width = 0.5, color = "black") +
  geom_text(aes(label = lbl), position = position_stack(vjust = 0.5)) +
  scale_y_continuous(labels = scales::percent) +
  labs(title = "Decisional Regret (>3 Months)", x = "", y = "Patients (%)", fill = "DRS") +
  theme_classic()

p1

Code
dcs_plot <- dcs_only %>%
  mutate(
    sdm_grp = ifelse(sdm_binary == "Low", "Low SDM (n=10)", "High SDM (n=12)"),
    tier = cut(dcs_score100, c(-1, 0, 30, 101), labels = c("None (0)", "Mild (5-30)", "High (>30)"))
  ) %>%
  count(sdm_grp, tier) %>%
  group_by(sdm_grp) %>%
  mutate(pct = n / sum(n), lbl = ifelse(pct > 0.08, paste0(round(pct * 100, 1), "%"), ""))

p2 <- ggplot(dcs_plot, aes(x = sdm_grp, y = pct, fill = tier)) +
  geom_col(width = 0.5, color = "black") +
  geom_text(aes(label = lbl), position = position_stack(vjust = 0.5)) +
  scale_y_continuous(labels = scales::percent) +
  labs(title = "Decisional Conflict (<=3 Months)", x = "", y = "Patients (%)", fill = "DCS") +
  theme_classic()

p2

11. DCS stacked bar chart

Code
library(dplyr)
library(ggplot2)
library(ggrepel)

plot_df <- clean_washuv2 %>%
  filter(!is.na(dcs_score100)) %>%
  mutate(
    dcs_cat = factor(
      case_when(
        dcs_score100 < 25 ~ "Low / None (<25)",
        dcs_score100 <= 37.5 ~ "Moderate (25–37.5)",
        dcs_score100 > 37.5 ~ "High (>37.5)"
      ),
      levels = c("Low / None (<25)", "Moderate (25–37.5)", "High (>37.5)")
    )
  ) %>%
  count(dcs_cat) %>%
  arrange(desc(dcs_cat)) %>%
  mutate(
    pct = n / sum(n),
    # Midpoint of each stacked segment (reverse order matches ggplot stack)
    y_mid = cumsum(pct) - 0.5 * pct,
    label_txt = paste0(round(pct * 100, 1), "% (n=", n, ")")
  )

ggplot(plot_df, aes(x = "", y = pct, fill = dcs_cat)) +
  geom_col(width = 0.45) +
  geom_text_repel(
    aes(y = y_mid, label = label_txt),
    nudge_x = 0.45,
    direction = "y",
    hjust = 0,
    segment.size = 0.4,
    min.segment.length = 0,
    box.padding = 0.25,
    size = 3.5,
    show.legend = FALSE
  ) +
  scale_y_continuous(labels = scales::percent_format()) +
  scale_fill_brewer(palette = "Blues", name = "Decisional Conflict") +
  coord_cartesian(xlim = c(0.6, 1.9)) +
  labs(title = "Decisional Conflict Distribution", x = NULL, y = "Percentage of Respondents") +
  theme_minimal(base_size = 12) +
  theme(panel.grid.major.x = element_blank())

12. DRS stacked bar chart

Code
library(dplyr)
library(ggplot2)
library(ggrepel)

plot_drs_df <- clean_washuv2 %>%
  filter(!is.na(drs_score100)) %>%
  mutate(
    drs_cat = factor(
      case_when(
        drs_score100 <= 25 ~ "No / Low Regret (<=25)",
        drs_score100 > 25 ~ "Strong Regret (>25)"
      ),
      levels = c("No / Low Regret (<=25)", "Strong Regret (>25)")
    )
  ) %>%
  count(drs_cat) %>%
  arrange(desc(drs_cat)) %>%
  mutate(
    pct = n / sum(n),
    y_mid = cumsum(pct) - 0.5 * pct,
    label_txt = paste0(round(pct * 100, 1), "% (n=", n, ")")
  )

ggplot(plot_drs_df, aes(x = "", y = pct, fill = drs_cat)) +
  geom_col(width = 0.45) +
  geom_text_repel(
    aes(y = y_mid, label = label_txt),
    nudge_x = 0.45,
    direction = "y",
    hjust = 0,
    segment.size = 0.4,
    min.segment.length = 0,
    box.padding = 0.25,
    size = 3.5,
    show.legend = FALSE
  ) +
  scale_y_continuous(labels = scales::percent_format()) +
  scale_fill_manual(
    values = c("No / Low Regret (<=25)" = "#9ecae1", "Strong Regret (>25)" = "#ef6548"),
    name = "Decisional Regret"
  ) +
  coord_cartesian(xlim = c(0.6, 1.9)) +
  labs(title = "Decisional Regret Distribution", x = NULL, y = "Percentage of Respondents") +
  theme_minimal(base_size = 12) +
  theme(panel.grid.major.x = element_blank())