Supporting R Code and Data Dictionary for “Modeling Demographic Disparities in Thyroid Cancer Staging Using Non-Proportional Ordinal Logits: A SEER-Based Adjacent-Categories Analysis”

Published: 30 June 2026| Version 1 | DOI: 10.17632/55j9tmtg7d.1
Contributors:
,
,

Description

This repository contains the analytic code, documentation, and data dictionary supporting the manuscript "Modeling Demographic Disparities in Thyroid Cancer Staging Using Non-Proportional Ordinal Logits: A SEER-Based Adjacent-Categories Analysis." The deposited materials document a SEER-based analysis of thyroid cancer stage at diagnosis using ordinal regression methods, with stage modeled as an ordered outcome across Local, Regional, and Distant categories. The repository provides full transparency into the analytic workflow, encompassing variable definitions, coding decisions, model specification and comparison, predicted probabilities, calibration and probability scoring, cross-validation, and generation of all manuscript figures and tables. The primary analysis evaluates associations between thyroid cancer stage and demographic and rurality predictors—age group, sex, race/ethnicity group, and county-level urban/rural status. The R code encompasses construction of derived variables, definition of the complete-case analytic cohort, fitting of proportional and non-proportional ordinal models including adjacent-categories logit specifications, model diagnostics, likelihood-ratio testing, model comparison, estimation of average marginal effects, and export of manuscript-ready tables and figures. Accompanying R Markdown and Markdown files provide annotated narrative documentation of the full analytic pipeline, and a data dictionary details all variable names, definitions, value labels, and coding decisions for the analytic dataset. The underlying patient-level data were obtained from the Surveillance, Epidemiology, and End Results (SEER) Program and are not redistributed in this repository. Investigators with authorized SEER access may use the provided code and data dictionary to reproduce the full analytic workflow using the corresponding SEER-derived input dataset.

Files

Steps to reproduce

To reproduce the analysis, obtain authorized access to the SEER Program and prepare the input file as raw_data_submit.csv using the variable definitions and coding scheme provided in the accompanying data dictionary. Place raw_data_submit.csv in the same working directory as the R script and R Markdown documentation. Install all required R packages before running the analysis: tidyverse, janitor, lubridate, ggplot2, dplyr, forcats, glue, car, scales, tibble, stringr, ordinal, VGAM, gridExtra, gt, pROC, patchwork, splines, MASS, flextable, and officer. Run the main script, ThyroidOrdinalCharts_VN_06292026.R, from start to finish in R or RStudio. The script imports raw_data_submit.csv, cleans and recodes variables, creates the mutually exclusive race/ethnicity grouping, defines thyroid cancer stage as an ordered outcome across Local, Regional, and Distant categories, and constructs the complete-case primary analysis cohort. It then fits the ordinal regression models described in the manuscript—cumulative link, adjacent-categories logit, continuation-ratio, and the primary non-proportional adjacent-categories specification—and performs model comparison, likelihood-ratio testing, condition-number assessment, calibration analysis, probability scoring, ROC/AUC analysis, average marginal effects, cross-validation, and model diagnostics. Upon successful execution, the script exports all manuscript and supplementary outputs, including figures, tables, diagnostic plots, model-selection summaries, Brier/RPS summaries, AUC summaries, and RECORD-style study flow and variable documentation. The accompanying R Markdown and Markdown files provide additional narrative documentation of the analytic workflow and should be reviewed alongside the R script and data dictionary. The underlying patient-level data are derived from SEER and are not redistributed in this repository. Users must obtain appropriate SEER data access and prepare the input dataset according to the included data dictionary before running the code.

Institutions

Categories

Statistics, Public Health, Cancer Epidemiology, Coding in Epidemiology, Coding in Statistics, Biostatistics, Analytical Modeling, Probability Model

Licence