Association of alcohol use with helmet use in cyclists: analysis of the National Trauma Data Bank.
The 7 matches
- [1] § Methods › Study outcomes ↔ 03_Statistical_Analysis.Rmd, lines 244–311 · score 0.99 · deep vein thrombosis, acute respiratory distress, acute kidney injury, cardiac arrest, alcohol withdrawal syndrome, pulmonary embolism
- [2] § Results ↔ 03_Statistical_Analysis.Rmd, lines 566–624 · score 0.96 · acute respiratory distress, acute kidney injury, unplanned admission, cardiac arrest, alcohol withdrawal syndrome, unplanned intubation
- [3] § Methods › Statistical methods ↔ 04_Feature_Selection.ipynb, lines 90–97 · score 0.85 · fold cross validation, GridSearchCV, feature selection, logistic regression, optimize, hyperparameters
- [4] § Methods › Data source and patient selection ↔ 03_Statistical_Analysis.Rmd, lines 325–356 · score 0.68 · BAC screening, 0.08 %, 0.02 %, ethnicity, sex, age
- [5] § Results ↔ 03_Statistical_Analysis.Rmd, lines 1077–1136 · score 0.61 · AIS scores, Abdominal, Chest, pelvic, neck, Extremities
- [6] § Methods › Data source and patient selection ↔ 04_Feature_Selection.ipynb, lines 28–35 · score 0.55 · PROTDEV_HELMET, numeric, ethnicity, sex, age, race
- [7] § Results ↔ 03_Statistical_Analysis.Rmd, lines 907–934 · score 0.53 · risk factors, logistic regression, tobacco, race, disorders, wearing
Paper
Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
R Markdown · 1,277 lines · 47 KB · no license · 5 matches
- ---
- title: "Statistical_Analysis.Rmd"
- author: "Daniel Brock"
- date: "8/2/2023"
- output: html_document
- ---
- # 0. Importing Packages and setting working directory
- ```{r setup, include=FALSE}
- # Packages
- library(plyr)
- library(tidyverse)
- library(finalfit)
- library(broom)
- library(ggfortify)
- library(ggthemes)
- library(patchwork)
- library(magrittr)
- library(forcats)
- library(rstatix)
- #library(rcompanion)
- library(survival)
- library(survminer)
- library(readxl)
- library(writexl)
- library(pheatmap)
- library(zoo)
- library(sjPlot)
- library(DHARMa)
- # Setting working directory
- cwd <- getwd()
- ```
- # 1. Importing merged trauma dataset from python export
- ```{r}
- # Importing datasets
- trauma <- read_csv(file = paste0(cwd, "/TQP_Processed/trauma_merged.csv"))
- comor <- read_csv(file = paste0(cwd, "/TQP_Processed/comorbidities_merged.csv"))
- adverse <- read_csv(file = paste0(cwd, "/TQP_Processed/adverse_events_merged.csv"))
- ais <- read_csv(file = paste0(cwd, "/TQP_Processed/ais_merged.csv"))
- # Calculating total NTDB cases (from python file)
- total_cases <- 997970 + 1043736 + 1097190 + 1133053 + 1209097 + 1232956 + 1300735
- print(total_cases)
- ```
- ## 1.1 Viewing the data and dropping important NA rows
- ```{r}
- # Replacing quote marks in ecodes
- trauma$ECODE_DESC <- gsub(pattern = "\"", replacement = "", x = trauma$ECODE_DESC)
- # Merging trauma with comorbidities
- trauma <- merge(trauma, comor, on = "INC_KEY")
- # Merging trauma with adverse events
- trauma <- merge(trauma, adverse, on = "INC_KEY")
- # Glimpsing
- trauma_glimpse <- ff_glimpse(trauma)
- trauma_glimpse_continuous <- trauma_glimpse$Continuous
- trauma_glimpse_categorical <- trauma_glimpse$Categorical
- ```
- ## 1.2 Refactoring data for table 1
- ```{r}
- # Refactoring Sex
- trauma <- trauma %>% filter(SEX != 3) %>% mutate(
- sex.factor = SEX %>%
- factor() %>%
- fct_recode("Male" = "1", "Female" = "2") %>%
- ff_label("Sex")
- )
- # Refactoring Age
- trauma <- trauma %>%
- mutate(
- age.factor =
- AGEYEARS %>%
- cut(breaks = c(0,10,20,30,40,50,60,70,100), include.lowest = TRUE, right = FALSE) %>%
- fct_recode(
- "0-9" = "[0,10)",
- "10-19" = "[10,20)",
- "20-29" = "[20,30)",
- "30-39" = "[30,40)",
- "40-49" = "[40,50)",
- "50-59" = "[50,60)",
- "60-69" = "[60,70)",
- "70+" = "[70,100]",
- ) %>%
- ff_label("Age (years)")
- )
- # Refactoring Race
- trauma <- trauma %>% mutate(
- race.factor = case_when(
- ASIAN == 1 ~ "Asian",
- PACIFICISLANDER == 1 ~ "Pacific Islander",
- RACEOTHER == 1 ~ "Other",
- AMERICANINDIAN == 1 ~ "Native American",
- BLACK == 1 ~ "Black",
- WHITE == 1 ~ "White",
- RACE_NA == 1 ~ "NA",
- RACE_UK == 1 ~ "NA"
- )
- )
- trauma <- trauma %>% mutate(
- race.factor = na_if(race.factor, "NA") %>%
- factor(levels = c("White", "Black", "Asian", "Native American", "Pacific Islander", "Other")) %>%
- ff_label("Race")
- )
- # Refactoring Ethnicity
- trauma <- trauma %>% mutate(
- ethnicity.factor = ETHNICITY %>%
- factor() %>%
- fct_recode("Hispanic" = "1", "Not Hispanic" = "2") %>%
- ff_label("Ethnicity")
- )
- # Refactoring Helmet Wearing
- trauma <- trauma %>% mutate(
- helmet.factor = case_when(
- PROTDEV_HELMET == 1 & PROTDEV_UK != 1 ~ "Helmet",
- PROTDEV_HELMET == 0 & PROTDEV_UK != 1 ~ "No Helmet",
- PROTDEV_UK == 1 ~ "NA"
- )
- )
- trauma <- trauma %>% mutate(
- helmet.factor = na_if(helmet.factor, "NA") %>%
- factor(levels = c("Helmet", "No Helmet")) %>%
- ff_label("Helmet Use")
- )
- # Refactoring hypotension
- trauma <- trauma %>% mutate(
- SBP = SBP %>% ff_label("SBP mmHg")
- )
- trauma <- trauma %>% mutate(
- sbp.hypo = case_when(
- SBP < 90 ~ "Hypotensive",
- SBP >= 90 ~ "Not Hypotensive"
- ) %>%
- ff_label("SBP mmHg <90")
- )
- # Refactoring TOTALGCS
- trauma <- trauma %>% mutate(
- TOTALGCS = TOTALGCS %>% ff_label("Total GCS")
- )
- # Multiple drug use
- trauma$total.drugs <- trauma$DRGSCR_AMPHETAMINE + trauma$DRGSCR_BARBITURATE + trauma$DRGSCR_BENZODIAZEPINES + trauma$DRGSCR_COCAINE + trauma$DRGSCR_METHAMPHETAMINE + trauma$DRGSCR_ECSTASY + trauma$DRGSCR_METHADONE + trauma$DRGSCR_OPIOID + trauma$DRGSCR_OXYCODONE + trauma$DRGSCR_PHENCYCLIDINE + trauma$DRGSCR_TRICYCLICDEPRESS + trauma$DRGSCR_CANNABINOID + trauma$DRGSCR_OTHER
- # Alcohol use categories
- trauma <- trauma %>% mutate(
- alcohol.use = case_when(
- is.na(ALCOHOLSCREENRESULT) ~ "Not Screened",
- ALCOHOLSCREENRESULT < 0.02 & total.drugs == 0 ~ "Sober",
- ALCOHOLSCREENRESULT >= 0.02 & ALCOHOLSCREENRESULT < 0.08 & total.drugs == 0 ~ "Impaired",
- ALCOHOLSCREENRESULT >= 0.08 & total.drugs == 0 ~ "Intoxicated",
- ALCOHOLSCREENRESULT >= 0.08 & total.drugs >= 1 ~ "Multi-Drug"
- ) %>%
- factor(levels = c("Not Screened", "Sober", "Impaired", "Intoxicated", "Multi-Drug")) %>%
- ff_label("Alcohol")
- )
- # Refactoring Drug use
- trauma <- trauma %>%
- mutate(
- drug.use = case_when(
- DRGSCR_NONE == 1 & total.drugs < 1 & ALCOHOLSCREENRESULT < 0.02 ~ "None",
- DRGSCR_AMPHETAMINE == 1 & total.drugs == 1 & ALCOHOLSCREENRESULT < 0.02 ~ "Amphetamine",
- DRGSCR_BARBITURATE == 1 & total.drugs == 1 & ALCOHOLSCREENRESULT < 0.02 ~ "Barbiturate",
- DRGSCR_BENZODIAZEPINES == 1 & total.drugs == 1 & ALCOHOLSCREENRESULT < 0.02 ~ "Benzodiazepines",
- DRGSCR_COCAINE == 1 & total.drugs == 1 & ALCOHOLSCREENRESULT < 0.02 ~ "Cocaine",
- DRGSCR_METHAMPHETAMINE == 1 & total.drugs == 1 & ALCOHOLSCREENRESULT < 0.02 ~ "Methamphetamine",
- DRGSCR_ECSTASY == 1 & total.drugs == 1 & ALCOHOLSCREENRESULT < 0.02 ~ "Ecstasy",
- DRGSCR_METHADONE == 1 & total.drugs == 1 & ALCOHOLSCREENRESULT < 0.02 ~ "Methadone",
- DRGSCR_OPIOID == 1 & total.drugs == 1 & ALCOHOLSCREENRESULT < 0.02 ~ "Opioids",
- DRGSCR_OXYCODONE == 1 & total.drugs == 1 & ALCOHOLSCREENRESULT < 0.02 ~ "Oxycodone",
- DRGSCR_PHENCYCLIDINE == 1 & total.drugs == 1 & ALCOHOLSCREENRESULT < 0.02 ~ "Phencyclidine",
- DRGSCR_TRICYCLICDEPRESS == 1 & total.drugs == 1 & ALCOHOLSCREENRESULT < 0.02 ~ "Tricyclic Antidepressants",
- DRGSCR_CANNABINOID == 1 & total.drugs == 1 & ALCOHOLSCREENRESULT < 0.02 ~ "Cannabis",
- DRGSCR_OTHER == 1 & total.drugs == 1 & ALCOHOLSCREENRESULT < 0.02 ~ "Other",
- total.drugs >= 2 & ALCOHOLSCREEN < 0.02 ~ "Multiple Drugs",
- total.drugs >= 1 & ALCOHOLSCREENRESULT >= 0.02 ~ "Drugs and Alcohol",
- TRUE ~ NA_character_ # Add a default value
- ) %>%
- factor(levels = c("None", "Cannabis", "Amphetamine", "Opioids", "Cocaine", "Benzodiazepines", "Methamphetamine", "Oxycodone", "Barbiturate", "Phencyclidine", "Tricyclic Antidepressants", "Methadone", "Ecstasy", "Drugs and Alcohol", "Other")) %>%
- ff_label("Drugs")
- )
- # Refactoring length of hospital stay
- trauma <- trauma %>% mutate(
- FINALDISCHARGEDAYS = FINALDISCHARGEDAYS %>% ff_label("Length of Hospital Stay (days)")
- )
- # Refactoring length of ICU stay
- trauma <- trauma %>% mutate(
- TOTALICULOS = TOTALICULOS %>% ff_label("Length of ICU Stay (days)")
- )
- # Refactoring ISS (injury severity score)
- trauma <- trauma %>% mutate(
- ISS = ISS %>% ff_label("Injury Severity Score")
- )
- trauma <- trauma %>% mutate(
- ISS.factor = ISS %>%
- cut(breaks = c(0,3,8,15,24,75), include.lowest = TRUE, right = TRUE) %>%
- fct_recode(
- "Minor (0-3)" = "[0,3]",
- "Moderate (4-8)" = "(3,8]",
- "Serious (9-15)" = "(8,15]",
- "Severe (16-24)" = "(15,24]",
- "Critical (>25)" = "(24,75]"
- ) %>%
- ff_label("ISS Categories")
- )
- # Refactoring Comorbidities
- trauma <- trauma %>% mutate(
- CC_ALCOHOLISM = CC_ALCOHOLISM %>% ff_label("Alcoholism"),
- CC_SMOKING = CC_SMOKING %>% ff_label("Smoker"),
- CC_SUBSTANCEABUSE = CC_SUBSTANCEABUSE %>% ff_label("Substance Abuse Disorder"),
- CC_CHF = CC_CHF %>% ff_label("Congestive Heart Failure"),
- CC_RENAL = CC_RENAL %>% ff_label("End Stage Renal Disease"),
- CC_DIABETES = CC_DIABETES %>% ff_label("Diabetes"),
- CC_HYPERTENSION = CC_HYPERTENSION %>% ff_label("Hypertension"),
- CC_COPD = CC_COPD %>% ff_label("COPD"),
- CC_BLEEDING = CC_BLEEDING %>% ff_label("Bleeding Disorder"),
- CC_ANTICOAGULANT = CC_ANTICOAGULANT %>% ff_label("Anticoagulant Therapy"),
- CC_CIRRHOSIS = CC_CIRRHOSIS %>% ff_label("Cirrosis"),
- CC_CVA = CC_CVA %>% ff_label("Cerebrovascular Accident"),
- CC_MENTALPERSONALITY = CC_MENTALPERSONALITY %>% ff_label("Mental/Personality Disorder")
- )
- # Refactoring Adverse Events
- trauma <- trauma %>% mutate(
- HC_ALCOHOLWITHDRAWAL = HC_ALCOHOLWITHDRAWAL %>% ff_label("Alcohol Withdrawal Syndrome"),
- HC_CARDARREST = HC_CARDARREST %>% ff_label("Cardiac Arrest"),
- HC_DVTHROMBOSIS = HC_DVTHROMBOSIS %>% ff_label("Deep Vein Thrombosis"),
- HC_EMBOLISM = HC_EMBOLISM %>% ff_label("Pulmonary Embolism"),
- HC_KIDNEY = HC_KIDNEY %>% ff_label("Acute Kidney Injury"),
- HC_RESPIRATORY = HC_RESPIRATORY %>% ff_label("Acute Respiratory Distress Syndrome"),
- HC_SEPSIS = HC_SEPSIS %>% ff_label("Sepsis"),
- HC_STROKECVA = HC_STROKECVA %>% ff_label("Stroke / CVA"),
- HC_VAPNEUMONIA = HC_VAPNEUMONIA %>% ff_label("Hosipital-acquired Pneumonia"),
- HC_INTUBATION = HC_INTUBATION %>% ff_label("Unplanned Intubation"),
- HC_UNPLANNEDICU = HC_UNPLANNEDICU %>% ff_label("Unplanned Admission to ICU"),
- HC_RETURNOR = HC_RETURNOR %>% ff_label("Unplanned Return to OR")
- )
- # Refactoring mortality using pulserate - this is not mortality!
- #trauma <- trauma %>% mutate(
- # mortality.factor = case_when(
- # PULSERATE == 0 ~ "Death",
- # PULSERATE != 0 ~ "Alive"
- # ) %>%
- # factor(levels = c("Death", "Alive")) %>%
- # ff_label("Mortality")
- #)
- # Correctly refactoring mortality using ED and Hospital discharge disposition
- alive_dispositions <- c(1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14)
- trauma <- trauma %>% mutate(
- mortality.total = case_when(
- EDDISCHARGEDISPOSITION == 5 | HOSPDISCHARGEDISPOSITION == 5 ~ "Deceased",
- EDDISCHARGEDISPOSITION %in% alive_dispositions | HOSPDISCHARGEDISPOSITION %in% alive_dispositions ~ "Alive"
- ) %>%
- factor(levels = c("Deceased", "Alive")) %>%
- ff_label("Total Mortality")
- )
- trauma <- trauma %>% mutate(
- mortality.ED = case_when(
- EDDISCHARGEDISPOSITION == 5 ~ "Deceased",
- EDDISCHARGEDISPOSITION %in% alive_dispositions ~ "Alive"
- ) %>%
- factor(levels = c("Deceased", "Alive")) %>%
- ff_label("ED Mortality")
- )
- trauma <- trauma %>% mutate(
- mortality.hospital = case_when(
- HOSPDISCHARGEDISPOSITION == 5 ~ "Deceased",
- HOSPDISCHARGEDISPOSITION %in% alive_dispositions ~ "Alive"
- ) %>%
- factor(levels = c("Deceased", "Alive")) %>%
- ff_label("Hospital Mortality")
- )
- # Refactoring alcohol withdrawal syndrome
- trauma <- trauma %>% mutate(
- alc.withdraw.factor = HC_ALCOHOLWITHDRAWAL %>%
- factor() %>%
- fct_recode("Positive" = "1", "None" = "0") %>%
- ff_label("Alcohol Withdrawal Syndrome")
- )
- # Refactoring Year
- trauma <- trauma %>% mutate(
- year.factor = Year %>%
- factor() %>%
- ff_label("Year")
- )
- ```
- ```{r}
- # Merging with annotated injury codes and place of injury codes
- inj_cause <- read_xlsx("tables/injury_cause_counts_with_descriptions.xlsx")
- inj_cause$counts <- NULL
- inj_place <- read_xlsx("tables/injury_place_counts_with_descriptions.xlsx")
- inj_place$counts <- NULL
- trauma <- merge(trauma, y = inj_cause, on = "PRIMARYECODEICD10")
- #trauma <- merge(trauma, y = inj_place, on = "PLACEOFINJURYCODE")
- ```
- ## 1.3 Filtering for NAs in important variables
- ```{r}
- # Filtering for NAs in selected columns
- trauma_filt <- trauma %>% filter_at(vars(sex.factor, age.factor, race.factor, ethnicity.factor, helmet.factor), all_vars(!is.na(.)))
- #initial filter included: sex.factor, age.factor, race.factor, ethnicity.factor, helmet.factor, SBP, sbp.hypo, TOTALGCS, FINALDISCHARGEDAYS, ISS, ISS.factor, CC_ALCOHOLISM, CC_SMOKING, CC_SUBSTANCEABUSE, CC_CHF, CC_RENAL, CC_DIABETES, CC_HYPERTENSION, CC_COPD, alc.withdraw.factor, mortality.factor
- # Seeing the total number of BAC screens for people with and without other drug use
- bac_screens <- trauma_filt %>% mutate(
- alcohol.use.total = case_when(
- is.na(ALCOHOLSCREENRESULT) ~ "Not Screened",
- ALCOHOLSCREENRESULT < 0.02 ~ "Sober",
- ALCOHOLSCREENRESULT >= 0.02 & ALCOHOLSCREENRESULT < 0.08 ~ "Impaired",
- ALCOHOLSCREENRESULT >= 0.08 ~ "Intoxicated"
- ),
- alcohol.use.clean = case_when(
- is.na(ALCOHOLSCREENRESULT) ~ "Not Screened",
- ALCOHOLSCREENRESULT < 0.02 & total.drugs == 0 ~ "Sober",
- ALCOHOLSCREENRESULT >= 0.02 & ALCOHOLSCREENRESULT < 0.08 & total.drugs == 0 ~ "Impaired",
- ALCOHOLSCREENRESULT >= 0.08 & total.drugs == 0 ~ "Intoxicated",
- ALCOHOLSCREENRESULT >= 0.08 & total.drugs >= 0 ~ "Multi-Drug"
- )
- )
- bac_screens_total <- sum(!is.na(bac_screens$alcohol.use.total))
- bac_screens_clean <- sum(!is.na(bac_screens$alcohol.use.clean))
- print(paste0("Number of total BAC screens in patients with known info: ", bac_screens_total))
- print(paste0("Number of filtered alcohol/multi-drug BAC screens in patients with known info: ", bac_screens_clean))
- # Filtering for only patients with BAC screens with NO other drug use (clean)
- keys_to_keep <- bac_screens[!is.na(bac_screens$alcohol.use.clean), ] %>% pull(INC_KEY)
- trauma_filt <- trauma_filt %>% filter(INC_KEY %in% keys_to_keep)
- ```
- ```{r}
- # Optional export to excel
- #write_xlsx(trauma_filt, path = paste0(cwd, "/TQP_Processed/trauma_filtered.xlsx"))
- ```
- # 2. Demographics table for alcohol use
- ```{r}
- # Table on helmet use
- # Explanatory & confounding variables
- explanatory <- c("alcohol.use", "motor_vehicle", "sex.factor", "age.factor", "race.factor", "ethnicity.factor")
- # Dependent variable of interest
- dependent <- "helmet.factor"
- table1 <- trauma_filt %>%
- summary_factorlist(dependent, explanatory,
- cont = "median", p_cont_para = "kruskal.test", p_cat = "chisq", p = TRUE,
- add_col_totals = TRUE,
- na_include = TRUE)
- # Optional export to excel
- #write_xlsx(x = table1, path = "tables/table1_demographics.xlsx")
- ```
- ```{r}
- # Table on alcohol use groups
- # Explanatory & confounding variables
- explanatory <- c("helmet.factor", "motor_vehicle", "sex.factor", "age.factor", "race.factor", "ethnicity.factor")
- # Dependent variable of interest
- dependent <- "alcohol.use"
- table1.1 <- trauma_filt %>%
- summary_factorlist(dependent, explanatory,
- cont = "median", p_cont_para = "kruskal.test", p_cat = "chisq", p = TRUE,
- add_col_totals = TRUE,
- na_include = TRUE)
- ```
- ```{r}
- # Pairwise comparison stats with row wise fisher's exact test for Alcohol use
- rwf1 <- table(trauma_filt$alcohol.use, trauma_filt$helmet.factor) %>% as.data.frame.matrix()
- rwf1 <- rwf1[ , c(2,1)]
- pairwiseNominalMatrix(x = table(trauma_filt$alcohol.use, trauma_filt$helmet.factor), compare = "row", fisher = TRUE, chisq = FALSE)
- rwf2 <- pairwise_fisher_test(rwf1, p.adjust.method = "fdr", detailed = TRUE)
- chisq.test(rwf1)
- ```
- ```{r}
- # Pairwise comparison stats with row wise fisher's exact test for motor vehicle involvement
- rwf1 <- table(trauma_filt$motor_vehicle, trauma_filt$helmet.factor) %>% as.data.frame.matrix()
- rwf1 <- rwf1[ , c(2,1)]
- pairwiseNominalMatrix(x = table(trauma_filt$motor_vehicle, trauma_filt$helmet.factor), compare = "column", fisher = TRUE, chisq = FALSE)
- rwf2 <- row_wise_fisher_test(rwf1, p.adjust.method = "fdr", detailed = TRUE)
- chisq.test(rwf1)
- ```
- ```{r}
- # Pairwise comparison stats with row wise fisher's exact test for motor vehicle involvement
- rwf1 <- table(trauma_filt$alcohol.use, trauma_filt$motor_vehicle) %>% as.data.frame.matrix()
- rwf1$unspecified <- NULL
- rwf1 <- rwf1[ , c(2,1)]
- rwf2 <- row_wise_fisher_test(rwf1, p.adjust.method = "fdr", detailed = TRUE)
- rwf3 <- pairwise_fisher_test(rwf1, p.adjust.method = "fdr", detailed = TRUE)
- chisq.test(rwf1)
- ```
- ```{r}
- # Pairwise wilcox test on age
- pairwise.wilcox.test(trauma_filt$AGEYEARS, trauma_filt$alcohol.use, p.adjust.method = "fdr")
- chisq.test(table(trauma_filt$age.factor, trauma_filt$helmet.factor))
- ```
- ```{r}
- # Pairwise comparison stats with sex
- rwf1 <- table(trauma_filt$sex.factor, trauma_filt$helmet.factor) %>% as.data.frame.matrix()
- rwf1 <- rwf1[ , c(2,1)]
- rwf2 <- pairwise_fisher_test(rwf1, p.adjust.method = "fdr", detailed = TRUE)
- chisq.test(rwf1)
- ```
- ```{r}
- # Pairwise comparison stats with race
- rwf1 <- table(trauma_filt$race.factor, trauma_filt$helmet.factor) %>% as.data.frame.matrix()
- rwf1 <- rwf1[ , c(2,1)]
- rwf2 <- pairwise_fisher_test(rwf1, p.adjust.method = "fdr", detailed = TRUE)
- chisq.test(rwf1)
- ```
- ```{r}
- # Pairwise comparison stats with ethnicity
- rwf1 <- table(trauma_filt$ethnicity.factor, trauma_filt$helmet.factor) %>% as.data.frame.matrix()
- rwf1 <- rwf1[ , c(2,1)]
- rwf2 <- pairwise_fisher_test(rwf1, p.adjust.method = "fdr", detailed = TRUE)
- chisq.test(rwf1)
- ```
- # 3. Clinical presentation and alcohol use groups
- ```{r}
- # Explanatory & confounding variables
- explanatory <- c("mortality.total", "mortality.ED", "mortality.hospital", "FINALDISCHARGEDAYS", "TOTALICULOS", "ISS", "ISS.factor", "TOTALGCS", "SBP", "sbp.hypo", "HC_ALCOHOLWITHDRAWAL", "HC_CARDARREST", "HC_DVTHROMBOSIS", "HC_EMBOLISM", "HC_KIDNEY", "HC_RESPIRATORY", "HC_SEPSIS", "HC_STROKECVA", "HC_VAPNEUMONIA", "HC_INTUBATION", "HC_UNPLANNEDICU", "HC_RETURNOR")
- # Dependent variable of interest
- dependent <- "alcohol.use" #helmet.factor
- table2 <- trauma_filt %>%
- summary_factorlist(dependent, explanatory,
- cont = "median", p_cont_para = "kruskal.test", p_cat = "chisq", p = TRUE,
- add_row_totals = FALSE,
- na_include = TRUE)
- # Optional export to excel
- #write_csv(x = table2, path = paste0(cwd, "/tables/table2_clinical_presentation.csv"))
- ```
- ```{r}
- # Explanatory & confounding variables
- explanatory <- c("mortality.total", "mortality.ED", "mortality.hospital", "FINALDISCHARGEDAYS", "TOTALICULOS", "ISS", "ISS.factor", "TOTALGCS", "SBP", "sbp.hypo", "HC_ALCOHOLWITHDRAWAL", "HC_CARDARREST", "HC_DVTHROMBOSIS", "HC_EMBOLISM", "HC_KIDNEY", "HC_RESPIRATORY", "HC_SEPSIS", "HC_STROKECVA", "HC_VAPNEUMONIA", "HC_INTUBATION", "HC_UNPLANNEDICU", "HC_RETURNOR")
- # Dependent variable of interest
- dependent <- "helmet.factor" #helmet.factor or alcohol.use
- table2.1 <- trauma_filt %>%
- summary_factorlist(dependent, explanatory,
- cont = "median", p_cont_para = "kruskal.test", p_cat = "chisq", p = TRUE,
- add_col_totals = TRUE,
- na_include = TRUE)
- # Optional export to excel
- #write_xlsx(x = table2.1, path = "tables/table2_clinical_presentation.xlsx")
- ```
- ```{r}
- # Mortality rates in helmet groups
- # Total mortality
- rwf1 <- table(trauma_filt$mortality.total, trauma_filt$helmet.factor)
- rwf1 <- rwf1[ , c(2,1)]
- fisher.test(rwf1)
- # ED mortality
- rwf1 <- table(trauma_filt$mortality.ED, trauma_filt$helmet.factor)
- rwf1 <- rwf1[ , c(2,1)]
- fisher.test(rwf1)
- # Hospital mortality
- rwf1 <- table(trauma_filt$mortality.hospital, trauma_filt$helmet.factor)
- rwf1 <- rwf1[ , c(2,1)]
- fisher.test(rwf1)
- ```
- ```{r}
- # Length of hospital stay
- wilcox.test(x = trauma_filt$FINALDISCHARGEDAYS, g = trauma_filt$helmet.factor)
- med_hosp_stay1 <- trauma_filt %>% dplyr::filter(helmet.factor == "Helmet")
- med_hosp_stay1 <- mean(med_hosp_stay1$FINALDISCHARGEDAYS, na.rm = TRUE)
- med_hosp_stay2 <- trauma_filt %>% dplyr::filter(helmet.factor == "No Helmet")
- med_hosp_stay2 <- mean(med_hosp_stay2$FINALDISCHARGEDAYS, na.rm = TRUE)
- print(paste0("Mean of Helmeted hospital stay: ", med_hosp_stay1, ". Mean of Non-helmeted hospital stay: ", med_hosp_stay2))
- # Length of ICU stay
- wilcox.test(x = trauma_filt$TOTALICULOS, g = trauma_filt$helmet.factor)
- med_hosp_stay1 <- trauma_filt %>% dplyr::filter(helmet.factor == "Helmet")
- med_hosp_stay1 <- mean(med_hosp_stay1$TOTALICULOS, na.rm = TRUE)
- med_hosp_stay2 <- trauma_filt %>% dplyr::filter(helmet.factor == "No Helmet")
- med_hosp_stay2 <- mean(med_hosp_stay2$TOTALICULOS, na.rm = TRUE)
- print(paste0("Mean of Helmeted hospital stay: ", med_hosp_stay1, ". Mean of Non-helmeted hospital stay: ", med_hosp_stay2))
- ```
- ```{r}
- # ISS
- wilcox.test(x = trauma_filt$ISS, g = trauma_filt$helmet.factor)
- iss_score1 <- trauma_filt %>% dplyr::filter(helmet.factor == "Helmet")
- iss_score1 <- mean(iss_score1$ISS, na.rm = TRUE)
- iss_score2 <- trauma_filt %>% dplyr::filter(helmet.factor == "No Helmet")
- iss_score2 <- mean(iss_score2$ISS, na.rm = TRUE)
- print(paste0("Mean of Helmeted ISS: ", iss_score1, ". Mean of Non-helmeted ISS: ", iss_score2))
- # Pairwise fisher test for ISS categories
- rwf1 <- table(trauma_filt$ISS.factor, trauma_filt$helmet.factor)
- rwf1 <- rwf1[, c(2,1)]
- rwf2 <- row_wise_fisher_test(xtab = rwf1, p.adjust.method = "fdr", detailed = TRUE)
- ```
- ```{r}
- # Total glasgow coma scale
- wilcox.test(TOTALGCS ~ helmet.factor, data = trauma_filt)
- ```
- ```{r}
- # Clinical outcomes
- clin_out <- function(tab, outcome, flip = FALSE) {
- if (flip == TRUE) {
- tab <- tab[, c(2,1)]
- }
- fish <- fisher.test(tab)
- print(outcome)
- df <- data.frame("clinical_outcome" = outcome, "p_value" = fish$p.value, "OR" = fish$estimate, "conf_low" = fish$conf.int[1], "conf_high" = fish$conf.int[2])
- rownames(df) <- NULL
- return(df)
- }
- # hypotensive - change to tab switch
- c1 <- clin_out(tab = table(trauma_filt$sbp.hypo, trauma_filt$helmet.factor), outcome = "Hypotensive", flip = TRUE)
- # alcohol withdrawal syndrome
- c2 <- clin_out(tab = table(trauma_filt$alc.withdraw.factor, trauma_filt$helmet.factor), outcome = "Alcohol Withdrawal Sydrome")
- # cardiac arrest
- c3 <- clin_out(tab = table(trauma_filt$HC_CARDARREST, trauma_filt$helmet.factor), outcome = "Cardiac Arrest")
- # DVT
- c4 <- clin_out(tab = table(trauma_filt$HC_DVTHROMBOSIS, trauma_filt$helmet.factor), outcome = "DVT")
- # Pulmonary embolism
- c5 <- clin_out(tab = table(trauma_filt$HC_EMBOLISM, trauma_filt$helmet.factor), outcome = "Pulmonary Embolism")
- # AKI
- c6 <- clin_out(tab = table(trauma_filt$HC_KIDNEY, trauma_filt$helmet.factor), outcome = "Acute Kidney Injury")
- # ARDS
- c7 <- clin_out(tab = table(trauma_filt$HC_RESPIRATORY, trauma_filt$helmet.factor), outcome = "Acute Respiratory Distress Syndrome")
- # Sepsis
- c8 <- clin_out(tab = table(trauma_filt$HC_SEPSIS, trauma_filt$helmet.factor), outcome = "Sepsis")
- # Stroke / CVA
- c9 <- clin_out(tab = table(trauma_filt$HC_STROKECVA, trauma_filt$helmet.factor), outcome = "Stroke / CVA")
- # Hospital-aquired pneumonia
- c10 <- clin_out(tab = table(trauma_filt$HC_VAPNEUMONIA, trauma_filt$helmet.factor), outcome = "Hospital-aquired pneumonia")
- # Unplanned intubation
- c11 <- clin_out(tab = table(trauma_filt$HC_INTUBATION, trauma_filt$helmet.factor), outcome = "Unplanned Intubation")
- # Unplanned admission to ICU
- c12 <- clin_out(tab = table(trauma_filt$HC_UNPLANNEDICU, trauma_filt$helmet.factor), outcome = "Unplanned admission to ICU")
- # Unplanned return to OR
- c13 <- clin_out(tab = table(trauma_filt$HC_RETURNOR, trauma_filt$helmet.factor), outcome = "Unplanned admission to OR")
- # Merging
- c <- dplyr::bind_rows(list(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13))
- c$OR_CI <- paste0(round(c$OR, 2), " [", round(c$conf_low, 2), "-", round(c$conf_high, 2), "]")
- # Exporting to excel
- #write_xlsx(x = c, path = "tables/adverse_outcomes_fisher.xlsx")
- ```
- ```{r}
- # Sytolic blood pressure (continuous)
- wilcox.test(x = trauma_filt$SBP, g = trauma_filt$helmet.factor)
- ```
- # 4. Comorbidities and alcohol use groups
- ```{r}
- # Explanatory & confounding variables
- explanatory <- c("CC_ALCOHOLISM", "CC_SMOKING", "CC_SUBSTANCEABUSE", "CC_MENTALPERSONALITY", "CC_CHF", "CC_RENAL", "CC_DIABETES", "CC_HYPERTENSION", "CC_COPD", "CC_BLEEDING", "CC_ANTICOAGULANT", "CC_CIRRHOSIS", "CC_CVA")
- # Dependent variable of interest
- dependent <- "alcohol.use" #helmet.factor or alcohol.use
- table3 <- trauma_filt %>%
- summary_factorlist(dependent, explanatory,
- cont = "median", p_cont_para = "kruskal.test", p_cat = "chisq", p = TRUE,
- add_row_totals = FALSE,
- na_include = TRUE)
- # Optional export to excel
- #write_xlsx(x = table3, path = "tables/table3_comorbidities.xlsx")
- ```
- ```{r}
- # Explanatory & confounding variables
- explanatory <- c("CC_ALCOHOLISM", "CC_SMOKING", "CC_SUBSTANCEABUSE", "CC_MENTALPERSONALITY", "CC_CHF", "CC_RENAL", "CC_DIABETES", "CC_HYPERTENSION", "CC_COPD", "CC_BLEEDING", "CC_ANTICOAGULANT", "CC_CIRRHOSIS", "CC_CVA")
- # Dependent variable of interest
- dependent <- "helmet.factor" #helmet.factor or alcohol.use
- table3.1 <- trauma_filt %>%
- summary_factorlist(dependent, explanatory,
- cont = "median", p_cont_para = "kruskal.test", p_cat = "chisq", p = TRUE,
- add_col_totals = TRUE,
- na_include = TRUE)
- # Optional export to excel
- #write_xlsx(x = table3.1, path = "tables/table3_comorbidities.xlsx")
- ```
- ```{r}
- # Comorbidities fishers
- # alcohol withdrawal syndrome
- d1 <- clin_out(tab = table(trauma_filt$CC_ALCOHOLISM, trauma_filt$helmet.factor), outcome = "Alcohol Use Disorder")
- # smoking
- d2 <- clin_out(tab = table(trauma_filt$CC_SMOKING, trauma_filt$helmet.factor), outcome = "Tobacco Use Disorder")
- # substance use
- d3 <- clin_out(tab = table(trauma_filt$CC_SUBSTANCEABUSE, trauma_filt$helmet.factor), outcome = "Substance Use Disorder")
- # mental/personality disorder
- d4 <- clin_out(tab = table(trauma_filt$CC_MENTALPERSONALITY, trauma_filt$helmet.factor), outcome = "Mental/Personality Disorder")
- # congestive heart failure
- d5 <- clin_out(tab = table(trauma_filt$CC_CHF, trauma_filt$helmet.factor), outcome = "Congestive heart failure")
- # end stage renal disease
- d6 <- clin_out(tab = table(trauma_filt$CC_RENAL, trauma_filt$helmet.factor), outcome = "End stage renal disease")
- # diabetes
- d7 <- clin_out(tab = table(trauma_filt$CC_DIABETES, trauma_filt$helmet.factor), outcome = "Diabetes")
- # hypertension
- d8 <- clin_out(tab = table(trauma_filt$CC_HYPERTENSION, trauma_filt$helmet.factor), outcome = "Hypertension")
- # COPD
- d9 <- clin_out(tab = table(trauma_filt$CC_COPD, trauma_filt$helmet.factor), outcome = "COPD")
- # bleeding disorder
- d10 <- clin_out(tab = table(trauma_filt$CC_BLEEDING, trauma_filt$helmet.factor), outcome = "Bleeding disorder")
- # anticoagulant therapy
- d11 <- clin_out(tab = table(trauma_filt$CC_ANTICOAGULANT, trauma_filt$helmet.factor), outcome = "Anticoagulant therapy")
- # Cirrhosis
- d12 <- clin_out(tab = table(trauma_filt$CC_CIRRHOSIS, trauma_filt$helmet.factor), outcome = "Cirrhosis")
- # Cerebrovascular attack
- d13 <- clin_out(tab = table(trauma_filt$CC_CVA, trauma_filt$helmet.factor), outcome = "Cerebrovascular attack")
- # Merging
- d <- dplyr::bind_rows(list(d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13))
- d$OR_CI <- paste0(round(d$OR, 2), " [", round(d$conf_low, 2), "-", round(d$conf_high, 2), "]")
- # Exporting to excel
- #write_xlsx(x = d, path = "tables/comorbidities_fisher.xlsx")
- ```
- # 5. Bargraph of helmet usage
- ## 5.1 Helmet usage
- ```{r}
- # Data wrangling
- helmet_bar_df <- as.data.frame.matrix(table(trauma_filt$alcohol.use, trauma_filt$helmet.factor))
- helmet_bar_df <- tibble::rownames_to_column(helmet_bar_df, var = "alcohol")
- helmet_bar_df$alcohol <- factor(helmet_bar_df$alcohol, levels = c("Not Screened", "Sober", "Impaired", "Intoxicated", "Multi-Drug"))
- helmet_bar_df$percent <- (helmet_bar_df$Helmet / (helmet_bar_df$Helmet + helmet_bar_df$`No Helmet`)) * 100
- helmet_bar_df$percent <- round(helmet_bar_df$percent, digits = 1)
- # Barplot
- helmet_bar_plot <- helmet_bar_df %>% ggplot(aes(x = alcohol, y = percent, fill = alcohol, color = "black")) +
- geom_bar(stat = "identity") +
- geom_text(aes(label = percent), vjust = -0.5, size = 4) +
- scale_y_continuous(limits = c(0, 50), expand = c(0,0)) +
- scale_fill_manual(values = c("black", "#84888e", "#89C5D3", "#FEDBB2", "#E8ACBD")) +
- scale_color_manual(values = "black") +
- labs(x = "BAC Intoxication Status", y = "Percent Wearing a Helmet (%)", title = "Helmet Usage") +
- theme_classic() +
- theme(plot.title = element_text(hjust = 0.5, size = 16),
- axis.title = element_text(size = 14),
- axis.text.x = element_text(size = 12, angle = 45, hjust = 1),
- axis.text.y = element_text(size = 12),
- legend.position = "none")
- print(helmet_bar_plot)
- # Optional Save
- #ggsave(plot = helmet_bar_plot, filename = "figures/helmet_use_barplot.pdf", width = 1400, height = 1500, dpi = 300, units = "px")
- ```
- ## 5.2 Motor vehicle involvement
- ```{r}
- # Data wrangling
- helmet_bar_df <- as.data.frame.matrix(table(trauma_filt$alcohol.use, trauma_filt$motor_vehicle))
- helmet_bar_df <- tibble::rownames_to_column(helmet_bar_df, var = "alcohol")
- helmet_bar_df$alcohol <- factor(helmet_bar_df$alcohol, levels = c("Not Screened", "Sober", "Impaired", "Intoxicated", "Multi-Drug"))
- helmet_bar_df$percent <- (helmet_bar_df$yes / (helmet_bar_df$no + helmet_bar_df$unspecified + helmet_bar_df$yes)) * 100
- helmet_bar_df$percent <- round(helmet_bar_df$percent, digits = 1)
- # Barplot
- helmet_bar_plot <- helmet_bar_df %>% ggplot(aes(x = alcohol, y = percent, fill = alcohol, color = "black")) +
- geom_bar(stat = "identity") +
- geom_text(aes(label = percent), vjust = -0.5, size = 4) +
- scale_y_continuous(limits = c(0, 55), expand = c(0,0)) +
- scale_fill_manual(values = c("black", "#84888e", "#89C5D3", "#FEDBB2", "#E8ACBD")) +
- scale_color_manual(values = "black") +
- labs(x = "BAC Intoxication Status", y = "Percent Wearing a Helmet (%)", title = "Helmet Usage") +
- theme_classic() +
- theme(plot.title = element_text(hjust = 0.5, size = 16),
- axis.title = element_text(size = 14),
- axis.text.x = element_text(size = 12, angle = 45, hjust = 1),
- axis.text.y = element_text(size = 12),
- legend.position = "none")
- print(helmet_bar_plot)
- # Optional Save
- #ggsave(plot = helmet_bar_plot, filename = "figures/motor_vehicle_barplot.png", width = 1400, height = 1500, dpi = 300, units = "px")
- ```
- # 6. Dumbbell plot for comorbidities - start here
- ```{r}
- # Function to create a comorbidity dataframe for graphing in ggplot
- create_comor_df <- function(comorbid_values, comorbidity_title) {
- comor_df <- ftable(trauma_filt$alcohol.use, comorbid_values, trauma_filt$helmet.factor)
- comor_df <- data.frame(expand.grid(rev(attr(comor_df, "row.vars"))), unclass(comor_df))
- comor_df$percent <- (comor_df$X1 / (comor_df$X1 + comor_df$X2)) * 100
- colnames(comor_df) <- c("comorbidity", "alcohol", "helmet", "no_helmet", "percent")
- comor_df$comorbidity <- plyr::mapvalues(x = comor_df$comorbidity, from = c(0, 1), to = c("no", "yes"))
- comor_df$comorbidity <- factor(x = comor_df$comorbidity, levels = c("yes", "no"))
- comor_df$alcohol <- factor(x = comor_df$alcohol, levels = c("Not Screened", "Multi-Drug", "Intoxicated", "Impaired", "Sober"))
- comor_df$comorbidity_name <- comorbidity_title
- return(comor_df)
- }
- ```
- ```{r}
- # Calculating population counts for each comorbidity x alcohol intoxication status x helmet use group to find the interaction between addictive comorbidities and alcohol consumption in helmet use rates
- comor_alc <- create_comor_df(comorbid_values = trauma_filt$CC_ALCOHOLISM, comorbidity_title = "Alcoholism")
- comor_smo <- create_comor_df(comorbid_values = trauma_filt$CC_SMOKING, comorbidity_title = "Smoking")
- comor_sub <- create_comor_df(comorbid_values = trauma_filt$CC_SUBSTANCEABUSE, comorbidity_title = "Substance Abuse Disorder")
- #comor_men <- create_comor_df(comorbid_values = trauma_filt$CC_MENTALPERSONALITY, comorbidity_title = "Mental/Personality Disorder")
- comor_df <- dplyr::bind_rows(comor_alc, comor_smo, comor_sub) #comor_men
- comor_df$comorbidity_name <- plyr::mapvalues(x = comor_df$comorbidity_name, from = c("Alcoholism", "Smoking", "Substance Abuse Disorder"), to = c("Alcohol Use Disorder", "Tobacco Use Disorder", "Substance Use Disorder"))
- comor_df$comorbidity_name <- factor(comor_df$comorbidity_name, levels = c("Alcohol Use Disorder", "Tobacco Use Disorder", "Substance Use Disorder"))
- comor_df$alcohol <- factor(comor_df$alcohol, levels = rev(c("Not Screened", "Sober", "Impaired", "Intoxicated", "Multi-Drug")))
- # Dumbbell Plot
- comor_dumb_plot <- comor_df %>% ggplot(aes(x = alcohol, y = percent)) +
- geom_line() +
- geom_point(aes(color = comorbidity), size = 3) +
- facet_grid(cols = vars(comorbidity_name)) +
- scale_x_discrete(limits = rev) +
- scale_color_manual(values = c("#e41a1c", "#367db7")) +
- labs(x = "BAC Status", y = "Percent Helmet Wearing (%)", title = "Comorbidities in Alcohol Screening Groups", color = "Comorbidity") +
- theme_bw() +
- theme(plot.title = element_text(hjust = 0.5, size = 16),
- axis.title = element_text(size = 14),
- axis.text.x = element_text(size = 10, angle = 45, hjust = 1),
- axis.text.y = element_text(size = 10),
- strip.background = element_blank(),
- strip.text = element_text(size = 12))
- comor_dumb_plot
- # Optional Save
- #ggsave(plot = comor_dumb_plot, filename = "figures/comorbidities_dumbbell.pdf", width = 3000, height = 1500, dpi = 300, units = "px")
- ```
- ```{r}
- # Additional Plot for dumbbell
- rate_decline_plot <- comor_df %>% ggplot(aes(x = alcohol, y = percent, group = comorbidity_status, color = comorbidity_status)) +
- geom_line() +
- geom_point(size = 2) +
- scale_x_discrete(limits = rev) +
- scale_color_manual(values = c("#3fe1cf", "#367db7", "#0080ff", "#010080", "#fe0903", "#b90e0d", "#e1105d", "#800000")) +
- labs(x = "Intoxication Status", y = "Percent Helmet Wearing (%)", title = "Comorbidities in Alcohol Screening Groups", color = "Comorbidity") +
- theme_bw() +
- theme(plot.title = element_text(hjust = 0.5, size = 16),
- axis.title = element_text(size = 14),
- axis.text.x = element_text(size = 10),
- axis.text.y = element_text(size = 10))
- rate_decline_plot
- # Optional Save
- #ggsave(plot = rate_decline_plot, filename = paste0(cwd, "/figures/rate_decline_plot.pdf"), width = 2200, height = 1500, dpi = 300, units = "px")
- ```
- ## 6.1 Statistics for dumbell plot - GLM
- ```{r}
- comor_stats_df <- trauma_filt %>% dplyr::select(ALCOHOLSCREENRESULT, alcohol.use, CC_ALCOHOLISM, CC_SMOKING, CC_SUBSTANCEABUSE, CC_MENTALPERSONALITY, helmet.factor)
- comor_stats_df$alcohol.use <- dplyr::recode(comor_stats_df$alcohol.use, "Not Screened" = 0, "Sober" = 1, "Impaired" = 2, "Intoxicated" = 3, "Multi-Drug" = 4)
- comor_stats_df$helmet.factor <- dplyr::recode(comor_stats_df$helmet.factor, "Helmet" = 0, "No Helmet" = 1)
- # Complete model with all interacting comorbidities
- cc_alc_val_glm <- glm(helmet.factor ~ alcohol.use + CC_ALCOHOLISM + CC_SMOKING + CC_SUBSTANCEABUSE, family = binomial(), data = comor_stats_df)
- summary(cc_alc_val_glm)
- print(exp(coef(cc_alc_val_glm)))
- cc_alc_val_glm <- glm(helmet.factor ~ alcohol.use * (CC_ALCOHOLISM + CC_SMOKING + CC_SUBSTANCEABUSE), family = binomial(), data = comor_stats_df)
- summary(cc_alc_val_glm)
- print(exp(coef(cc_alc_val_glm)))
- # GLM alcoholism + alcohol use
- cc_alc_glm <- glm(helmet.factor ~ alcohol.use * CC_ALCOHOLISM, family = binomial, data = comor_stats_df)
- summary(cc_alc_glm)
- print(exp(coef(cc_alc_glm)))
- # GLM smoking + alcohol use
- cc_smo_glm <- glm(helmet.factor ~ alcohol.use * CC_SMOKING, family = binomial, data = comor_stats_df)
- summary(cc_smo_glm)
- print(exp(coef(cc_smo_glm)))
- # GLM substance use disorder + alcohol use
- cc_sud_glm <- glm(helmet.factor ~ alcohol.use * CC_SUBSTANCEABUSE, family = binomial, data = comor_stats_df)
- summary(cc_sud_glm)
- print(exp(coef(cc_sud_glm)))
- ```
- ```{r}
- # Modeling model correctness with DHARMa
- simulationOutput <- simulateResiduals(fittedModel = cc_alc_val_glm)
- plot(simulationOutput)
- #simulationOutput <- simulateResiduals(fittedModel = cc_alc_glm)
- #plot(simulationOutput)
- #simulationOutput <- simulateResiduals(fittedModel = cc_smo_glm)
- #plot(simulationOutput)
- #simulationOutput <- simulateResiduals(fittedModel = cc_sud_glm)
- #plot(simulationOutput)
- #simulationOutput <- simulateResiduals(fittedModel = cc_mpd_glm)
- #plot(simulationOutput)
- ```
- # 7. Logistic Regression Analysis
- ```{r}
- # Cleaning the trauma df for logistic regression
- trauma_filt_lr <- trauma_filt %>%
- select(sex.factor, AGEYEARS, age.factor, race.factor, ethnicity.factor, ALCOHOLSCREENRESULT, alcohol.use, helmet.factor, motor_vehicle,
- CC_ALCOHOLISM, CC_SMOKING, CC_SUBSTANCEABUSE) %>%
- mutate(
- sex.factor = sex.factor %>% factor(levels = c("Female", "Male")) %>% ff_label("Sex"),
- ethnicity.factor = ethnicity.factor %>% factor(levels = c("Not Hispanic", "Hispanic")) %>% ff_label("Ethnicity"),
- CC_ALCOHOLISM = CC_ALCOHOLISM %>% factor() %>% fct_recode("Negative" = "0", "Positive" = "1") %>% ff_label("Alcohol Use Disorder"),
- CC_SMOKING = CC_SMOKING %>% factor() %>% fct_recode("Negative" = "0", "Positive" = "1") %>% ff_label("Tobacco Use Disorder"),
- CC_SUBSTANCEABUSE = CC_SUBSTANCEABUSE %>% factor() %>% fct_recode("Negative" = "0", "Positive" = "1") %>% ff_label("Substance Use Disorder"),
- AGEYEARS = AGEYEARS %>% ff_label("Age (years)")
- )
- # Performing Logistic Regression and testing different variables in the model of predicting risk factors of helmet wearing
- dependent <- "helmet.factor"
- explanatory <- c("AGEYEARS", "sex.factor", "race.factor", "ethnicity.factor", "alcohol.use", "motor_vehicle",
- "CC_ALCOHOLISM", "CC_SMOKING", "CC_SUBSTANCEABUSE")
- explanatory_multi <- c("AGEYEARS", "race.factor", "ethnicity.factor", "alcohol.use",
- "CC_ALCOHOLISM", "CC_SMOKING", "CC_SUBSTANCEABUSE")
- logistic_fit <- trauma_filt_lr %>%
- finalfit(dependent, explanatory, explanatory_multi, keep_models = TRUE, metrics = TRUE)
- logistic_fit1 <- logistic_fit[[1]] %>% as.data.frame()
- logistic_fit2 <- logistic_fit[[2]] %>% as.character()
- print(logistic_fit2)
- ```
- ```{r}
- # Final logisitic regression to export
- dependent <- "helmet.factor"
- explanatory <- c("AGEYEARS", "sex.factor", "race.factor", "ethnicity.factor", "alcohol.use", "motor_vehicle",
- "CC_ALCOHOLISM", "CC_SMOKING", "CC_SUBSTANCEABUSE")
- logistic_fit <- trauma_filt_lr %>%
- finalfit(dependent, explanatory, metrics = TRUE)
- logistic_fit1 <- logistic_fit[[1]] %>% as.data.frame()
- logistic_fit2 <- logistic_fit[[2]] %>% as.character()
- print(logistic_fit2)
- # Exporting to excel
- #write_xlsx(x = logistic_fit1, path = "tables/table5_logistic_regression.xlsx")
- ```
- ```{r}
- # Odds ratio Plot
- dependent <- "helmet.factor"
- explanatory <- c("AGEYEARS", "sex.factor", "race.factor", "ethnicity.factor", "alcohol.use", "motor_vehicle",
- "CC_ALCOHOLISM", "CC_SMOKING", "CC_SUBSTANCEABUSE")
- # Exporting a Odds ratio plot
- #pdf(file = "figures/logistic_regression_odds_ratio_plot.pdf", height = 6, width = 9)
- trauma_filt_lr %>%
- or_plot(dependent, explanatory,
- remove_ref = TRUE,
- breaks = c(0, 1, 2, 3, 4, 5, 6, 7, 8),
- table_text_size = 3.5,
- title_text_size = 16)
- #dev.off()
- ```
- # 8. Supplemental Data
- ## 8.1 Yearly plot to get time-data for COVID
- ```{r}
- # Function for plotting graphs
- line_plotter <- function(df, x_axis, y_axis, x_label, y_label, plot_title) {
- line_plot <- df %>%
- ggplot(aes(x = x_axis, y = y_axis)) +
- geom_line(aes(group=1), size = 1) +
- geom_point(size = 2) +
- labs(x = x_label, y = y_label, title = plot_title) +
- theme_classic() +
- theme(plot.title = element_text(hjust = 0.5, size = 22),
- strip.background = element_blank(),
- strip.text = element_text(size = 14),
- axis.text = element_text(size = 14),
- axis.title = element_text(size = 16))
- return(line_plot)
- }
- ```
- ```{r}
- # Getting the number of bike injuries per year
- bike_injury_counts <- as.data.frame(table(trauma$Year))
- colnames(bike_injury_counts) <- c("Year", "n_count")
- # Yearly bike injury frequency (from python)
- bike_injury_counts$ntdb_totals <- c(997970, 1043736, 1097190, 1133053, 1209097, 1232956) #2017, 2018, 2019, 2020, 2021, 2022
- # Bike Injury frequency over total injuries
- bike_injury_counts$bike_freq <- (bike_injury_counts$n_count / bike_injury_counts$ntdb_totals) * 100
- # Plotting
- bike_injury_counts_plot <- line_plotter(df = bike_injury_counts,
- x_axis = bike_injury_counts$Year, y_axis = bike_injury_counts$bike_freq,
- x_label = "Year", y_label = "Percent Pedalcylist Injuries",
- plot_title = "Pedalcylist Trauma Frequency")
- bike_injury_counts_plot
- # Optional Save
- #ggsave(plot = bike_injury_counts_plot, filename = paste0(cwd, "/figures/yearly_pedalcyclist_trauma_frequency.pdf"), width = 1600, height = 1500, dpi = 300, units = "px")
- ```
- ```{r}
- # Getting the intoxication rate
- intox_counts <- as.data.frame.matrix(table(trauma_filt$Year, trauma_filt$alcohol.use))
- intox_counts$totals <- rowSums(intox_counts)
- intox_counts$intox_freq <- ((intox_counts$Intoxicated + intox_counts$`Multi-Drug`) / intox_counts$totals) * 100 #count both intoxicated & multi-drug groups?
- intox_counts <- tibble::rownames_to_column(intox_counts, var = "Year")
- # Plotting
- intox_freq_plot <- line_plotter(df = intox_counts,
- x_axis = intox_counts$Year, y_axis = intox_counts$intox_freq,
- x_label = "Year", y_label = "Percent Alcohol Intoxication",
- plot_title = "Intoxication Rate per Year")
- intox_freq_plot
- # Optional Save
- #ggsave(plot = intox_freq_plot, filename = paste0(cwd, "/figures/yearly_intoxication_frequency.pdf"), width = 1600, height = 1500, dpi = 300, units = "px")
- ```
- ```{r}
- # Getting the Helmet Use per year
- helmet_counts <- as.data.frame.matrix(table(trauma_filt$Year, trauma_filt$helmet.factor))
- helmet_counts$totals <- rowSums(helmet_counts)
- helmet_counts$helmet_freq <- ((helmet_counts$Helmet) / helmet_counts$totals) * 100
- helmet_counts <- tibble::rownames_to_column(helmet_counts, var = "Year")
- # Plotting
- helmet_freq_plot <- line_plotter(df = helmet_counts,
- x_axis = helmet_counts$Year, y_axis = helmet_counts$helmet_freq,
- x_label = "Year", y_label = "Percent Helmet Use",
- plot_title = "Helmet Use per Year")
- helmet_freq_plot
- # Optional Save
- #ggsave(plot = helmet_freq_plot, filename = paste0(cwd, "/figures/yearly_helmet_use_frequency.pdf"), width = 1600, height = 1500, dpi = 300, units = "px")
- ```
- ```{r}
- # Statistics on yearly intoxication rates
- # Dependent variable of interest
- dependent <- "year.factor"
- # Explanatory & confounding variables
- explanatory <- c("alcohol.use", "helmet.factor")
- # Table
- yearly_table <- trauma_filt %>% summary_factorlist(dependent, explanatory,
- p_cat = "chisq", p = TRUE)
- ```
- ## 8.2 Alcohol AIS analysis
- ```{r}
- # Filtering for filtered INC codes
- ais_filt <- ais[ais$INC_KEY %in% trauma_filt$INC_KEY, ]
- ais_filt <- ais_filt[ais_filt$AISSEVERITY != 9, ] #filtering unknown severity scores
- # Glimpsing
- ais_glimpse <- ff_glimpse(ais_filt)
- ais_glimpse_cont <- ais_glimpse[[1]]
- ais_glimpse_cat <- ais_glimpse[[2]]
- ```
- ```{r}
- # Labeling AIS scores based on alcohol intoxication levels
- alc_unscreened_keys <- trauma_filt %>% filter(alcohol.use == "Not Screened") %>% pull(INC_KEY)
- alc_sober_keys <- trauma_filt %>% filter(alcohol.use == "Sober") %>% pull(INC_KEY)
- alc_impair_keys <- trauma_filt %>% filter(alcohol.use == "Impaired") %>% pull(INC_KEY)
- alc_intox_keys <- trauma_filt %>% filter(alcohol.use == "Intoxicated") %>% pull(INC_KEY)
- multi_drug_keys <- trauma_filt %>% filter(alcohol.use == "Multi-Drug") %>% pull(INC_KEY)
- # Labeleding AIS scores based on helmet use
- helmet_yes_keys <- trauma_filt %>% filter(helmet.factor == "Helmet") %>% pull(INC_KEY)
- helmet_no_keys <- trauma_filt %>% filter(helmet.factor == "No Helmet") %>% pull(INC_KEY)
- ais_filt <- ais_filt %>% mutate(
- alcohol.use = case_when(
- INC_KEY %in% alc_unscreened_keys ~ "Not Screened",
- INC_KEY %in% alc_sober_keys ~ "Sober",
- INC_KEY %in% alc_impair_keys ~ "Impaired",
- INC_KEY %in% alc_intox_keys ~ "Intoxicated",
- INC_KEY %in% multi_drug_keys ~ "Multi-Drug"
- ),
- helmet.factor = case_when(
- INC_KEY %in% helmet_yes_keys ~ "Helmet",
- INC_KEY %in% helmet_no_keys ~ "No Helmet"
- )
- )
- # Filtering for NAs in selected columns
- ais_filt <- ais_filt %>% filter_at(vars(AISPREDOT, AISSEVERITY, AISSEVERITY, ISSREGION, alcohol.use, helmet.factor), all_vars(!is.na(.)))
- # Refactoring ISS region
- ais_filt <- ais_filt %>% mutate(
- ISSREGION.factor = ISSREGION %>%
- factor() %>%
- fct_recode(
- "Head & Neck" = "1",
- "Chest" = "2",
- "Abdominal & Pelvic" = "3",
- "Extremities" = "4",
- "Face" = "5",
- "External" = "6"
- ) %>%
- ff_label("ISS Region"),
- AISSEVERITY = AISSEVERITY %>%
- factor() %>%
- ff_label("AIS Severity Score"),
- alcohol.use = alcohol.use %>%
- factor(levels = c("Not Screened", "Sober", "Impaired", "Intoxicated", "Multi-Drug")) %>%
- ff_label("Alcohol Use"),
- helmet.factor = helmet.factor %>%
- factor(levels = c("Helmet", "No Helmet")) %>%
- ff_label("Helmet")
- )
- ais_filt <- ais_filt %>% mutate(
- ISSREGION = as.numeric(ISSREGION),
- AISSEVERITY = as.numeric(AISSEVERITY)
- )
- ```
- ```{r}
- # Filters for mild and severe AIS injury scores
- #ais_filt_mild <- ais_filt[ais_filt$AISSEVERITY %in% c("1,", "2"), ]
- ais_filt_severe <- ais_filt[ais_filt$AISSEVERITY > 2, ]
- # Explanatory & confounding variables
- explanatory <- c("ISSREGION.factor", "AISSEVERITY")
- # Explanatory variable of interest
- dependent <- "helmet.factor" #alcohol.use or helmet.factor
- table4.1 <- ais_filt %>%
- summary_factorlist(dependent, explanatory,
- cont = "mean", p_cont_para = "aov", p_cat = "chisq", p = TRUE, column = TRUE,
- add_col_totals = TRUE,
- na_include = TRUE)
- table4.1$severity <- "All"
- table4.2 <- ais_filt_severe %>%
- summary_factorlist(dependent, explanatory,
- cont = "mean", p_cont_para = "aov", p_cat = "chisq", p = TRUE,
- add_col_totals = TRUE,
- na_include = TRUE)
- table4.2$severity <- "Severe"
- table4 <- bind_rows(table4.1, table4.2)
- # Optional export to excel
- write_xlsx(x = table4, path = "tables/table4_ais.xlsx")
- ```
- ```{r}
- # Fishers test for ISS region - all
- rwf1 <- table(ais_filt$ISSREGION.factor, ais_filt$helmet.factor)
- rwf1 <- rwf1[, c(2,1)]
- chisq.test(rwf1)
- rwf2 <- row_wise_fisher_test(rwf1, p.adjust.method = "fdr", detailed = TRUE)
- ```
- ```{r}
- # Fishers test for ISS region - severe
- ais_filt2 <- ais_filt[ais_filt$AISSEVERITY > 2, ]
- rwf1 <- table(ais_filt2$ISSREGION.factor, ais_filt2$helmet.factor)
- rwf1 <- rwf1[, c(2,1)]
- chisq.test(rwf1)
- rwf2 <- row_wise_fisher_test(rwf1, p.adjust.method = "fdr", detailed = TRUE)
- ```
- ```{r}
- # AIS Severity scores
- wilcox.test(AISSEVERITY ~ helmet.factor, data = ais_filt)
- s <- ais_filt %>% dplyr::group_by(helmet.factor) %>%
- dplyr::summarise(mean_iss = mean(AISSEVERITY))
- ```
- ```{r}
- # Assessing poly-trauma: patients with more than one injury
- ais_poly_counts <- ais_filt %>% group_by(INC_KEY, alcohol.use) %>%
- dplyr::summarise(poly_trauma = n())
- # Explanatory variables
- explanatory <- "alcohol.use"
- # Explanatory variable of interest
- dependent <- "poly_trauma"
- # Statistics on AIS poly-trauma counts
- ais_poly_table <- ais_poly_counts %>%
- summary_factorlist(dependent, explanatory,
- cont = "mean", p_cont_para = "aov", p_cat = "chisq", p = TRUE)
- # Assessing poly-region-trauma: patients with more than one body region injury
- ais_poly_region_counts <- ais_filt %>% group_by(INC_KEY, alcohol.use, ISSREGION.factor) %>%
- dplyr::summarise(poly_trauma = n())
- ais_poly_region_counts <- ais_poly_region_counts %>% group_by(INC_KEY, alcohol.use) %>%
- dplyr::summarise(poly_trauma = n())
- # Explanatory variables
- explanatory <- "alcohol.use"
- # Explanatory variable of interest
- dependent <- "poly_trauma"
- # Statistics on AIS poly-trauma counts
- ais_poly_region_table <- ais_poly_region_counts %>%
- summary_factorlist(dependent, explanatory,
- cont = "mean", p_cont_para = "aov", p_cat = "chisq", p = TRUE)
- # Merging
- ais_poly_table$ais_group <- "Total AIS Injuries"
- ais_poly_region_table$ais_group <- "Number of AIS Body Region Injuries"
- ais_poly <- rbind(ais_poly_table, ais_poly_region_table)
- # Exporting
- #write_csv(x = ais_poly, file = paste0(cwd, "/tables/ais_poly-injuries.csv"))
- ```
03_Statistical_Analysis.Rmd at commit f331570, no license · at the source
Overview
- Medical Scientist Training Program, Baylor College of Medicine, Houston, Texas, USA
- The Department of Family Medicine, The University of Tennessee Graduate School of Medicine, Knoxville, Tennessee, USA
- Michael E. DeBakey Department of Surgery, Baylor College of Medicine, Houston, Texas, USA
- H. Ben Taub Department of Physical Medicine and Rehabilitation, Baylor College of Medicine, Houston, Texas, USA
- Department of Clinical Sciences, Chicago Medical School, Rosalind Franklin University of Medicine and Science, North Chicago, Illinois, USA
Abstract
Background: Helmet use significantly reduces the risk of traumatic brain injury among cyclists; however, the influence of alcohol use on helmet-wearing adherence remains understudied in large national data sets. The goal of this study was to investigate the relationship between alcohol use and helmet use in injured cyclists.
Methods: This study is a retrospective cross-sectional analysis of 155 766 cyclists with traumatic injuries from the National Trauma Data Bank spanning 8 years (2017–2023). Cyclists were categorized by blood alcohol concentration (BAC) as follows: not screened, sober (BAC <0.02), impaired (BAC 0.02–0.08), intoxicated (BAC ≥0.08), and multidrug intoxicated (BAC ≥0.08 plus ≥1 positive drug screen). The primary outcome was helmet usage. Secondary outcomes included mortality, hospital and intensive care unit length of stay, Injury Severity Score, and adverse events. Comorbid substance use disorders were considered as covariates.
Results: Alcohol use was associated with a dose-response decrease in helmet use. Helmet adherence was 45.9% in sober cyclists (n=
Conclusions: Alcohol use demonstrated a significant dose-response relationship with helmet non-usage among cyclists, particularly among those with substance use disorders. This relationship represents a critical public safety concern requiring further investigation to address its public health implications.
Level of Evidence: Retrospective Epidemiologic/
Reproduced under the paper's license (CC BY-NC), from the paper cited above.
Repository
Its files are read in the Code ↔ Paper reader above, with 7 matches between paragraphs and lines of code.
toofastdan117/TQP_bike_alcohol_helmets
f33157079569e2ceb6bb02961eccdb24d23a76cd, 3 September 2026Availability: 1 check, the latest on 27 September 2026: the link answers
- 27 September 2026: the link answers
5 files
- 01_TQP_Parser.ipynb, Jupyter, 890 lines
- 02_TQP_Merger.ipynb, Jupyter, 307 lines
- 03_Statistical_Analysis.
Rmd , R, 1,277 lines, 5 matches - 04_Feature_Selection.ipy
nb , Jupyter, 242 lines, 2 matches - README.md, Text, 29 lines
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 4 scripts, each with its path and the digest of its content;
- 7 matches between paragraphs of the paper and lines of the code (method lexical-v1);
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
No dataset and no data link were found in the paper.
Data availability statement
Data may be obtained from a third party and are not publicly available.
Reproduced under the paper's license (CC BY-NC), from the paper cited above.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 2, 28 September 2026
- Funding: added Texas Children's Hospital
Version 1, 27 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 4 authors, 6 keywords, 35 references, 1 integrity notice.
Cite
This paper
Brock, D. C., Yan, G., Wilson, C. T., & Husu, E. N. (2026). Association of alcohol use with helmet use in cyclists: analysis of the National Trauma Data Bank. Trauma surgery & acute care open, 11(2), e001974. https://
BibTeX
@article{brock2026associ
author = {Brock, Daniel C and Yan, Gaibo and Wilson, Chad T and Husu, Emanuel Narcis},
title = {{Association of alcohol use with helmet use in cyclists: analysis of the National Trauma Data Bank}},
journal = {Trauma surgery \& acute care open},
year = {2026},
month = jun,
volume = {11},
number = {2},
pages = {e001974},
publisher = {BMJ Publishing Group},
issn = {2397-5776},
doi = {10.1136/
url = {https://
pmid = {42375761},
pmcid = {PMC13311654}
}
RIS
TY - JOUR
AU - Brock, Daniel C
AU - Yan, Gaibo
AU - Wilson, Chad T
AU - Husu, Emanuel Narcis
TI - Association of alcohol use with helmet use in cyclists: analysis of the National Trauma Data Bank
T2 - Trauma surgery & acute care open
J2 - Trauma Surg Acute Care Open
PY - 2026
DA - 2026/
VL - 11
IS - 2
SP - e001974
SN - 2397-5776
PB - BMJ Publishing Group
DO - 10.1136/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1136/
"type": "article-journal",
"title": "Association of alcohol use with helmet use in cyclists: analysis of the National Trauma Data Bank",
"container-title": "Trauma surgery & acute care open",
"author": [
{
"family": "Brock",
"given": "Daniel C"
},
{
"family": "Yan",
"given": "Gaibo"
},
{
"family": "Wilson",
"given": "Chad T"
},
{
"family": "Husu",
"given": "Emanuel Narcis"
}
],
"container-title-short":
"volume": "11",
"issue": "2",
"page": "e001974",
"DOI": "10.1136/
"PMID": "42375761",
"PMCID": "PMC13311654",
"ISSN": "2397-5776",
"publisher": "BMJ Publishing Group",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
6,
26
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.1093/bioinformatics/btag592 [code]
- Network-based stratification of allele-specific expression reveals patient subgroups in Huntington's disease.Journal: Bioinformatics (Oxford, England)In common: survival, rstatix, broom, 6 other tools, other condition
- [2] doi:10.1093/neuonc/noag128 [code]
- Spatially-resolved single-cell imaging of melanoma brain metastases identifies localized immune patterns predictive of immune checkpoint blockade response.Journal: Neuro-oncologyIn common: survival, rstatix, pheatmap, 4 other tools, clinical / translational, other condition
- [3] doi:10.1038/s42003-026-10957-8 [code]
- Brain defence by the extracellular matrix protein Cochlin.Journal: Communications biologyIn common: survival, broom, pheatmap, 5 other tools
- [4] doi:10.1038/s41586-026-10612-6 [code]
- Acquired genetic and cell-state changes in IDH-mutant glioma progression.Journal: NatureIn common: survival, broom, pheatmap, 4 other tools, other condition
- [5] doi:10.1016/j.xcrm.2026.102682 [code]
- TET CpG sequence-context-specifi
c DNA demethylation shapes progression of IDH-mutant gliomas. Journal: Cell reports. MedicineIn common: survival, broom, pheatmap, 4 other tools, other condition - [6] doi:10.1016/j.isci.2026.115657 [code]
- Integration of machine learning to develop a disulfidptosis model for predicting glioma prognosis, immunotherapy response, and drug.Journal: iScienceIn common: survival, broom, pheatmap, 3 other tools, clinical / translational, other condition
- [7] doi:10.1016/j.cell.2026.05.026 [code]
- The critical role of the endogenous immune compartment after CAR T cell therapy in recurrent GBM.Journal: CellIn common: survival, rstatix, patchwork, 4 other tools, other condition
- [8] doi:10.1073/pnas.2609132123 [code]
- A human lysosomal storage disorder toolkit for decoding proteome landscapes in cortical-like and dopaminergic-like induced neurons.Journal: Proceedings of the National Academy of Sciences of the United States of AmericaIn common: rstatix, broom, pheatmap, 4 other tools
- [9] doi:10.3390/ijms27093997 [code]
- Coordinated Multicellular Immune Programs and Drug Targets Revealed by Single-Cell Analysis in Driver-Mutated NSCLC.Journal: International journal of molecular sciencesIn common: survival, rstatix, pheatmap, 2 other tools, other condition
- [10] doi:10.1002/imt2.70163 [code]
- Spatial multi-omics unveils sphingolipid metabolic reprogramming within the retinal pathological niche.Journal: iMetaIn common: rstatix, pheatmap, patchwork, 4 other tools
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 1 repository of the authors' code, each at its verified commit and with its license, 4 scripts, and 7 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:93cf446c3c9aaab0…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[, paste the snippet at the top, then “Commit changes…” and, to review it first, “Create a new branch and start a pull request”. You open the pull request; OSCR asks for no permission.
Request its removal
To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).
Discussion, reproductions, activity
Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.
Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
