Secondary Analysis

2025-04-25

0. Basic Info

Cohort: - Patients between 18 and 80 years old who started dialysis in Network 6 from 2015 to 2021 - Preemptive listed patients were excluded - Preemptive referrals were excluded

Outcome: referred within 1 year * referred to transplant center outside or inside state - Not referred within 1 year - Referred within 1 year to transplant center outside state - Referred within 1 year to transplant center inside state

pt <- readRDS("../data/dialysis_cohort.rds") %>%
  # REVIEW: check if the preemptive referrals should be included in the secondary analysis
  filter(is.na(referral_date) | referral_date >= FIRSTDIAL) %>%
  mutate(referred_within_1yr = if_else(referral_date - FIRSTDIAL + 1 <= 365.25, 1, 0, missing = 0),
         referred_to_tx_outside_state = ifelse(df_state != substr(CTR_CD, 1, 2), 1, 0),
         referred_within_1yr_outside_state = case_when(referred_within_1yr == 0 ~ 0,
                                                       referred_to_tx_outside_state == 1 ~ 1,
                                                       referred_to_tx_outside_state == 0 ~ 2),
         referred_within_1yr_outside_state = factor(referred_within_1yr_outside_state, 
                                                    levels = 0:2,
                                                    labels = c("No", "To Center Outside State", "To Center Inside State"))) %>%
  mutate_at(c("nearest_tx_outside_state", "adjacent_to_boundary", "nearest_state_boundary_within_10m", "tx_outside_state_driving_time"), yn_factor) %>%
  rowwise() %>%
  mutate(como_na = sum(is.na(COMO_CHF), is.na(COMO_ASHD), is.na(COMO_OTHCARD), is.na(COMO_CVATIA), is.na(COMO_PVD), is.na(COMO_HTN), is.na(COMO_DIABETES), is.na(COMO_COPD), is.na(COMO_CANC), is.na(COMO_TOBAC)),
         como_cnt = sum(COMO_CHF == "Y", COMO_ASHD == "Y", COMO_OTHCARD == "Y", COMO_CVATIA == "Y", COMO_PVD == "Y", COMO_HTN == "Y", COMO_DIABETES == "Y", COMO_COPD == "Y", COMO_CANC == "Y", COMO_TOBAC == "Y", na.rm = T),
         como_cnt = ifelse(como_na == 10, NA, como_cnt),
         ADI_NATRANK = ifelse(ADI_NATRANK %in% c("PH", "GQ", "PH-GQ", "QDI"), NA, as.numeric(ADI_NATRANK))) %>% 
  select(referred_within_1yr_outside_state, insurance_medevid_first, adjacent_to_boundary, male, INC_AGE, RACE, HISPANIC, EMPCUR, NEPHCARE, TRCERT, COMO_INST, como_cnt, inambulate, median_household_income, public_transportation_pct, ADI_NATRANK) 

desc_pt <- pt %>% 
  filter(!is.na(referred_within_1yr_outside_state)) %>%
  filter(!is.na(insurance_medevid_first)) %>%
  mutate(median_household_income = median_household_income / 10000)

1. Descriptive tables

var_label <- list(
  "referred_within_1yr_outside_state" = "Referred within 1 year",
  "adjacent_to_boundary" = "Located in the county adjacent to state boundary",
  "insurance_medevid_first" = "Insurance type",
  "male" = "Sex",
  "INC_AGE" = "Age at Dialysis Start",
  "RACE" = "Race", 
  "HISPANIC" = "Ethnicity", 
  "EMPCUR" = "Employment Status", 
  "NEPHCARE" = "Prior Nephrology Care", 
  "TRCERT" = "Patient Completing Home Dialysis Training", 
  "COMO_INST" = "Institutionalized", 
  "como_cnt" = "Number of Comorbidities",
  "inambulate" = "Inability to Ambulate",
  "median_household_income" = "Median Household Income (×$10k)",
  "public_transportation_pct" = "Public transportation to Work (%)", 
  "ADI_NATRANK" = "ADI National Rank"
  )

desc_pt %>%
  tbl_summary(by = adjacent_to_boundary,
              type = list(all_continuous() ~ "continuous2",
                          all_dichotomous() ~ "categorical"),
              statistic = all_continuous() ~ c("{mean}±{sd}", "{median} ({p25}, {p75})"),
              label = var_label
              ) %>%
  modify_spanning_header(all_stat_cols() ~ "**Located in the county adjacent to state boundary**") %>%
  add_overall()
Characteristic Overall
N = 60,803
1
Located in the county adjacent to state boundary
No
N = 42,411
1
Yes
N = 18,392
1
Referred within 1 year


    No 44,011 (72%) 30,227 (71%) 13,784 (75%)
    To Center Outside State 1,557 (2.6%) 758 (1.8%) 799 (4.3%)
    To Center Inside State 15,235 (25%) 11,426 (27%) 3,809 (21%)
