Overview

The original project included two aims: 1- investigating the frequency and distribution of GAS and 2- the surgical complication of GAS among TM and TF individuals enrolled in STRONG as a function of KP site and patient sociodemographic characteristics. Given the scope of a master’s thesis, the decision was made to pursue aim 1 exclusively.


Outcomes

The primary outcome of aim 1 is receipt of any gender-affirming procedure (including both surgical and non-surgical procedures). The secondary outcome is receipt of gender-affirming surgery (GAS).

GAS includes:

  • top surgeries (i.e., mastectomy, breast augmentation)
  • bottom surgeries (i.e. hysterectomy, vaginoplasty)
  • facial surgeries (i.e., reduction/augmentation of facial bones)
  • vocal surgeries (i.e., laryngoplasty)

Procedures not considered GAS:

  • soft tissue procedures of the face (i.e., blepharoplasty, rhytidectomy)
  • soft tissue procedures of the body (i.e., liposuction, lipectomy)
  • injection of filling material
  • hair removal procedures
# List of non-surgical procedures
code_lookup <- read_excel("Code_Details.xlsx")
code_lookup[code_lookup$GAS_surgery == "No", ] %>% 
  tbl_summary(include="code_description", 
              sort = code_description ~ "frequency",
              label = list(code_description = "Procedures not included in GAS")) %>%
  modify_header(label ~ "") %>%
  bold_labels() %>%
  modify_column_hide(column = stat_0) 
# List of surgical procedures
code_lookup[code_lookup$GAS_surgery == "Yes", ] %>% 
  tbl_summary(include="code_description", 
              sort = code_description ~ "frequency",
              label = list(code_description = "List of Gender-Affirming Surgery")) %>%
  modify_header(label ~ "") %>%
  bold_labels() %>%
  modify_column_hide(column = stat_0)


Covariates

Independent variables include KP site location as well as patient age, race/ethnicity, insurance type, TM vs TF status, and area-based measures of socioeconomic status (SES).

  • KP site
  • Age at index
  • Race/ethnicity
  • Transgender identity (TM vs TF)
  • Insurance type (Medicaid vs commercial)
  • Area-based SES (percent living below poverty)









Preparing the Data

Importing the Data

The original data is read in and copied to a new data frame. Data type is then confirmed for all character, factor, and date variables.

# Read in the data
Original_data <- read_excel("Original_data.xlsx")

# Pre-process the data to handle '#NULL!' values by replacing them with NA
Original_data <- Original_data %>%
  mutate(across(where(is.character), ~na_if(.x, "#NULL!")))

# Now ensure that all the data types are correct
data <- Original_data %>%
  mutate(
    # Converting character columns
    studyid = as.character(studyid),
    site = as.character(site),
    CODE = as.character(CODE),
    CODETYPE = as.character(CODETYPE),
    ENCTYPE = as.character(ENCTYPE),
    ENCOUNTER_SUBTYPE = as.character(ENCOUNTER_SUBTYPE),
    DEPT = as.character(DEPT),
    
    # Converting categorical columns to factors
    transgender = factor(transgender),
    procedure = factor(procedure),
    sex_natal = factor(sex_natal),
    RACE1 = factor(RACE1),
    RACE2 = factor(RACE2),
    HISPANIC = factor(HISPANIC),
    INS_MEDICAID = factor(INS_MEDICAID),
    
    # Converting date columns
    index_date = ymd(index_date),
    birth_date = ymd(birth_date),
    TRANS_CODE_ADATE = ymd(TRANS_CODE_ADATE),
    TRANS_CODE_PROCDATE = ymd(TRANS_CODE_PROCDATE),
    ENR_START = ymd(ENR_START),
    ENR_END = ymd(ENR_END),
  )



Cleaning the Data

Existing categorical variables including KP site, transgender status, natal sex, race/ethnicity, and insurance are re-coded for ease of readability.


New variables are then created based on existing variables. Transgender type (TM vs TF) is created based on natal sex. A binary GAS variable is created based on the procedure variable. Age at index is transformed into a new categorical variable. Finally, a categorical poverty variable is created.


A new combined race_ethnicity variable was also created using the original RACE1 and HISPANIC variables. All individuals with HISPANIC = Yes are coded as “Hispanic” in new race/ethnicity variable. The remaining individuals (HISPANIC = “No” or “Unknown”) are coded as Non-Hispanic X based on race (i.e., Non-Hispanic Black).

data <- data %>%
  mutate(
    site = case_when(
      site == "GA" ~ "Georgia",
      site == "NC" ~ "Northern California",
      site == "SC" ~ "Southern California",
      TRUE ~ as.character(site)  # Keeps the original value if none of the above conditions are met
    ),
    transgender = if_else(transgender == 1, "Yes", "No"),
    sex_natal = case_when(
      sex_natal == "M" ~ "Male",
      sex_natal == "F" ~ "Female",
      TRUE ~ as.character(sex_natal)
    ),
    RACE1 = case_when(
      RACE1 == "AS" ~ "Asian",
      RACE1 == "BA" ~ "Black/African American",
      RACE1 == "HP" ~ "Hispanic/Latino- Native Hawaiian or Pacific Islander",
      RACE1 == "IN" ~ "American Indian or Alaskan Native",
      RACE1 == "MU" ~ "Multi-racial",
      RACE1 == "UN" ~ "Unknown",
      RACE1 == "WH" ~ "White",
      TRUE ~ as.character(RACE1)
    ),
    RACE2 = case_when(
      RACE2 == "AS" ~ "Asian",
      RACE2 == "BA" ~ "Black/African American",
      RACE2 == "IN" ~ "American Indian or Alaskan Native", # not in original data dictionary 
      RACE2 == "UN" ~ "Unknown",
      RACE2 == "WH" ~ "White",
      RACE2 == "OT" ~ "Other",
      TRUE ~ as.character(RACE2)
    ),
    HISPANIC = case_when(
      HISPANIC == "N" ~ "No",
      HISPANIC == "Y" ~ "Yes",
      HISPANIC == "U" ~ "Unknown",
      TRUE ~ as.character(HISPANIC)
    ),
    INS_MEDICAID = case_when(
      INS_MEDICAID == "Y" ~ "Medicaid",
      is.na(INS_MEDICAID) ~ "Commercial",
      TRUE ~ as.character(INS_MEDICAID)
    )
  )

# check coding 
table(data$site, Original_data$site)
table(data$transgender, Original_data$transgender)
table(data$RACE1, Original_data$RACE1)
table(data$RACE2, Original_data$RACE2)
table(data$HISPANIC, Original_data$HISPANIC)
table(data$INS_MEDICAID, Original_data$INS_MEDICAID)
# trans_type, age_at_index_group, poverty, poverty_cat
data <- data %>%
  mutate(
    trans_type = case_when(
      sex_natal == "Male" ~ "Transfeminine",
      sex_natal == "Female" ~ "Transmasculine",
      TRUE ~ NA_character_
    ),
    GAS_any = case_when(
      procedure == 1 ~ "Yes",
      procedure == 0 ~ "No",
      TRUE ~ NA_character_
    ),
    age_at_index_group = case_when(
      age_at_index < 18 ~ "<18",
      age_at_index >= 18 & age_at_index <= 34 ~ "18-34",
      age_at_index >= 35 & age_at_index <= 64 ~ "35-64",
      age_at_index >= 65 ~ "65+",
      TRUE ~ NA_character_
    ),
    poverty = pov_lt_50 + pov_50_74 + pov_75_99,
    poverty_cat = case_when(
      poverty < 0.1 ~ "<10%",
      poverty >= 0.1 & poverty < 0.2 ~ "10-20%",
      poverty >= 0.2 ~ ">20%",
      TRUE ~ NA_character_
    ), 
    race_ethnicity = case_when(
      HISPANIC == "Yes" ~ "Hispanic",
      HISPANIC != "Yes" & RACE1 == "White" ~ "Non-Hispanic White",
      HISPANIC != "Yes" & RACE1 == "Black/African American" ~ "Non-Hispanic Black",
      HISPANIC != "Yes" & RACE1 == "Asian" ~ "Non-Hispanic Asian",
      HISPANIC != "Yes" & RACE1 == "Hispanic/Latino- Native Hawaiian or Pacific Islander" ~ "Other/Unknown",
      HISPANIC != "Yes" & RACE1 == "American Indian or Alaskan Native" ~ "Other/Unknown",
      HISPANIC != "Yes" & RACE1 == "Multi-racial" ~ "Other/Unknown",
      HISPANIC != "Yes" & RACE1 == "Unknown" ~ "Other/Unknown",
      TRUE ~ NA_character_
    )
  )