Insurance type


    TM w/o MDCD 23,359 (38%) 16,072 (38%) 7,287 (40%)
    TM w/ MDCD 5,799 (9.5%) 4,075 (9.6%) 1,724 (9.4%)
    MA w/o MDCD 6,615 (11%) 4,498 (11%) 2,117 (12%)
    MA w/ MDCD 1,232 (2.0%) 858 (2.0%) 374 (2.0%)
    Employer 7,176 (12%) 5,180 (12%) 1,996 (11%)
    Other 4,018 (6.6%) 2,838 (6.7%) 1,180 (6.4%)
    None 12,604 (21%) 8,890 (21%) 3,714 (20%)
Sex


    Male 33,648 (55%) 23,284 (55%) 10,364 (56%)
    Female 27,155 (45%) 19,127 (45%) 8,028 (44%)
Age at Dialysis Start


    Mean±SD 60±13 60±13 61±13
    Median (Q1, Q3) 63 (52, 71) 62 (52, 71) 63 (52, 71)
Race


    White 26,652 (44%) 17,526 (41%) 9,126 (50%)
    Black 32,592 (54%) 23,827 (56%) 8,765 (48%)
    AIAN 289 (0.5%) 65 (0.2%) 224 (1.2%)
    Asian 858 (1.4%) 694 (1.6%) 164 (0.9%)
    NHPI 263 (0.4%) 198 (0.5%) 65 (0.4%)
    Other 119 (0.2%) 79 (0.2%) 40 (0.2%)
    Unknown 30 22 8
Ethnicity


    Hispanic 2,429 (4.0%) 1,762 (4.2%) 667 (3.6%)
    Non-Hispanic 58,367 (96%) 40,644 (96%) 17,723 (96%)
    Unknown 7 5 2
Employment Status


    Employed 6,003 (9.9%) 4,361 (10%) 1,642 (8.9%)
    Other 54,800 (90%) 38,050 (90%) 16,750 (91%)
Prior Nephrology Care


    No 12,049 (20%) 8,806 (21%) 3,243 (18%)
    Yes 39,323 (65%) 26,469 (62%) 12,854 (70%)
    Unknown 9,431 (16%) 7,136 (17%) 2,295 (12%)
Patient Completing Home Dialysis Training


    No 98 (0.2%) 64 (0.2%) 34 (0.2%)
    Yes 6,322 (10%) 4,355 (10%) 1,967 (11%)
    Unknown 54,383 (89%) 37,992 (90%) 16,391 (89%)
Institutionalized


    No 56,998 (94%) 39,781 (94%) 17,217 (94%)
    Yes 3,793 (6.2%) 2,619 (6.2%) 1,174 (6.4%)
    Unknown 12 11 1
Number of Comorbidities


    Mean±SD 3±1 3±1 3±1
    Median (Q1, Q3) 2 (2, 3) 2 (2, 3) 2 (2, 3)
Inability to Ambulate


    No 56,648 (93%) 39,550 (93%) 17,098 (93%)
    Yes 4,143 (6.8%) 2,850 (6.7%) 1,293 (7.0%)
    Unknown 12 11 1
Median Household Income (×$10k)


    Mean±SD 6.19±2.06 6.34±2.14 5.84±1.83
    Median (Q1, Q3) 5.86 (4.76, 7.16) 5.91 (4.88, 7.42) 5.54 (4.62, 6.61)
    Unknown 877 573 304
Public transportation to Work (%)


    Mean±SD 1.20±2.87 1.40±3.15 0.73±2.03
    Median (Q1, Q3) 0.30 (0.00, 1.04) 0.34 (0.01, 1.27) 0.15 (0.00, 0.78)
    Unknown 729 491 238
ADI National Rank


    Mean±SD 68±21 66±22 70±20
    Median (Q1, Q3) 71 (53, 85) 71 (51, 83) 74 (56, 88)
    Unknown 1,560 1,032 528
1 n (%)
desc_pt %>%
  select(referred_within_1yr_outside_state, insurance_medevid_first) %>%
  tbl_summary(by = referred_within_1yr_outside_state,
              type = list(all_continuous() ~ "continuous2",
                          all_dichotomous() ~ "categorical"),
              percent = "row",
              digits = list(all_categorical() ~ c(0, 1)),
              statistic = all_continuous() ~ c("{mean}±{sd}", "{median} ({p25}, {p75})"),
              label = var_label
              ) %>%
  modify_spanning_header(all_stat_cols() ~ "**Referred within 1 Year**")
Characteristic
Referred within 1 Year
No
N = 44,011
1
To Center Outside State
N = 1,557
1
To Center Inside State
N = 15,235
1
Insurance type


    TM w/o MDCD 18,540 (79.4%) 480 (2.1%) 4,339 (18.6%)
    TM w/ MDCD 4,560 (78.6%) 127 (2.2%) 1,112 (19.2%)
    MA w/o MDCD 5,167 (78.1%) 124 (1.9%) 1,324 (20.0%)
    MA w/ MDCD 954 (77.4%) 29 (2.4%) 249 (20.2%)
    Employer 3,803 (53.0%) 332 (4.6%) 3,041 (42.4%)
    Other 2,635 (65.6%) 130 (3.2%) 1,253 (31.2%)
    None 8,352 (66.3%) 335 (2.7%) 3,917 (31.1%)
1 n (%)

2. Fit multinomial logistic regression models

male, INC_AGE, RACE, HISPANIC, EMPCUR, NEPHCARE, TRCERT, COMO_INST, COMO_INAMB, the number of COMOs (CHF ASHD OTH_CARDIAC ASCVD PVD HYPER DIABETES COPD CANC SMOKING), census - % of public transportation, census - median household income

create_rr_tbl <- function(m) {
  m2 <- m %>% 
    tbl_regression(exponentiate = T, 
                   label = var_label) %>% 
    bold_p() %>%
    modify_table_styling(columns = c(estimate),
                         rows = reference_row == TRUE, 
                         label = "**RRR**", 
                         missing_symbol = "Ref.") %>%
    modify_footnote(estimate ~ "RRR = Relative Risk Ratio") %>%
    remove_abbreviation()
  
  outcome1_tbl <- m2$table_body %>% 
    filter(groupname_col == "To Center Inside State") 
  outcome1 <- m2
  outcome1$table_body <- outcome1_tbl
  
  outcome2_tbl <- m2$table_body %>%
    filter(groupname_col == "To Center Outside State") 
  outcome2 <- m2
  outcome2$table_body <- outcome2_tbl
  
  m2 <- tbl_merge(list(outcome1, outcome2),
                  tab_spanner = c("**To Center Inside State**", "**To Center Outside State**")) 
  
  m2$table_styling$header <- m2$table_styling$header %>%
    mutate(hide = ifelse(column %in% c("groupname_col_1", "groupname_col_2"), T, hide))

  return(m2)
}

covars <- "ADI_NATRANK + male + INC_AGE + RACE + HISPANIC + EMPCUR + NEPHCARE + TRCERT + COMO_INST + como_cnt + inambulate + median_household_income + public_transportation_pct"
m_crude <- multinom(
  referred_within_1yr_outside_state ~ adjacent_to_boundary + insurance_medevid_first, 
  data = desc_pt,
  trace = F
  )
m_adjusted <- multinom(
  as.formula(paste("referred_within_1yr_outside_state ~ adjacent_to_boundary + insurance_medevid_first + ", covars)), 
  data = desc_pt,
  trace = F
  ) 

m_interaction_crude <- multinom(
  referred_within_1yr_outside_state ~ adjacent_to_boundary * insurance_medevid_first, 
  data = desc_pt,
  trace = F
  )
m_interaction_adjusted <- multinom(
  as.formula(paste("referred_within_1yr_outside_state ~ adjacent_to_boundary * insurance_medevid_first + ", covars)), 
  data = desc_pt,
  trace = F
  )

2.1 Models without interaction

Crude Model

create_rr_tbl(m_crude)
Characteristic
To Center Inside State
To Center Outside State
RRR1 95% CI p-value RRR1 95% CI p-value
Located in the county adjacent to state boundary





    No Ref.
Ref.
    Yes 0.74 0.71, 0.78 <0.001 2.35 2.13, 2.61 <0.001
Insurance type





    TM w/o MDCD Ref.
Ref.
    TM w/ MDCD 1.04 0.96, 1.12 0.3 1.09 0.89, 1.33 0.4
    MA w/o MDCD 1.10 1.02, 1.18 0.008 0.92 0.75, 1.12 0.4
    MA w/ MDCD 1.11 0.96, 1.28 0.14 1.18 0.81, 1.73 0.4
    Employer 3.39 3.20, 3.60 <0.001 3.46 2.99, 3.99 <0.001
    Other 2.02 1.88, 2.18 <0.001 1.93 1.58, 2.35 <0.001
    None 2.00 1.90, 2.10 <0.001 1.57 1.36, 1.80 <0.001
1 RRR = Relative Risk Ratio

Adjusted Model

create_rr_tbl(m_adjusted)
Characteristic
To Center Inside State
To Center Outside State
RRR1 95% CI p-value RRR1 95% CI p-value
Located in the county adjacent to state boundary





    No Ref.