# Set race_ethnicity to "Other/Unknown" if empty
data$race_ethnicity <- ifelse(is.na(data$race_ethnicity), "Other/Unknown", data$race_ethnicity)



# Check coding
# table(data$trans_type, data$sex_natal)
# table(data$procedure, data$GAS_any)
# table(data$poverty_cat)
# table(data$race_ethnicity, data$RACE1)



Procedure Coding

A code lookup sheet is read in and used to create code description and GAS type variables based on code. GAS type includes top, bottom, and other. An additional GAS_surgery variable is created to specifically identify gender-affirming surgeries (includes top, bottom, bony facial surgeries; excludes soft tissue face/body procedures (ie. blepharoplasties, rhytidectomies, liposuction/lipectomies), fillers, and hair removal). Finally, a binary GAS_bottom variable is created.

# Create list of all unique values for the CODE variable
code_list <- data.frame(unique(data$CODE))
                        
# Read in procedure lookup table
code_lookup <- read_excel("Code_Details.xlsx")
# view(code_lookup)

# Ensure that the 'CODE' column in both data frames are of the same type
data$CODE <- as.character(data$CODE)
code_lookup$CODE <- as.character(code_lookup$CODE)

# Join the lookup table with main data frame using a left join
data <- data %>%
  left_join(code_lookup, by = "CODE")

# New GAS_bottom variable
data <- data %>%
  mutate(
    GAS_bottom = case_when(
      GAS_type == "Bottom" ~ "Yes",
      !is.na(GAS_type) & GAS_type != "Bottom" ~ "No",
      is.na(GAS_type) ~ NA_character_
    )
  )

# Set GAS_surgery to "No" if empty
unique(data$GAS_surgery) # variable has Yes No and NA
data$GAS_surgery <- ifelse(is.na(data$GAS_surgery), "No", data$GAS_surgery) # change NA's to No
unique(data$GAS_surgery) # check only Yes and No
table(data$GAS_surgery) # check number in each 

# make new binary variable for GAS_any coded as 0 and 1
data$GAS_any_binary <- ifelse(data$GAS_any == "Yes", 1, 0)

# make new binary variable for GAS_surgery coded as 0 and 1
data$GAS_surgery_binary <- ifelse(data$GAS_surgery == "Yes", 1, 0)



Adding Variable Labels

Labels are added to all variables to improve formatting and readability.

label(data$studyid) <- "Participant study ID"
label(data$site) <- "KP site"
label(data$transgender) <- "Transgender Status"
label(data$procedure) <- "Gender Affirming Procedure"
label(data$index_date) <- "Index Date"
label(data$age_at_index) <- "Age at Index"
label(data$birth_date) <- "Date of Birth"
label(data$sex_natal) <- "Natal Sex"
label(data$RACE1) <- "Race 1 (if known)"
label(data$RACE2) <- "Race 2 (if known)"
label(data$HISPANIC) <- "Hispanic origin (ethnicity)"
label(data$trans_type) <- "Transgender Group"
label(data$age_at_index_group) <- "Age at Index Group"
label(data$TRANS_CODE_ADATE) <- "Admission date of the encounter where the transition procedure code was recorded"
label(data$TRANS_CODE_PROCDATE) <- "Actual date the procedure was performed (if available)"
label(data$CODE) <- "Code identifying the transition procedure"
label(data$CODETYPE) <- "Type of code (CPT, HCPCS, ICD9, ICD10, etc) of the transition procedure"
label(data$PXCNT) <- "Number of times that the procedure was performed"
label(data$ENCTYPE) <- "Type of encounter where the procedure was performed"
label(data$ENCOUNTER_SUBTYPE) <- "Subtype of encounter where the procedure was performed"
label(data$DEPT) <- "Department where the procedure was performed"
label(data$GAS_type) <- "Type of GAS"
label(data$GAS_bottom) <- "Received Genital Surgery"
label(data$ENR_START) <- "Medicaid Enrollment Start Date"
label(data$ENR_END) <- "Medicaid Enrollment End Date"
label(data$INS_MEDICAID) <- "Type of Insurance"
label(data$LOC_START) <- "LOC_START"
label(data$LOC_END) <- "LOC_END"
label(data$GEOCODE_BOUNDARY_YEAR) <- "GEOCODE_BOUNDARY_YEAR"
label(data$location_days_from_index) <- "DAYS_DIFF"
label(data$CENSUS_YEAR) <- "CENSUS_YEAR"
label(data$education1) <- "EDUCATION1"
label(data$education2) <- "EDUCATION2"
label(data$education3) <- "EDUCATION3"
label(data$education4) <- "EDUCATION4"
label(data$education5) <- "EDUCATION5"
label(data$education6) <- "EDUCATION6"
label(data$education7) <- "EDUCATION7"
label(data$education8) <- "EDUCATION8"
label(data$fampoverty) <- "FAMPOVERTY"
label(data$houspoverty) <- "HOUSPOVERTY"
label(data$pov_lt_50) <- "Poverty less than 5%"
label(data$pov_50_74) <- "Poverty 5-7.5%"
label(data$pov_75_99) <- "Poverty 7.5-9.9%"
label(data$pov_100_124) <- "Poverty 10-12.4%"
label(data$pov_125_149) <- "Poverty 12.5-14.9%"
label(data$pov_150_174) <- "Poverty 15-17.4%"
label(data$pov_175_184) <- "Poverty 17.5-18.4%"
label(data$pov_185_199) <- "Poverty 18.5-19.9%"
label(data$pov_gt_200) <- "Poverty greater than 20%"
label(data$poverty) <- "Poverty Sum (sum of 5%-9.9%)"
label(data$poverty_cat) <- "Percent living below poverty"
label(data$GAS_any) <- "Received GAS (*any procedure*)"
label(data$code_description) <- "Procedure code description"
label(data$GAS_surgery) <- "Received Gender Affirming Surgery (top, bottom, or bony face)"
label(data$race_ethnicity) <- "Race/Ethnicity"

# Check labels
# cbind(label(data))









Table 1 - Descriptive Statistics

Table 1 – Descriptive Statistics Overall