Ref.
    Yes 0.78 0.75, 0.82 <0.001 2.10 1.89, 2.33 <0.001
Insurance type





    TM w/o MDCD Ref.
Ref.
    TM w/ MDCD 0.92 0.85, 0.99 0.032 0.96 0.78, 1.18 0.7
    MA w/o MDCD 1.13 1.05, 1.21 0.001 1.00 0.82, 1.22 >0.9
    MA w/ MDCD 1.05 0.90, 1.22 0.5 1.09 0.74, 1.62 0.7
    Employer 1.40 1.30, 1.50 <0.001 1.49 1.25, 1.79 <0.001
    Other 1.10 1.01, 1.19 0.028 1.09 0.88, 1.34 0.5
    None 0.92 0.86, 0.98 0.007 0.75 0.63, 0.89 <0.001
ADI National Rank 1.00 1.00, 1.00 0.012 1.01 1.00, 1.01 <0.001
Sex





    Male Ref.
Ref.
    Female 0.88 0.85, 0.92 <0.001 0.89 0.80, 0.99 0.036
Age at Dialysis Start 0.96 0.96, 0.96 <0.001 0.96 0.96, 0.97 <0.001
Race





    White Ref.
Ref.
    Black 1.35 1.29, 1.41 <0.001 1.23 1.10, 1.38 <0.001
    AIAN 1.59 1.19, 2.13 0.002 1.40 0.79, 2.51 0.3
    Asian 1.31 1.12, 1.54 <0.001 0.47 0.23, 0.94 0.034
    NHPI 0.85 0.62, 1.17 0.3 1.83 0.94, 3.55 0.075
    Other 1.73 1.12, 2.67 0.013 2.49 1.06, 5.87 0.037
Ethnicity





    Hispanic Ref.
Ref.
    Non-Hispanic 1.46 1.31, 1.62 <0.001 2.16 1.53, 3.05 <0.001
Employment Status





    Employed Ref.
Ref.
    Other 0.78 0.73, 0.84 <0.001 0.80 0.68, 0.95 0.010
Prior Nephrology Care





    No Ref.
Ref.
    Yes 1.11 1.05, 1.17 <0.001 1.24 1.08, 1.43 0.003
    Unknown 0.87 0.82, 0.94 <0.001 0.88 0.72, 1.07 0.2
Patient Completing Home Dialysis Training





    No Ref.
Ref.
    Yes 1.00 0.62, 1.61 >0.9 2.99 2.40, 3.71 <0.001
    Unknown 0.84 0.52, 1.35 0.5 2.41 1.95, 2.97 <0.001
Institutionalized





    No Ref.
Ref.
    Yes 0.35 0.30, 0.40 <0.001 0.25 0.15, 0.41 <0.001
Number of Comorbidities 0.94 0.92, 0.95 <0.001 0.88 0.84, 0.92 <0.001
Inability to Ambulate





    No Ref.
Ref.
    Yes 0.41 0.36, 0.47 <0.001 0.32 0.21, 0.49 <0.001
Median Household Income (×$10k) 1.05 1.04, 1.06 <0.001 0.98 0.95, 1.01 0.2
Public transportation to Work (%) 1.01 1.00, 1.01 0.037 0.92 0.89, 0.95 <0.001
1 RRR = Relative Risk Ratio

2.2 Models with interaction

Crude Model

AME

avg_comparisons(m_interaction_crude) %>%
  mutate(estimate_ci = paste0(round(estimate, 3), " (", round(conf.low, 3), ", ", round(conf.high, 3), ")"),
         p.value = ifelse(p.value < .001, "<.001", round(p.value, 3)), 
         term = map_chr(term, ~ var_label[[.]]), 
         id = row_number()) %>%
  arrange(group, id) %>%
  select(group, term, contrast, estimate_ci, p.value) %>%
  kbl(booktabs = T, 
      col.names = c("Outcome", "Characteristics", "Comparison", "AME (95% CI)", "p-value")) %>%
  kable_material(c("hover")) %>%
  column_spec(1:2, bold = T) %>%
  row_spec(row = 0, bold = T) %>%
  collapse_rows(columns = 1:2, valign = "top")