table1 <- data %>%
  select(age_at_index, age_at_index_group, race_ethnicity, site, 
         INS_MEDICAID, poverty_cat, GAS_any, GAS_surgery, trans_type) %>%
  mutate(GAS_any = factor(GAS_any, labels = c("No procedures", "Procedures"))) %>%
  mutate(GAS_surgery = factor(GAS_surgery, labels = c("No surgery", "Surgery"))) %>%
  mutate(poverty_cat = factor(poverty_cat, levels = c("<10%", "10-20%", ">20%"))) %>% 
  tbl_summary(
    missing = "no", 
    type = list(where(is.logical) ~ "categorical"), 
    sort = race_ethnicity ~ "frequency",
    label = list(race_ethnicity = "Race/Ethnicity",
                 poverty_cat = "Percent living below poverty",
                 GAS_any = "Procedure History",
                 GAS_surgery = "Surgery History")) %>%
  bold_labels() %>%
  modify_header(label ~ "") %>%
  modify_caption("<div style='text-align: left; font-weight: bold; color: grey'>
                 Table 1. Descriptive Statistics</div>") %>%
  as_gt() %>%
  cols_width(everything()~px(250))

table1
Table 1. Descriptive Statistics
N = 15,5641
Age at Index 24 (17, 35)
Age at Index Group
    <18 3,974 (26%)
    18-34 7,672 (49%)
    35-64 3,654 (23%)
    65+ 264 (1.7%)
Race/Ethnicity
    Non-Hispanic White 8,507 (55%)
    Hispanic 3,503 (23%)
    Non-Hispanic Asian 1,506 (9.7%)
    Non-Hispanic Black 1,066 (6.8%)
    Other/Unknown 982 (6.3%)
KP site
    Georgia 168 (1.1%)
    Northern California 10,055 (65%)
    Southern California 5,341 (34%)
Type of Insurance
    Commercial 11,998 (77%)
    Medicaid 3,566 (23%)
Percent living below poverty
    <10% 9,793 (65%)
    10-20% 3,473 (23%)
    >20% 1,883 (12%)
Procedure History
    No procedures 8,639 (56%)
    Procedures 6,925 (44%)
Surgery History
    No surgery 11,426 (73%)
    Surgery 4,138 (27%)
Transgender Group
    Transfeminine 7,278 (47%)
    Transmasculine 8,286 (53%)
1 Median (IQR); n (%)
table1 %>% gtsave(filename = "table1.png") 



Table 1a – Descriptive Statistics by Transgender Group

table1a <- data %>%
  select(age_at_index, age_at_index_group, race_ethnicity, site, 
         INS_MEDICAID, poverty_cat, GAS_any, GAS_surgery, trans_type) %>%
  mutate(GAS_any = factor(GAS_any, labels = c("No procedures", "Procedures"))) %>%
  mutate(GAS_surgery = factor(GAS_surgery, labels = c("No surgery", "Surgery"))) %>%
  mutate(poverty_cat = factor(poverty_cat, levels = c("<10%", "10-20%", ">20%"))) %>% 
  tbl_summary(
    by = trans_type,
    missing = "no", 
    type = list(where(is.logical) ~ "categorical"), 
    sort = race_ethnicity ~ "frequency",
    label = list(race_ethnicity = "Race/Ethnicity",
                 poverty_cat = "Percent living below poverty",
                 GAS_any = "Procedure History",
                 GAS_surgery = "Surgery History")) %>%
  bold_labels() %>%
  modify_header(label ~ "") %>%
  modify_caption("<div style='text-align: left; font-weight: bold; color: grey'>
                 Table 1a. Descriptive Statistics by Transgender Group</div>") %>%
  as_gt() %>%
  cols_width(everything()~px(250))

table1a
Table 1a. Descriptive Statistics by Transgender Group
Transfeminine, N = 7,2781 Transmasculine, N = 8,2861
Age at Index 28 (20, 42) 22 (16, 30)
Age at Index Group

    <18 1,188 (16%) 2,786 (34%)
    18-34 3,517 (48%) 4,155 (50%)
    35-64 2,355 (32%) 1,299 (16%)
    65+ 218 (3.0%) 46 (0.6%)
Race/Ethnicity

    Non-Hispanic White 4,007 (55%) 4,500 (54%)
    Hispanic 1,556 (21%) 1,947 (23%)
    Non-Hispanic Asian 817 (11%) 689 (8.3%)
    Non-Hispanic Black 428 (5.9%) 638 (7.7%)
    Other/Unknown 470 (6.5%) 512 (6.2%)
KP site

    Georgia 92 (1.3%) 76 (0.9%)
    Northern California 4,692 (64%) 5,363 (65%)
    Southern California 2,494 (34%) 2,847 (34%)
Type of Insurance

    Commercial 5,699 (78%) 6,299 (76%)
    Medicaid 1,579 (22%) 1,987 (24%)
Percent living below poverty

    <10% 4,581 (66%) 5,212 (64%)
    10-20% 1,574 (23%) 1,899 (23%)
    >20% 831 (12%) 1,052 (13%)
Procedure History

    No procedures 3,790 (52%) 4,849 (59%)
    Procedures 3,488 (48%) 3,437 (41%)
Surgery History

    No surgery 5,908 (81%) 5,518 (67%)
    Surgery 1,370 (19%) 2,768 (33%)
1 Median (IQR); n (%)
table1a %>% gtsave(filename = "table1a.png")   



Table 1b – Descriptive Statistics by Procedure History

table1b <- data %>%
  select(age_at_index, age_at_index_group, race_ethnicity, site, 
         INS_MEDICAID, poverty_cat, GAS_any, trans_type) %>%
  mutate(GAS_any = factor(GAS_any, labels = c("No procedures", "Procedures"))) %>%
  mutate(poverty_cat = factor(poverty_cat, levels = c("<10%", "10-20%", ">20%"))) %>% 
  tbl_summary(
    by = GAS_any,
    missing = "no", 
    type = list(where(is.logical) ~ "categorical"), 
    sort = race_ethnicity ~ "frequency",
    label = list(race_ethnicity = "Race/Ethnicity",
                 poverty_cat = "Percent living below poverty",
                 GAS_any = "Procedure History",
                 GAS_surgery = "Surgery History")) %>%
  bold_labels() %>%
  modify_header(label ~ "") %>%
  modify_caption("<div style='text-align: left; font-weight: bold; color: grey'>
                 Table 1b. Descriptive Statistics by Procedure History</div>") %>%
  as_gt() %>%
  cols_width(everything()~px(250))

table1b
Table 1b. Descriptive Statistics by Procedure History
No procedures, N = 8,6391 Procedures, N = 6,9251
Age at Index 22 (16, 32) 27 (20, 37)
Age at Index Group

    <18 2,969 (34%) 1,005 (15%)
    18-34 3,793 (44%) 3,879 (56%)
    35-64 1,737 (20%) 1,917 (28%)
    65+ 140 (1.6%) 124 (1.8%)
Race/Ethnicity

    Non-Hispanic White 4,530 (52%) 3,977 (57%)
    Hispanic 2,018 (23%) 1,485 (21%)
    Non-Hispanic Asian 828 (9.6%) 678 (9.8%)
    Non-Hispanic Black 567 (6.6%) 499 (7.2%)
    Other/Unknown 696 (8.1%) 286 (4.1%)
KP site

    Georgia 125 (1.4%) 43 (0.6%)
    Northern California 5,475 (63%) 4,580 (66%)
    Southern California 3,039 (35%) 2,302 (33%)
Type of Insurance

    Commercial 6,743 (78%) 5,255 (76%)
    Medicaid 1,896 (22%) 1,670 (24%)
Percent living below poverty

    <10% 5,501 (65%) 4,292 (64%)
    10-20% 1,884 (22%) 1,589 (24%)
    >20% 1,023 (12%) 860 (13%)
Transgender Group

    Transfeminine 3,790 (44%) 3,488 (50%)
    Transmasculine 4,849 (56%) 3,437 (50%)
1 Median (IQR); n (%)
table1b %>% gtsave(filename = "table1b.png") 



Table 1c – Descriptive Statistics by Surgery History

table1c <- data %>%
  select(age_at_index, age_at_index_group, race_ethnicity, site, 
         INS_MEDICAID, poverty_cat, GAS_surgery, trans_type) %>%
  mutate(GAS_surgery = factor(GAS_surgery, labels = c("No surgery", "Surgery"))) %>%
  mutate(poverty_cat = factor(poverty_cat, levels = c("<10%", "10-20%", ">20%"))) %>% 
  tbl_summary(
    by = GAS_surgery,
    missing = "no", 
    type = list(where(is.logical) ~ "categorical"), 
    sort = race_ethnicity ~ "frequency",
    label = list(race_ethnicity = "Race/Ethnicity",
                 poverty_cat = "Percent living below poverty",
                 GAS_surgery = "Surgery History")) %>%
  bold_labels() %>%
  modify_header(label ~ "") %>%
  modify_caption("<div style='text-align: left; font-weight: bold; color: grey'>
                 Table 1c. Descriptive Statistics by Surgery History</div>") %>%
  as_gt() %>%
  cols_width(everything()~px(250))

table1c
Table 1c. Descriptive Statistics by Surgery History
No surgery, N = 11,4261 Surgery, N = 4,1381
Age at Index 23 (17, 34) 27 (20, 38)
Age at Index Group

    <18 3,294 (29%) 680 (16%)
    18-34 5,467 (48%) 2,205 (53%)
    35-64 2,492 (22%) 1,162 (28%)
    65+ 173 (1.5%) 91 (2.2%)
Race/Ethnicity

    Non-Hispanic White 6,135 (54%) 2,372 (57%)
    Hispanic 2,641 (23%) 862 (21%)
    Non-Hispanic Asian 1,092 (9.6%) 414 (10%)
    Non-Hispanic Black 737 (6.5%) 329 (8.0%)
    Other/Unknown 821 (7.2%) 161 (3.9%)
KP site

    Georgia 128 (1.1%) 40 (1.0%)
    Northern California 7,213 (63%) 2,842 (69%)
    Southern California 4,085 (36%) 1,256 (30%)
Type of Insurance

    Commercial 8,831 (77%) 3,167 (77%)
    Medicaid 2,595 (23%) 971 (23%)
Percent living below poverty

    <10% 7,293 (65%) 2,500 (62%)
    10-20% 2,513 (23%) 960 (24%)
    >20% 1,330 (12%) 553 (14%)
Transgender Group

    Transfeminine 5,908 (52%) 1,370 (33%)
    Transmasculine 5,518 (48%) 2,768 (67%)
1 Median (IQR); n (%)
table1c %>% gtsave(filename = "table1c.png")









Table 2 - Outcomes by Transgender Group

Table 2a – Procedure History by Transgender Group

table2a <- data %>%
  select(age_at_index, age_at_index_group, race_ethnicity, site, 
         INS_MEDICAID, poverty_cat, GAS_any, trans_type) %>%
  mutate(GAS_any = factor(GAS_any, labels = c("No procedures", "Procedures"))) %>%
  mutate(poverty_cat = factor(poverty_cat, levels = c("<10%", "10-20%", ">20%"))) %>% 
  tbl_strata(strata = trans_type, .tbl_fun = ~ .x %>%
        tbl_summary(by = GAS_any, 
                    missing = "no",
                    type = list(where(is.logical) ~ "categorical"),
                    sort = race_ethnicity ~ "frequency",
                    label = list(race_ethnicity = "Race/Ethnicity",
                                 poverty_cat = "Percent living below poverty",
                                 GAS_any = "Procedure History")),
       .header = "**{strata}**, (N = {n})") %>%
  bold_labels() %>% 
  modify_header(all_stat_cols() ~ "**{level}**") %>%
  modify_caption("<div style='text-align: left; font-weight: bold; color: grey'>
                 Table 2a. Procedure History by Transgender Group</div>") %>%
  as_gt() %>%
  cols_width(label ~ px(250), everything()~px(175))

table2a
Table 2a. Procedure History by Transgender Group
Characteristic Transfeminine, (N = 7278) Transmasculine, (N = 8286)
No procedures1 Procedures1 No procedures1 Procedures1
Age at Index 25 (18, 41) 30 (23, 42) 19 (15, 28) 24 (18, 32)
Age at Index Group



    <18 935 (25%) 253 (7.3%) 2,034 (42%) 752 (22%)
    18-34 1,612 (43%) 1,905 (55%) 2,181 (45%) 1,974 (57%)
    35-64 1,126 (30%) 1,229 (35%) 611 (13%) 688 (20%)
    65+ 117 (3.1%) 101 (2.9%) 23 (0.5%) 23 (0.7%)
Race/Ethnicity



    Non-Hispanic White 2,000 (53%) 2,007 (58%) 2,530 (52%) 1,970 (57%)
    Hispanic 826 (22%) 730 (21%) 1,192 (25%) 755 (22%)
    Non-Hispanic Asian 428 (11%) 389 (11%) 400 (8.2%) 289 (8.4%)
    Other/Unknown 312 (8.2%) 158 (4.5%) 384 (7.9%) 128 (3.7%)
    Non-Hispanic Black 224 (5.9%) 204 (5.8%) 343 (7.1%) 295 (8.6%)
KP site



    Georgia 67 (1.8%) 25 (0.7%) 58 (1.2%) 18 (0.5%)
    Northern California 2,369 (63%) 2,323 (67%) 3,106 (64%) 2,257 (66%)
    Southern California 1,354 (36%) 1,140 (33%) 1,685 (35%) 1,162 (34%)
Type of Insurance



    Commercial 3,044 (80%) 2,655 (76%) 3,699 (76%) 2,600 (76%)
    Medicaid 746 (20%) 833 (24%) 1,150 (24%) 837 (24%)
Percent living below poverty



    <10% 2,395 (66%) 2,186 (65%) 3,106 (65%) 2,106 (62%)
    10-20% 812 (22%) 762 (23%) 1,072 (22%) 827 (24%)
    >20% 419 (12%) 412 (12%) 604 (13%) 448 (13%)
1 Median (IQR); n (%)
table2a %>% gtsave(filename = "table2a.png")



Table 2b – Surgery History by Transgender Group

table2b <- data %>%
  select(age_at_index, age_at_index_group, race_ethnicity, site, 
         INS_MEDICAID, poverty_cat, GAS_surgery, trans_type) %>%
  mutate(GAS_surgery = factor(GAS_surgery, labels = c("No surgery", "Surgery"))) %>%
  mutate(poverty_cat = factor(poverty_cat, levels = c("<10%", "10-20%", ">20%"))) %>% 
  tbl_strata(strata = trans_type, .tbl_fun = ~ .x %>%
      tbl_summary(by = GAS_surgery, 
                    missing = "no",
                    type = list(where(is.logical) ~ "categorical"),
                    sort = race_ethnicity ~ "frequency",
                    label = list(race_ethnicity = "Race/Ethnicity",
                                 poverty_cat = "Percent living below poverty",
                                 GAS_surgery = "Surgery History")),
      .header = "**{strata}**, (N = {n})") %>%
  bold_labels() %>% 
  modify_header(label ~ "") %>%
  modify_header(all_stat_cols() ~ "**{level}**, N = {n}") %>%
  modify_caption("<div style='text-align: left; font-weight: bold; color: grey'>
                 Table 2b. Surgery History by Transgender Group</div>")%>%
  as_gt() %>%
  cols_width(label ~ px(250), starts_with("stat_1") ~ px(225), everything()~px(175))

table2b
Table 2b. Surgery History by Transgender Group
Transfeminine, (N = 7278) Transmasculine, (N = 8286)
No surgery, N = 59081 Surgery, N = 13701 No surgery, N = 55181 Surgery, N = 27681
Age at Index 27 (19, 39) 34 (24, 48) 20 (15, 28) 25 (18, 33)
Age at Index Group



    <18 1,093 (19%) 95 (6.9%) 2,201 (40%) 585 (21%)
    18-34 2,906 (49%) 611 (45%) 2,561 (46%) 1,594 (58%)
    35-64 1,763 (30%) 592 (43%) 729 (13%) 570 (21%)
    65+ 146 (2.5%) 72 (5.3%) 27 (0.5%) 19 (0.7%)
Race/Ethnicity



    Non-Hispanic White 3,240 (55%) 767 (56%) 2,895 (52%) 1,605 (58%)
    Hispanic 1,295 (22%) 261 (19%) 1,346 (24%) 601 (22%)
    Non-Hispanic Asian 639 (11%) 178 (13%) 453 (8.2%) 236 (8.5%)
    Other/Unknown 401 (6.8%) 69 (5.0%) 420 (7.6%) 92 (3.3%)
    Non-Hispanic Black 333 (5.6%) 95 (6.9%) 404 (7.3%) 234 (8.5%)
KP site



    Georgia 68 (1.2%) 24 (1.8%) 60 (1.1%) 16 (0.6%)
    Northern California 3,762 (64%) 930 (68%) 3,451 (63%) 1,912 (69%)
    Southern California 2,078 (35%) 416 (30%) 2,007 (36%) 840 (30%)
Type of Insurance



    Commercial 4,644 (79%) 1,055 (77%) 4,187 (76%) 2,112 (76%)
    Medicaid 1,264 (21%) 315 (23%) 1,331 (24%) 656 (24%)
Percent living below poverty



    <10% 3,763 (66%) 818 (64%) 3,530 (65%) 1,682 (62%)
    10-20% 1,282 (22%) 292 (23%) 1,231 (23%) 668 (25%)
    >20% 653 (11%) 178 (14%) 677 (12%) 375 (14%)
1 Median (IQR); n (%)
table2b %>% gtsave(filename = "table2b.png", vwidth = 1500, vheight = 1000)









Stratified Multivariate Models

Procedures

Procedures - TM

#redo the TM / TF dataframes so they are updated 
data_TF <- data[data$trans_type == "Transfeminine", ] 
data_TM <- data[data$trans_type == "Transmasculine", ] 

multi_proc_tm <- data_TM %>%
  mutate(poverty_cat = factor(poverty_cat, levels = c("<10%", "10-20%", ">20%"))) %>% 
  mutate(race_ethnicity = factor(race_ethnicity, levels = c("Non-Hispanic White", "Hispanic", "Non-Hispanic Asian", 
                                                           "Non-Hispanic Black", "Other/Unknown"))) %>% 
  glm(formula = GAS_any_binary ~ age_at_index_group + race_ethnicity + site + INS_MEDICAID + poverty_cat,
      data = ., family = binomial(link = "logit")) %>%
  tbl_regression(exponentiate = TRUE,
                 label = list(race_ethnicity = "Race/Ethnicity", 
                              poverty_cat = "Percent living below poverty")) %>%
  add_global_p() %>%
  bold_labels() %>%
  modify_header(estimate ~ "**aOR**", label ~ "") %>%
  modify_column_hide(columns = p.value) %>%
  modify_caption("<div style='text-align: left; font-weight: bold; color: grey'> 
                 Multivariate Analysis - Any Procedure (Transmasculine)") %>%
  as_gt() %>%
  rm_footnotes() %>%
  cols_width(label ~ px(250), everything()~px(100))

multi_proc_tm
Multivariate Analysis - Any Procedure (Transmasculine)
aOR 95% CI
Age at Index Group

    <18 — —
    18-34 2.50 2.25, 2.78
    35-64 3.09 2.68, 3.57
    65+ 2.82 1.52, 5.22
Race/Ethnicity

    Non-Hispanic White — —
    Hispanic 0.86 0.76, 0.97
    Non-Hispanic Asian 0.93 0.79, 1.10
    Non-Hispanic Black 1.03 0.87, 1.23
    Other/Unknown 0.41 0.33, 0.50
KP site

    Georgia — —
    Northern California 2.70 1.60, 4.78
    Southern California 2.69 1.58, 4.78
Type of Insurance

    Commercial — —
    Medicaid 1.11 1.00, 1.24
Percent living below poverty

    <10% — —
    10-20% 1.07 0.96, 1.20
    >20% 0.98 0.85, 1.13
multi_proc_tm %>% gtsave(filename = "multi_proc_tm.png") 

Procedures - TF

multi_proc_tf <- data_TF %>%
  mutate(poverty_cat = factor(poverty_cat, levels = c("<10%", "10-20%", ">20%"))) %>% 
  mutate(race_ethnicity = factor(race_ethnicity, levels = c("Non-Hispanic White", "Hispanic", "Non-Hispanic Asian", 
                                                           "Non-Hispanic Black", "Other/Unknown"))) %>% 
  glm(formula = GAS_any_binary ~ age_at_index_group + race_ethnicity + site + INS_MEDICAID + poverty_cat,
      data = ., family = binomial(link = "logit")) %>%
  tbl_regression(exponentiate = TRUE,
                 label = list(race_ethnicity = "Race/Ethnicity", 
                              poverty_cat = "Percent living below poverty")) %>%
  add_global_p() %>%
  bold_labels() %>%
  modify_header(estimate ~ "**aOR**", label ~ "") %>%
  modify_column_hide(columns = p.value) %>%
  modify_caption("<div style='text-align: left; font-weight: bold; color: grey'> 
                 Multivariate Analysis - Any Procedure (Transfeminine)") %>%
  as_gt() %>%
  rm_footnotes() %>%
  cols_width(label ~ px(250), everything()~px(100))

multi_proc_tf
Multivariate Analysis - Any Procedure (Transfeminine)
aOR 95% CI
Age at Index Group

    <18 — —
    18-34 4.68 4.01, 5.49
    35-64 4.40 3.73, 5.20
    65+ 3.26 2.38, 4.45
Race/Ethnicity

    Non-Hispanic White — —
    Hispanic 0.95 0.83, 1.08
    Non-Hispanic Asian 0.86 0.73, 1.01
    Non-Hispanic Black 0.89 0.72, 1.11
    Other/Unknown 0.48 0.39, 0.60
KP site

    Georgia — —
    Northern California 2.41 1.51, 3.94
    Southern California 2.00 1.25, 3.30
Type of Insurance

    Commercial — —
    Medicaid 1.41 1.25, 1.60
Percent living below poverty

    <10% — —
    10-20% 0.98 0.87, 1.11
    >20% 0.99 0.84, 1.15
multi_proc_tf %>% gtsave(filename = "multi_proc_tf.png") 



Surgery

Surgery - TM

multi_surg_tm <- data_TM %>%
  mutate(poverty_cat = factor(poverty_cat, levels = c("<10%", "10-20%", ">20%"))) %>% 
  mutate(race_ethnicity = factor(race_ethnicity, levels = c("Non-Hispanic White", "Hispanic", "Non-Hispanic Asian", 
                                                           "Non-Hispanic Black", "Other/Unknown"))) %>% 
  glm(formula = GAS_surgery_binary ~ age_at_index_group + race_ethnicity + site + INS_MEDICAID + poverty_cat,
      data = ., family = binomial(link = "logit")) %>%
  tbl_regression(exponentiate = TRUE,
                 label = list(race_ethnicity = "Race/Ethnicity", 
                              poverty_cat = "Percent living below poverty")) %>%
  add_global_p() %>%
  bold_labels() %>%
  modify_header(estimate ~ "**aOR**", label ~ "") %>%
  modify_column_hide(columns = p.value) %>%
  modify_caption("<div style='text-align: left; font-weight: bold; color: grey'> 
                 Multivariate Analysis - Any Surgery (Transmasculine)") %>%
  as_gt() %>%
  rm_footnotes() %>%
  cols_width(label ~ px(250), everything()~px(100))

multi_surg_tm
Multivariate Analysis - Any Surgery (Transmasculine)
aOR 95% CI
Age at Index Group

    <18 — —
    18-34 2.38 2.13, 2.67
    35-64 2.89 2.50, 3.36
    65+ 2.86 1.52, 5.30
Race/Ethnicity

    Non-Hispanic White — —
    Hispanic 0.91 0.80, 1.02
    Non-Hispanic Asian 0.94 0.79, 1.12
    Non-Hispanic Black 0.97 0.81, 1.17
    Other/Unknown 0.38 0.30, 0.48
KP site

    Georgia — —
    Northern California 2.35 1.37, 4.29
    Southern California 1.81 1.04, 3.31
Type of Insurance

    Commercial — —
    Medicaid 1.05 0.94, 1.18
Percent living below poverty

    <10% — —
    10-20% 1.10 0.98, 1.24
    >20% 1.09 0.94, 1.26
multi_surg_tm %>% gtsave(filename = "multi_surg_tm.png") 

Surgery - TF

multi_surg_tf <- data_TF %>%
  mutate(poverty_cat = factor(poverty_cat, levels = c("<10%", "10-20%", ">20%"))) %>% 
  mutate(race_ethnicity = factor(race_ethnicity, levels = c("Non-Hispanic White", "Hispanic", "Non-Hispanic Asian", 
                                                           "Non-Hispanic Black", "Other/Unknown"))) %>% 
  glm(formula = GAS_surgery_binary ~ age_at_index_group + race_ethnicity + site + INS_MEDICAID + poverty_cat,
      data = ., family = binomial(link = "logit")) %>%
  tbl_regression(exponentiate = TRUE,
                 label = list(race_ethnicity = "Race/Ethnicity", 
                              poverty_cat = "Percent living below poverty")) %>%
  add_global_p() %>%
  bold_labels() %>%
  modify_header(estimate ~ "**aOR**", label ~ "") %>%
  modify_column_hide(columns = p.value) %>%
  modify_caption("<div style='text-align: left; font-weight: bold; color: grey'> 
                 Multivariate Analysis - Any Surgery (Transfeminine)") %>%
  as_gt() %>%
  rm_footnotes() %>%
  cols_width(label ~ px(250), everything()~px(100))

multi_surg_tf
Multivariate Analysis - Any Surgery (Transfeminine)
aOR 95% CI
Age at Index Group

    <18 — —
    18-34 2.45 1.95, 3.10
    35-64 3.79 3.01, 4.83
    65+ 5.55 3.84, 8.00
Race/Ethnicity

    Non-Hispanic White — —
    Hispanic 0.97 0.82, 1.14
    Non-Hispanic Asian 1.27 1.05, 1.53
    Non-Hispanic Black 1.22 0.94, 1.57
    Other/Unknown 0.73 0.55, 0.96
KP site

    Georgia — —
    Northern California 0.69 0.43, 1.14
    Southern California 0.50 0.31, 0.83
Type of Insurance

    Commercial — —
    Medicaid 1.27 1.09, 1.47
Percent living below poverty

    <10% — —
    10-20% 1.02 0.88, 1.19
    >20% 1.19 0.98, 1.43
multi_surg_tf %>% gtsave(filename = "multi_surg_tf.png") 









Appendix

Univariate Analyses

Univariate - Procedures

univariate_proc <- data %>%
  select (age_at_index, age_at_index_group, race_ethnicity, site, 
          INS_MEDICAID, poverty_cat, GAS_any_binary, trans_type) %>%
  mutate(poverty_cat = factor(poverty_cat, levels = c("<10%", "10-20%", ">20%"))) %>% 
  mutate(race_ethnicity = factor(race_ethnicity, levels = c("Non-Hispanic White", "Hispanic", "Non-Hispanic Asian", 
                                                            "Non-Hispanic Black", "Other/Unknown"))) %>% 
  tbl_uvregression(method = glm, 
                   y = GAS_any_binary, 
                   exponentiate = TRUE,
                   label = list(race_ethnicity = "Race/Ethnicity",
                                poverty_cat = "Percent living below poverty")) %>%
  add_global_p() %>%
  bold_labels() %>%
  modify_header(estimate ~ "**OR**", label ~ "") %>%
  modify_column_hide(columns = c(stat_n, p.value)) %>%
  modify_caption("<div style='text-align: left; font-weight: bold; color: grey'> 
                 Univariate Analysis for Receipt of Any Procedure") %>%
  as_gt() %>%
  rm_footnotes() %>%
  cols_width(label ~ px(250),
             everything()~px(100))

univariate_proc
Univariate Analysis for Receipt of Any Procedure
OR 95% CI
Age at Index 1.01 1.01, 1.01
Age at Index Group

    <18 — —
    18-34 1.29 1.26, 1.31
    35-64 1.31 1.28, 1.34
    65+ 1.24 1.17, 1.32
Race/Ethnicity

    Non-Hispanic White — —
    Hispanic 0.96 0.94, 0.98
    Non-Hispanic Asian 0.98 0.96, 1.01
    Non-Hispanic Black 1.00 0.97, 1.03
    Other/Unknown 0.84 0.81, 0.87
KP site

    Georgia — —
    Northern California 1.22 1.13, 1.32
    Southern California 1.19 1.10, 1.29
Type of Insurance

    Commercial — —
    Medicaid 1.03 1.01, 1.05
Percent living below poverty

    <10% — —
    10-20% 1.02 1.00, 1.04
    >20% 1.02 0.99, 1.04
Transgender Group

    Transfeminine — —
    Transmasculine 0.94 0.92, 0.95
univariate_proc %>% gtsave(filename = "univariate_proc.png") 


Univariate - Surgery

univariate_surg <- data %>%
  select (age_at_index, age_at_index_group, race_ethnicity, site, 
          INS_MEDICAID, poverty_cat, GAS_surgery_binary, trans_type) %>%
  mutate(poverty_cat = factor(poverty_cat, levels = c("<10%", "10-20%", ">20%"))) %>% 
  mutate(race_ethnicity = factor(race_ethnicity, levels = c("Non-Hispanic White", "Hispanic", "Non-Hispanic Asian", 
                                                            "Non-Hispanic Black", "Other/Unknown"))) %>% 
  tbl_uvregression(method = glm, 
                   y = GAS_surgery_binary, 
                   exponentiate = TRUE,
                   label = list(race_ethnicity = "Race/Ethnicity",
                                poverty_cat = "Percent living below poverty")) %>%
  add_global_p() %>%
  bold_labels() %>%
  modify_header(estimate ~ "**OR**", label ~ "") %>%
  modify_column_hide(columns = c(stat_n, p.value)) %>%
  modify_caption("<div style='text-align: left; font-weight: bold; color: grey'>
                 Univariate Analysis for Receipt of Any Surgery") %>%
  as_gt() %>%
  rm_footnotes() %>%
  cols_width(label ~ px(250), everything()~px(100))

 
univariate_surg
Univariate Analysis for Receipt of Any Surgery
OR 95% CI
Age at Index 1.00 1.00, 1.00
Age at Index Group

    <18 — —
    18-34 1.12 1.10, 1.14
    35-64 1.16 1.14, 1.18
    65+ 1.19 1.13, 1.26
Race/Ethnicity

    Non-Hispanic White — —
    Hispanic 0.97 0.95, 0.98
    Non-Hispanic Asian 1.00 0.97, 1.02
    Non-Hispanic Black 1.03 1.00, 1.06
    Other/Unknown 0.89 0.87, 0.92
KP site

    Georgia — —
    Northern California 1.05 0.98, 1.12
    Southern California 1.00 0.93, 1.07
Type of Insurance

    Commercial — —
    Medicaid 1.01 0.99, 1.03
Percent living below poverty

    <10% — —
    10-20% 1.02 1.00, 1.04
    >20% 1.04 1.02, 1.06
Transgender Group

    Transfeminine — —
    Transmasculine 1.16 1.14, 1.17
univariate_surg %>% gtsave(filename = "univariate_surg.png") 







Multivariate Models

Multivariate - Procedures

multi_proc <- data %>%
  mutate(poverty_cat = factor(poverty_cat, levels = c("<10%", "10-20%", ">20%"))) %>% 
  mutate(race_ethnicity = factor(race_ethnicity, levels = c("Non-Hispanic White", "Hispanic", "Non-Hispanic Asian", 
                                                           "Non-Hispanic Black", "Other/Unknown"))) %>% 
  glm(formula = GAS_any_binary ~ age_at_index_group + race_ethnicity + site + trans_type + INS_MEDICAID + poverty_cat,
      data = ., family = binomial(link = "logit")) %>%
  tbl_regression(exponentiate = TRUE,
                 label = list(race_ethnicity = "Race/Ethnicity",
                              poverty_cat = "Percent living below poverty")) %>%
  add_global_p() %>%
  bold_labels() %>%
  modify_header(estimate ~ "**aOR**", label ~ "") %>%
  modify_column_hide(columns = p.value) %>%
  modify_caption("<div style='text-align: left; font-weight: bold; color: grey'> 
                 Multivariate Analysis for Receipt of Any Procedure") %>%
  as_gt() %>%
  rm_footnotes() %>%
  cols_width(label ~ px(250), everything()~px(100))

multi_proc
Multivariate Analysis for Receipt of Any Procedure
aOR 95% CI
Age at Index Group

    <18 — —
    18-34 3.10 2.84, 3.38
    35-64 3.32 3.00, 3.68
    65+ 2.46 1.89, 3.21
Race/Ethnicity

    Non-Hispanic White — —
    Hispanic 0.90 0.82, 0.98
    Non-Hispanic Asian 0.90 0.80, 1.01
    Non-Hispanic Black 0.97 0.85, 1.11
    Other/Unknown 0.45 0.38, 0.52
KP site

    Georgia — —
    Northern California 2.51 1.77, 3.62
    Southern California 2.30 1.62, 3.34
Transgender Group

    Transfeminine — —
    Transmasculine 0.90 0.84, 0.97
Type of Insurance

    Commercial — —
    Medicaid 1.23 1.14, 1.34
Percent living below poverty

    <10% — —
    10-20% 1.03 0.95, 1.12
    >20% 0.98 0.88, 1.09
multi_proc %>% gtsave(filename = "multi_proc.png")


Multivariate - Surgery

multi_surg <- data %>%
  mutate(poverty_cat = factor(poverty_cat, levels = c("<10%", "10-20%", ">20%"))) %>% 
  mutate(race_ethnicity = factor(race_ethnicity, levels = c("Non-Hispanic White", "Hispanic", "Non-Hispanic Asian", 
                                                           "Non-Hispanic Black", "Other/Unknown"))) %>% 
  glm(formula = GAS_surgery_binary ~ age_at_index_group + race_ethnicity + site + trans_type + INS_MEDICAID + poverty_cat,
      data = ., family = binomial(link = "logit")) %>%
  tbl_regression(exponentiate = TRUE,
                 label = list(race_ethnicity = "Race/Ethnicity",
                              poverty_cat = "Percent living below poverty")) %>%
  add_global_p() %>%
  bold_labels() %>%
  modify_header(estimate ~ "**aOR**", label ~ "") %>%
  modify_column_hide(columns = p.value) %>%
  modify_caption("<div style='text-align: left; font-weight: bold; color: grey'> 
                 Multivariate Analysis for Receipt of Any Surgery") %>%
  as_gt() %>%
  rm_footnotes() %>%
  cols_width(label ~ px(250), everything()~px(100))

multi_surg
Multivariate Analysis for Receipt of Any Surgery
aOR 95% CI
Age at Index Group

    <18 — —
    18-34 2.35 2.13, 2.60
    35-64 3.21 2.85, 3.61
    65+ 4.38 3.27, 5.82
Race/Ethnicity

    Non-Hispanic White — —
    Hispanic 0.93 0.84, 1.03
    Non-Hispanic Asian 1.07 0.94, 1.22
    Non-Hispanic Black 1.04 0.89, 1.20
    Other/Unknown 0.49 0.40, 0.58
KP site

    Georgia — —
    Northern California 1.26 0.87, 1.86
    Southern California 0.95 0.66, 1.40
Transgender Group

    Transfeminine — —
    Transmasculine 2.79 2.57, 3.02
Type of Insurance

    Commercial — —
    Medicaid 1.13 1.03, 1.23
Percent living below poverty

    <10% — —
    10-20% 1.07 0.98, 1.17
    >20% 1.12 1.00, 1.26
multi_surg %>% gtsave(filename = "multi_surg.png")









Interaction Testing

Interaction - Procedure

Explore all two-way interactions between TM/TF status and other variables (outcome = any PROCEDURE)

interaction_proc <- data %>%
  mutate(poverty_cat = factor(poverty_cat, levels = c("<10%", "10-20%", ">20%"))) %>% 
  mutate(race_ethnicity = factor(race_ethnicity, levels = c("Non-Hispanic White", "Hispanic", "Non-Hispanic Asian", 
                                                           "Non-Hispanic Black", "Other/Unknown"))) %>% 
  glm(GAS_any_binary ~ trans_type * age_at_index_group + trans_type * race_ethnicity + 
        trans_type * site + trans_type * INS_MEDICAID + trans_type * poverty_cat,
      data = ., family = binomial(link = "logit")) %>%
  tbl_regression(exponentiate = TRUE,
                 label = list(race_ethnicity = "Race/Ethnicity",
                              poverty_cat = "Percent living below poverty")) %>%
  add_global_p() %>%
  bold_labels() %>%
  modify_header(estimate ~ "**aOR**", label ~ "") %>%
  modify_column_hide(columns = p.value) %>%
  modify_caption("<div style='text-align: left; font-weight: bold; color: grey'> 
                 Multivariate Analysis with Interaction Terms (Procedures) ") %>%
  as_gt() %>%
  rm_footnotes()

interaction_proc
Multivariate Analysis with Interaction Terms (Procedures)
aOR 95% CI
Transgender Group

    Transfeminine — —
    Transmasculine 1.24 0.58, 2.59
Age at Index Group

    <18 — —
    18-34 4.68 4.01, 5.49
    35-64 4.40 3.73, 5.20
    65+ 3.26 2.38, 4.45
Race/Ethnicity

    Non-Hispanic White — —
    Hispanic 0.95 0.83, 1.08
    Non-Hispanic Asian 0.86 0.73, 1.01
    Non-Hispanic Black 0.89 0.72, 1.11
    Other/Unknown 0.48 0.39, 0.60
KP site

    Georgia — —
    Northern California 2.41 1.51, 3.94
    Southern California 2.00 1.25, 3.30
Type of Insurance

    Commercial — —
    Medicaid 1.41 1.25, 1.60
Percent living below poverty

    <10% — —
    10-20% 0.98 0.87, 1.11
    >20% 0.99 0.84, 1.15
Transgender Group * Age at Index Group

    Transmasculine * 18-34 0.53 0.44, 0.65
    Transmasculine * 35-64 0.70 0.56, 0.88
    Transmasculine * 65+ 0.86 0.43, 1.73
Transgender Group * Race/Ethnicity

    Transmasculine * Hispanic 0.91 0.76, 1.08
    Transmasculine * Non-Hispanic Asian 1.08 0.86, 1.36
    Transmasculine * Non-Hispanic Black 1.16 0.88, 1.53
    Transmasculine * Other/Unknown 0.84 0.62, 1.14
Transgender Group * KP site

    Transmasculine * Northern California 1.12 0.55, 2.34
    Transmasculine * Southern California 1.34 0.65, 2.82
Transgender Group * Type of Insurance

    Transmasculine * Medicaid 0.78 0.67, 0.92
Transgender Group * Percent living below poverty

    Transmasculine * 10-20% 1.09 0.93, 1.28
    Transmasculine * >20% 0.99 0.80, 1.22
interaction_proc %>% gtsave(filename = "interaction_proc.png") 


Interaction - Surgery

Explore all two-way interactions between TM/TF status and other variables (outcome = any SURGERY)

interaction_surg <- data %>%
  mutate(poverty_cat = factor(poverty_cat, levels = c("<10%", "10-20%", ">20%"))) %>% 
  mutate(race_ethnicity = factor(race_ethnicity, levels = c("Non-Hispanic White", "Hispanic", "Non-Hispanic Asian", 
                                                           "Non-Hispanic Black", "Other/Unknown"))) %>% 
  glm(GAS_surgery_binary ~ trans_type * age_at_index_group + trans_type * race_ethnicity + trans_type * site +
        trans_type * INS_MEDICAID + trans_type * poverty_cat,
      data = ., family = binomial(link = "logit")) %>%
  tbl_regression(exponentiate = TRUE,
                 label = list(race_ethnicity = "Race/Ethnicity",
                              poverty_cat = "Percent living below poverty")) %>%
  add_global_p() %>%
  bold_labels() %>%
  modify_header(estimate ~ "**aOR**", label ~ "") %>%
  modify_column_hide(columns = p.value) %>%
  modify_caption("<div style='text-align: left; font-weight: bold; color: grey'> 
                 Multivariate Analysis with Interaction Terms (Surgeries) ") %>%
  as_gt() %>%
  rm_footnotes()

interaction_surg
Multivariate Analysis with Interaction Terms (Surgeries)
aOR 95% CI
Transgender Group

    Transfeminine — —
    Transmasculine 1.03 0.47, 2.24
Age at Index Group

    <18 — —
    18-34 2.45 1.95, 3.10
    35-64 3.79 3.01, 4.83
    65+ 5.55 3.84, 8.00
Race/Ethnicity

    Non-Hispanic White — —
    Hispanic 0.97 0.82, 1.14
    Non-Hispanic Asian 1.27 1.05, 1.53
    Non-Hispanic Black 1.22 0.94, 1.57
    Other/Unknown 0.73 0.55, 0.96
KP site

    Georgia — —
    Northern California 0.69 0.43, 1.14
    Southern California 0.50 0.31, 0.83
Type of Insurance

    Commercial — —
    Medicaid 1.27 1.09, 1.47
Percent living below poverty

    <10% — —
    10-20% 1.02 0.88, 1.19
    >20% 1.19 0.98, 1.43
Transgender Group * Age at Index Group

    Transmasculine * 18-34 0.97 0.75, 1.25
    Transmasculine * 35-64 0.76 0.58, 1.00
    Transmasculine * 65+ 0.52 0.25, 1.06
Transgender Group * Race/Ethnicity

    Transmasculine * Hispanic 0.94 0.76, 1.15
    Transmasculine * Non-Hispanic Asian 0.74 0.57, 0.96
    Transmasculine * Non-Hispanic Black 0.80 0.58, 1.10
    Transmasculine * Other/Unknown 0.51 0.36, 0.74
Transgender Group * KP site

    Transmasculine * Northern California 3.40 1.62, 7.28
    Transmasculine * Southern California 3.63 1.71, 7.84
Transgender Group * Type of Insurance

    Transmasculine * Medicaid 0.83 0.69, 1.00
Transgender Group * Percent living below poverty

    Transmasculine * 10-20% 1.08 0.89, 1.31
    Transmasculine * >20% 0.92 0.72, 1.16
interaction_surg %>% gtsave(filename = "interaction_surg.png")







Time-to-event Analyses

Preparing Time Variables

Make new variable equal to the number of days between index date and admission date.

Check distribution of time to surgery …. NOTE: there are 319 cases where time is < 0 and 302 cases where time is equal to zero.

# summarize new variable ... look at min and number of NA's
summary(data$diff_adate) # ...min = -10675
##     Min.  1st Qu.   Median     Mean  3rd Qu.     Max.     NA's 
## -10675.0    175.0    482.0    713.6   1066.0   6210.0     8639
# histogram of time (years)
ggplot(data, aes(x = diff_adate)) +
  geom_histogram(binwidth = 0.5, fill = "skyblue", color = "black") +  
  labs(title = "Histogram of diff_adate", x = "Difference", y = "Frequency")

Make new time_days variable that only includes cases were time to surgery is greater than 0. Duplicate this variable and convert to years. Look at time to surgery distribution

# new variable that sets dates <= 0 to NA
data <- data %>% mutate(time_days = ifelse(diff_adate <= 0, NA, diff_adate))

# convert to years
data <- data %>% mutate(time_years = time_days/365)

# histogram of time (years)
ggplot(data, aes(x = time_years)) +
  geom_histogram(binwidth = 0.5, fill = "skyblue", color = "black") +  
  labs(title = "Histogram of time_years", x = "Difference", y = "Frequency")



Kaplan-Meier

Make Kaplan-Meier survival plots for time in years to any procedure and any surgery

# make survival objects for any PROCEDURE and any SURGERY
surv_obj_proc <- Surv(time = data$time_years, event = data$GAS_any_binary)
surv_obj_surg <- Surv(time = data$time_years, event = data$GAS_surgery_binary)


# Create survival curve
s1_proc <- survfit(surv_obj_proc ~ 1, data = data)
s1_surg <- survfit(surv_obj_surg ~ 1, data = data)


# Plot survival curve for PROCEDURES
km_curve_proc <- ggsurvfit(s1_proc, linewidth = 1) +
  labs(title = "Kaplan-Meier Survival Plot for Procedures", x = 'Years', y = 'Overall survival') +
  add_confidence_interval() +
  add_risktable() +
  scale_ggsurvfit()
km_curve_proc

# Plot survival curve for SURGERY
km_curve_surg <- ggsurvfit(s1_surg, linewidth = 1) +
  labs(title = "Kaplan-Meier Survival Plot for Surgeries", x = 'Years', y = 'Overall survival') +
  add_confidence_interval() +
  add_risktable() +
  scale_ggsurvfit()
km_curve_surg



Log-Rank Tests

Compare Kaplan-Meier survival plots by transgender group

# Log rank test by trans type for PROCEDURES
s2_proc <- survfit(surv_obj_proc ~ trans_type, data = data)
ggsurvplot(s2_proc, data = data,
           size = 1,
           censor.shape = '|', censor.size = 4,
           conf.int = TRUE,
           pval = TRUE,
           risk.table = TRUE,
           risk.table.height = 0.25,
           ggtheme = theme_bw(),
           title = "Log-Rank Test for Procedures by Transgender Group")

# Log rank test by trans type for PROCEDURES
s2_surg <- survfit(surv_obj_surg ~ trans_type, data = data)
ggsurvplot(s2_surg, data = data,
           size = 1,
           censor.shape = '|', censor.size = 4,
           conf.int = TRUE,
           pval = TRUE,
           risk.table = TRUE,
           risk.table.height = 0.25,
           ggtheme = theme_bw(),
           title = "Log-Rank Test for Surgeries by Transgender Group")



Cumulative Event

# plot cumulative event
ggsurvplot(fit_proc,
          data = data,
          conf.int = TRUE,
          risk.table.col = "strata", # Change risk table color by groups
          ggtheme = theme_bw(), # Change ggplot2 theme
          fun = "event",
          title = "Cumulative Event by Transgender Group (Procedures)")

ggsurvplot(fit_surg,
          data = data,
          conf.int = TRUE,
          risk.table.col = "strata", # Change risk table color by groups
          ggtheme = theme_bw(), # Change ggplot2 theme
          fun = "event",
          title = "Cumulative Event by Transgender Group (Surgery)")



Cumulative Hazard

# plot cumulative hazard
ggsurvplot(fit_proc,
          data = data,
          conf.int = TRUE,
          risk.table.col = "strata", # Change risk table color by groups
          ggtheme = theme_bw(), # Change ggplot2 theme
          fun = "cumhaz",
          title = "Cumulative Hazard by Transgender Group (Procedures)")

ggsurvplot(fit_surg,
          data = data,
          conf.int = TRUE,
          risk.table.col = "strata", # Change risk table color by groups
          ggtheme = theme_bw(), # Change ggplot2 theme
          fun = "cumhaz",
          title = "Cumulative Hazard by Transgender Group (Surgery)")



Adjusted Cumulative Hazard

data$trans_type <- factor(data$trans_type) 

cox_res_proc <- coxph(Surv(time_years, GAS_any_binary) ~ strata(trans_type) + age_at_index_group + race_ethnicity + site + INS_MEDICAID + poverty_cat, data = data, x=TRUE)

cox_res_surg <- coxph(Surv(time_years, GAS_surgery_binary) ~ strata(trans_type) + age_at_index_group + race_ethnicity + site + INS_MEDICAID + poverty_cat, data = data, x=TRUE)

# cumulative hazard curves
ggsurvplot(survfit(cox_res_proc),
          data = data,
          conf.int = TRUE,
          risk.table.col = "strata", 
          risk.table = FALSE,
          fun = "cumhaz",
          title = "Adjusted Cumulative Hazard for Any Procedure",
          subtitle = "Adjusted for age at index group, race/ethnicity, KP site, type of insurance, and percent living below poverty.",
          font.subtitle = c("#838383"),
          legend = c(0.15,0.85),
          xlab = "Time (Years)",
          ggtheme = theme()) 

ggsurvplot(survfit(cox_res_surg),
          data = data,
          conf.int = TRUE,
          risk.table.col = "strata", 
          fun = "cumhaz",
          title = "Adjusted Cumulative Hazard for Surgery",
          subtitle = "Adjusted for age at index group, race/ethnicity, KP site, type of insurance, and percent living below poverty.",
          font.subtitle = c("#838383"),
          legend = c(0.15,0.85),
          xlab = "Time (Years)",
          ggtheme = theme()) 



Adjusted Survival

# Confounder-adjusted survival curves --> takes forever to run
adjsurv_proc <- adjustedsurv(data=data,
                        variable="trans_type",
                        ev_time="time_years",
                        event="GAS_any_binary",
                        method="direct",
                        outcome_model=cox_res_proc,
                        conf_int=TRUE,
                        ggtheme=theme()) 
plot(adjsurv_proc, title= "Adjusted Cumulative Hazard for Any Procedure", conf_int=TRUE)

adjsurv_surg <- adjustedsurv(data=data,
                        variable="trans_type",
                        ev_time="time_years",
                        event="GAS_surgery_binary",
                        method="direct",
                        outcome_model=cox_res_surg,
                        conf_int=TRUE,
                        ggtheme=theme())
plot(adjsurv_surg, title= "Adjusted Cumulative Hazard for Surgery", conf_int=TRUE)







Notes/Questions

  • No duplicates in study_id…if each row is an individual pt, what happens if a pt has more than one procedure?
  • 319 pts with admission date before index date, 302 with admission data = index date