Outcome Characteristics Comparison AME (95% CI) p-value
No Located in the county adjacent to state boundary Yes - No 0.032 (0.024, 0.039) <.001
Insurance type Employer - TM w/o MDCD -0.263 (-0.276, -0.25) <.001
MA w/ MDCD - TM w/o MDCD -0.019 (-0.043, 0.005) 0.119
MA w/o MDCD - TM w/o MDCD -0.013 (-0.024, -0.002) 0.024
None - TM w/o MDCD -0.13 (-0.14, -0.121) <.001
Other - TM w/o MDCD -0.137 (-0.153, -0.122) <.001
TM w/ MDCD - TM w/o MDCD -0.007 (-0.019, 0.005) 0.249
To Center Outside State Located in the county adjacent to state boundary Yes - No 0.026 (0.023, 0.03) <.001
Insurance type Employer - TM w/o MDCD 0.027 (0.022, 0.033) <.001
MA w/ MDCD - TM w/o MDCD 0.003 (-0.006, 0.012) 0.482
MA w/o MDCD - TM w/o MDCD -0.002 (-0.006, 0.001) 0.236
None - TM w/o MDCD 0.006 (0.003, 0.01) <.001
Other - TM w/o MDCD 0.012 (0.006, 0.018) <.001
TM w/ MDCD - TM w/o MDCD 0.002 (-0.003, 0.006) 0.452
To Center Inside State Located in the county adjacent to state boundary Yes - No -0.058 (-0.065, -0.051) <.001
Insurance type Employer - TM w/o MDCD 0.236 (0.223, 0.248) <.001
MA w/ MDCD - TM w/o MDCD 0.016 (-0.007, 0.039) 0.173
MA w/o MDCD - TM w/o MDCD 0.015 (0.004, 0.026) 0.006
None - TM w/o MDCD 0.124 (0.115, 0.134) <.001
Other - TM w/o MDCD 0.125 (0.11, 0.14) <.001
TM w/ MDCD - TM w/o MDCD 0.005 (-0.006, 0.017) 0.356
ggeffect(m_interaction_crude, 
         terms = "insurance_medevid_first") %>% 
  ggplot(aes(x = x, y = predicted,
             color = response.level, 
             group = response.level)) +
  geom_line() +
  geom_point() +
  geom_errorbar(aes(ymin = conf.low, ymax = conf.high,
                    color = response.level,
                    group = response.level),
                width = .05) +
  scale_color_brewer(palette = "Dark2",
                     name = "",
                     labels = c("No",
                                "Referred to Center Inside State",
                                "Referred to Center Outside State")
                     ) +
  labs(x = "Insurance Status",
       y = "Predicted Value",
       title = "Crude Model") +
  ggthemes::theme_wsj() +
  theme(legend.position = "bottom",
        title = element_text(size = 15),
        axis.title = element_text(size = 15, face = "bold"))

Insurance at distance status

avg_comparisons(
  m_interaction_crude,
  variables = "insurance_medevid_first",
  by = "adjacent_to_boundary"
) %>%
  mutate(estimate_ci = paste0(round(estimate, 3), " (", round(conf.low, 3), ", ", round(conf.high, 3), ")"),
         p.value = ifelse(p.value < .001, "<.001", round(p.value, 3))) %>%
  select(adjacent_to_boundary, group, contrast, estimate_ci, p.value) %>%
  kbl(booktabs = T, 
      col.names = c("Adjacent to state boundary", "Outcome", "Comparison between insurance status", "AME (95% CI)", "p-value")) %>%
  kable_material(c("hover")) %>%
  column_spec(1:2, bold = T) %>%
  row_spec(row = 0, bold = T) %>%
  collapse_rows(columns = 1:2, valign = "top")
Adjacent to state boundary Outcome Comparison between insurance status AME (95% CI) p-value
No No Employer - TM w/o MDCD -0.255 (-0.27, -0.24) <.001
MA w/ MDCD - TM w/o MDCD -0.016 (-0.045, 0.013) 0.273
MA w/o MDCD - TM w/o MDCD -0.014 (-0.028, 0) 0.047
None - TM w/o MDCD -0.13 (-0.142, -0.118) <.001
Other - TM w/o MDCD -0.135 (-0.154, -0.116) <.001
TM w/ MDCD - TM w/o MDCD 0 (-0.014, 0.014) 0.985
To Center Outside State Employer - TM w/o MDCD 0.013 (0.008, 0.018) <.001
MA w/ MDCD - TM w/o MDCD -0.005 (-0.012, 0.003) 0.216
MA w/o MDCD - TM w/o MDCD -0.007 (-0.011, -0.004) <.001
None - TM w/o MDCD 0.002 (-0.001, 0.006) 0.208
Other - TM w/o MDCD 0.007 (0.001, 0.013) 0.022
TM w/ MDCD - TM w/o MDCD -0.002 (-0.006, 0.003) 0.443
To Center Inside State Employer - TM w/o MDCD 0.242 (0.227, 0.257) <.001
MA w/ MDCD - TM w/o MDCD 0.021 (-0.008, 0.049) 0.15
MA w/o MDCD - TM w/o MDCD 0.021 (0.008, 0.035) 0.002
None - TM w/o MDCD 0.128 (0.116, 0.139) <.001
Other - TM w/o MDCD 0.128 (0.11, 0.147) <.001
TM w/ MDCD - TM w/o MDCD 0.002 (-0.012, 0.016) 0.801
Yes No Employer - TM w/o MDCD -0.282 (-0.306, -0.258) <.001
MA w/ MDCD - TM w/o MDCD -0.025 (-0.067, 0.016) 0.234
MA w/o MDCD - TM w/o MDCD -0.01 (-0.029, 0.009) 0.283
None - TM w/o MDCD -0.131 (-0.149, -0.114) <.001
Other - TM w/o MDCD -0.142 (-0.171, -0.114) <.001
TM w/ MDCD - TM w/o MDCD -0.023 (-0.044, -0.002) 0.035
To Center Outside State Employer - TM w/o MDCD 0.06 (0.047, 0.073) <.001
MA w/ MDCD - TM w/o MDCD 0.021 (-0.002, 0.044) 0.068
MA w/o MDCD - TM w/o MDCD 0.009 (0, 0.019) 0.043
None - TM w/o MDCD 0.016 (0.008, 0.024) <.001
Other - TM w/o MDCD 0.024 (0.011, 0.038) <.001
TM w/ MDCD - TM w/o MDCD 0.009 (-0.001, 0.019) 0.073
To Center Inside State Employer - TM w/o MDCD 0.222 (0.199, 0.245) <.001
MA w/ MDCD - TM w/o MDCD 0.004 (-0.033, 0.042) 0.819
MA w/o MDCD - TM w/o MDCD 0.001 (-0.016, 0.018) 0.915
None - TM w/o MDCD 0.115 (0.099, 0.132) <.001
Other - TM w/o MDCD 0.118 (0.091, 0.145) <.001
TM w/ MDCD - TM w/o MDCD 0.013 (-0.006, 0.033) 0.172

Adjusted Model

AME

avg_comparisons(m_interaction_adjusted 
                #, variables = c("insurance_medevid_first", "adjacent_to_boundary")
                ) %>%
  mutate(estimate_ci = paste0(round(estimate, 3), " (", round(conf.low, 3), ", ", round(conf.high, 3), ")"),
         p.value = ifelse(p.value < .001, "<.001", round(p.value, 3)), 
         term = map_chr(term, ~ var_label[[.]]), 
         id = row_number()) %>%
  arrange(group, id) %>%
  select(group, term, contrast, estimate_ci, p.value) %>%
  kbl(booktabs = T, 
      col.names = c("Outcome", "Characteristics", "Comparison", "AME (95% CI)", "p-value")) %>%
  kable_material(c("hover")) %>%
  column_spec(1:2, bold = T) %>%
  row_spec(row = 0, bold = T) %>%
  collapse_rows(columns = 1:2, valign = "top")
Outcome Characteristics Comparison AME (95% CI) p-value
No ADI National Rank +1 0 (0, 0) 0.175
Institutionalized Yes - No 0.155 (0.14, 0.17) <.001
Employment Status Other - Employed 0.045 (0.033, 0.058) <.001
Ethnicity Non-Hispanic - Hispanic -0.067 (-0.083, -0.051) <.001
Age at Dialysis Start +1 0.007 (0.007, 0.007) <.001
Prior Nephrology Care Unknown - No 0.023 (0.012, 0.034) <.001
Yes - No -0.02 (-0.029, -0.011) <.001
Race AIAN - White -0.082 (-0.137, -0.027) 0.003
Asian - White -0.036 (-0.065, -0.007) 0.014
Black - White -0.052 (-0.06, -0.045) <.001
NHPI - White 0.01 (-0.04, 0.059) 0.703
Other - White -0.111 (-0.196, -0.026) 0.01
Patient Completing Home Dialysis Training Unknown - No 0.02 (-0.065, 0.104) 0.646
Yes - No -0.012 (-0.097, 0.073) 0.776
Located in the county adjacent to state boundary Yes - No 0.024 (0.017, 0.032) <.001
Number of Comorbidities +1 0.012 (0.01, 0.015) <.001
Inability to Ambulate Yes - No 0.135 (0.121, 0.15) <.001
Insurance type Employer - TM w/o MDCD -0.065 (-0.079, -0.051) <.001
MA w/ MDCD - TM w/o MDCD -0.009 (-0.036, 0.017) 0.487
MA w/o MDCD - TM w/o MDCD -0.02 (-0.033, -0.007) 0.002
None - TM w/o MDCD 0.019 (0.008, 0.029) <.001
Other - TM w/o MDCD -0.017 (-0.031, -0.002) 0.026
TM w/ MDCD - TM w/o MDCD 0.014 (0.001, 0.028) 0.034
Sex Female - Male 0.022 (0.015, 0.029) <.001
Median Household Income (×$10k) +1 -0.007 (-0.009, -0.005) <.001
Public transportation to Work (%) +1 0 (-0.001, 0.002) 0.702
To Center Outside State ADI National Rank +1 0 (0, 0) <.001
Institutionalized Yes - No -0.018 (-0.022, -0.013) <.001
Employment Status Other - Employed -0.004 (-0.008, 0.001) 0.106
Ethnicity Non-Hispanic - Hispanic 0.012 (0.008, 0.017) <.001
Age at Dialysis Start +1 -0.001 (-0.001, 0) <.001
Prior Nephrology Care Unknown - No -0.002 (-0.006, 0.002) 0.381
Yes - No 0.004 (0.001, 0.008) 0.007
Race AIAN - White 0.005 (-0.011, 0.021) 0.54
Asian - White -0.014 (-0.021, -0.006) <.001
Black - White 0.003 (0, 0.006) 0.042
NHPI - White 0.02 (-0.007, 0.047) 0.145
Other - White 0.024 (-0.013, 0.061) 0.21
Patient Completing Home Dialysis Training Unknown - No 0.015 (0.012, 0.018) <.001
Yes - No 0.019 (0.015, 0.024) <.001
Located in the county adjacent to state boundary Yes - No 0.022 (0.019, 0.026) <.001
Number of Comorbidities +1 -0.003 (-0.004, -0.002) <.001
Inability to Ambulate Yes - No -0.016 (-0.02, -0.011) <.001
Insurance type Employer - TM w/o MDCD 0.008 (0.003, 0.014) 0.002
MA w/ MDCD - TM w/o MDCD 0.002 (-0.009, 0.012) 0.732
MA w/o MDCD - TM w/o MDCD -0.001 (-0.006, 0.004) 0.612
None - TM w/o MDCD -0.006 (-0.01, -0.002) 0.002
Other - TM w/o MDCD 0.001 (-0.004, 0.007) 0.652
TM w/ MDCD - TM w/o MDCD 0 (-0.005, 0.005) 0.883
Sex Female - Male -0.002 (-0.004, 0.001) 0.169
Median Household Income (×$10k) +1 -0.001 (-0.002, 0) 0.032
Public transportation to Work (%) +1 -0.002 (-0.003, -0.001) <.001
To Center Inside State ADI National Rank +1 0 (0, 0) 0.002
Institutionalized Yes - No -0.137 (-0.152, -0.122) <.001
Employment Status Other - Employed -0.042 (-0.054, -0.029) <.001
Ethnicity Non-Hispanic - Hispanic 0.055 (0.039, 0.071) <.001
Age at Dialysis Start +1 -0.006 (-0.006, -0.006) <.001
Prior Nephrology Care Unknown - No -0.021 (-0.032, -0.01) <.001
Yes - No 0.016 (0.007, 0.024) <.001
Race AIAN - White 0.077 (0.023, 0.132) 0.006
Asian - White 0.05 (0.021, 0.078) <.001
Black - White 0.049 (0.042, 0.057) <.001
NHPI - White -0.03 (-0.075, 0.016) 0.201
Other - White 0.087 (0.005, 0.17) 0.038
Patient Completing Home Dialysis Training Unknown - No -0.035 (-0.121, 0.051) 0.428
Yes - No -0.007 (-0.094, 0.08) 0.876
Located in the county adjacent to state boundary Yes - No -0.046 (-0.054, -0.039) <.001
Number of Comorbidities +1 -0.01 (-0.012, -0.007) <.001
Inability to Ambulate Yes - No -0.12 (-0.134, -0.106) <.001
Insurance type Employer - TM w/o MDCD 0.056 (0.043, 0.07) <.001
MA w/ MDCD - TM w/o MDCD 0.008 (-0.018, 0.033) 0.566
MA w/o MDCD - TM w/o MDCD 0.021 (0.009, 0.034) <.001
None - TM w/o MDCD -0.013 (-0.023, -0.002) 0.018
Other - TM w/o MDCD 0.015 (0.001, 0.03) 0.035
TM w/ MDCD - TM w/o MDCD -0.014 (-0.027, -0.001) 0.034
Sex Female - Male -0.02 (-0.027, -0.013) <.001
Median Household Income (×$10k) +1 0.008 (0.006, 0.01) <.001
Public transportation to Work (%) +1 0.002 (0.001, 0.003) 0.001
ggeffect(m_interaction_adjusted, 
         terms = "insurance_medevid_first") %>% 
  ggplot(aes(x = x, y = predicted,
             color = response.level, 
             group = response.level)) +
  geom_line() +
  geom_point() +
  geom_errorbar(aes(ymin = conf.low, ymax = conf.high,
                    color = response.level,
                    group = response.level),
                width = .05) +
  scale_color_brewer(palette = "Dark2",
                     name = "",
                     labels = c("No",
                                "Referred to Center Inside State",
                                "Referred to Center Outside State")
                     ) +
  labs(x = "Insurance Status",
       y = "Predicted Value",
       title = "Adjusted Model") +
  ggthemes::theme_wsj() +
  theme(legend.position = "bottom",
        title = element_text(size = 15),
        axis.title = element_text(size = 15, face = "bold"))

Insurance at distance status

avg_comparisons(
  m_interaction_adjusted,
  variables = "insurance_medevid_first",
  by = "adjacent_to_boundary"
) %>%
  mutate(estimate_ci = paste0(round(estimate, 3), " (", round(conf.low, 3), ", ", round(conf.high, 3), ")"),
         p.value = ifelse(p.value < .001, "<.001", round(p.value, 3))) %>%
  select(adjacent_to_boundary, group, contrast, estimate_ci, p.value) %>%
  kbl(booktabs = T, 
      col.names = c("Adjacent to state boundary", "Outcome", "Comparison between insurance status", "AME (95% CI)", "p-value")) %>%
  kable_material(c("hover")) %>%
  column_spec(1:2, bold = T) %>%
  row_spec(row = 0, bold = T) %>%
  collapse_rows(columns = 1:2, valign = "top")
Adjacent to state boundary Outcome Comparison between insurance status AME (95% CI) p-value
No No Employer - TM w/o MDCD -0.054 (-0.069, -0.038) <.001
MA w/ MDCD - TM w/o MDCD -0.009 (-0.041, 0.022) 0.56
MA w/o MDCD - TM w/o MDCD -0.021 (-0.037, -0.005) 0.008
None - TM w/o MDCD 0.021 (0.008, 0.033) 0.001
Other - TM w/o MDCD -0.011 (-0.028, 0.007) 0.219
TM w/ MDCD - TM w/o MDCD 0.021 (0.005, 0.037) 0.01
To Center Outside State Employer - TM w/o MDCD 0.001 (-0.004, 0.006) 0.672
MA w/ MDCD - TM w/o MDCD -0.007 (-0.016, 0.003) 0.158
MA w/o MDCD - TM w/o MDCD -0.008 (-0.013, -0.004) <.001
None - TM w/o MDCD -0.006 (-0.01, -0.002) 0.001
Other - TM w/o MDCD -0.001 (-0.007, 0.005) 0.707
TM w/ MDCD - TM w/o MDCD -0.004 (-0.009, 0.001) 0.125
To Center Inside State Employer - TM w/o MDCD 0.052 (0.037, 0.068) <.001
MA w/ MDCD - TM w/o MDCD 0.016 (-0.015, 0.048) 0.318
MA w/o MDCD - TM w/o MDCD 0.029 (0.014, 0.045) <.001
None - TM w/o MDCD -0.015 (-0.027, -0.002) 0.019
Other - TM w/o MDCD 0.012 (-0.005, 0.029) 0.169
TM w/ MDCD - TM w/o MDCD -0.017 (-0.032, -0.001) 0.035
Yes No Employer - TM w/o MDCD -0.091 (-0.114, -0.069) <.001
MA w/ MDCD - TM w/o MDCD -0.009 (-0.055, 0.037) 0.704
MA w/o MDCD - TM w/o MDCD -0.018 (-0.04, 0.005) 0.121
None - TM w/o MDCD 0.014 (-0.003, 0.03) 0.112
Other - TM w/o MDCD -0.03 (-0.056, -0.004) 0.022
TM w/ MDCD - TM w/o MDCD -0.001 (-0.024, 0.023) 0.953
To Center Outside State Employer - TM w/o MDCD 0.026 (0.014, 0.037) <.001
MA w/ MDCD - TM w/o MDCD 0.021 (-0.005, 0.048) 0.117
MA w/o MDCD - TM w/o MDCD 0.015 (0.003, 0.028) 0.013
None - TM w/o MDCD -0.006 (-0.013, 0.002) 0.155
Other - TM w/o MDCD 0.007 (-0.006, 0.019) 0.286
TM w/ MDCD - TM w/o MDCD 0.008 (-0.004, 0.02) 0.193
To Center Inside State Employer - TM w/o MDCD 0.066 (0.045, 0.087) <.001
MA w/ MDCD - TM w/o MDCD -0.013 (-0.055, 0.03) 0.568
MA w/o MDCD - TM w/o MDCD 0.002 (-0.019, 0.023) 0.849
None - TM w/o MDCD -0.008 (-0.024, 0.008) 0.327
Other - TM w/o MDCD 0.023 (-0.001, 0.048) 0.06
TM w/ MDCD - TM w/o MDCD -0.007 (-0.029, 0.015) 0.52