{"id":640,"date":"2026-06-09T10:01:53","date_gmt":"2026-06-09T03:01:53","guid":{"rendered":"https:\/\/medytic.blog\/?p=640"},"modified":"2026-06-09T14:14:23","modified_gmt":"2026-06-09T07:14:23","slug":"replicating-and-modernizing-clinical-data-science-a-deep-dive-into-hba1c-screening-and-hospital-readmissions","status":"publish","type":"post","link":"https:\/\/medytic.blog\/en\/2026\/06\/09\/replicating-and-modernizing-clinical-data-science-a-deep-dive-into-hba1c-screening-and-hospital-readmissions\/","title":{"rendered":"Replicating and Modernizing Clinical Data Science: A Deep Dive into HbA1c Screening and Hospital Readmissions"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"is-style-text-annotation has-small-font-size is-style-text-annotation--1 wp-block-paragraph\"><em>Disclaimer<\/em><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li class=\"has-small-font-size\"><em>This project was developed independently with AI assistance for educational purposes. I utilized agentic AI to help plan and comprehend the analysis, while actively monitoring the pipeline, checking and validating the scripts, researching concepts for clarification, editing the writeup, and learning biostatistics throughout the process.<\/em><\/li>\n\n\n\n<li class=\"has-small-font-size\"><em>In finalizing this article, I have personally reviewed, selected, and approved all content, figures, and statistical interpretations presented.<\/em><\/li>\n\n\n\n<li class=\"has-small-font-size\"><em>The replication scripts are provided at the end of this page for learning purposes and should not be used in production environments without further verification.<\/em><\/li>\n<\/ol>\n<\/blockquote>\n\n\n\n<h1 class=\"wp-block-heading\">What you will find in this project<\/h1>\n\n\n\n<div class=\"wp-block-jetpack-markdown\"><ol>\n<li>What is hospital readmission in diabetic patients?<\/li>\n<li>The landmark 2014 study by Strack et al.<\/li>\n<li>Inpatient readmission data analysis methodology\n<ul>\n<li>Data Preprocessing &amp; Cohort Reconstruction using R<\/li>\n<li>Nested Logistic Regression Modeling (Models 1 to 5) using R<\/li>\n<li>Nested Model Comparisons &amp; Analysis of Deviance using R<\/li>\n<\/ul>\n<\/li>\n<li>Critique &amp; Modernization of Data Visualization\n<ul>\n<li>Covariance-Based Standard Error Calculation with Interaction Terms<\/li>\n<li>Faceted Forest Plot of Odds Ratios (using Global 3-df Wald Tests)<\/li>\n<\/ul>\n<\/li>\n<li>Findings &amp; The Statistical Paradox\n<ul>\n<li>The Circulatory Paradox (Globally Significant, Individually Non-Significant)<\/li>\n<li>The Injury Discovery (Globally Non-Significant, Individually Significant)<\/li>\n<li>The Diabetes &amp; Respiratory Stories<\/li>\n<\/ul>\n<\/li>\n<li>Discussions &amp; Proposed Future Improvements\n<ul>\n<li>Retrospective Data Limitations &amp; HITECH Act Context<\/li>\n<li>Propensity Score Matching (Causal Inference)<\/li>\n<li>Machine Learning &amp; SHAP Interpretability<\/li>\n<li>Survival Analysis (Time-to-Event Cox Model)<\/li>\n<\/ul>\n<\/li>\n<li>Conclusions &amp; full replication scripts on GitHub<\/li>\n<\/ol>\n<\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">Introduction<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">As a health data enthusiast interested in data science, I wanted to combine clinical research with modern data science methods to improve my skills. I chose to replicate <a href=\"https:\/\/pmc.ncbi.nlm.nih.gov\/articles\/PMC3996476\/\">the 2014 study by Strack et al<\/a> because it offers a rich tabular dataset with a clear clinical hypothesis: <\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">does performing an HbA1c (glycated hemoglobin) test during an inpatient stay associate with a lower risk of 30-day readmission? This replication project is a perfect fit for my interests in statistical modeling.<\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\">What is hospital readmission?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Hospital readmission within 30 days is a major quality indicator for inpatient care. Under the Hospital Readmissions Reduction Program (<a href=\"https:\/\/www.cms.gov\/medicare\/payment\/prospective-payment-systems\/acute-inpatient-pps\/hospital-readmissions-reduction-program-hrrp\">HRRP<\/a>), hospitals face financial penalties if their readmission rates for specific conditions (such as heart failure, COPD, or diabetes complications) are too high. Finding strategies to reduce these readmissions is crucial for patient safety and cost management.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is the 2014 Strack et al. study?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The study analyzed a massive clinical database (Health Facts) tracking 70,000 diabetic patient records across 10 years (1999\u20132008). The authors hypothesized that performing an HbA1c test acts as a representative for &#8220;attention to diabetes care&#8221; during hospitalization, leading to better glycemic control, treatment changes, and ultimately fewer readmissions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What would be expected from this replication?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">By replicating this paper, I seek to confirm if the reported statistical associations are robust. More importantly, I aim to critique the original paper&#8217;s data visualization choices and present an improved forest plot that uncovers a hidden statistical paradox.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">Methodology<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Replication and modernization pipeline workflow:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"706\" height=\"766\" data-attachment-id=\"704\" data-permalink=\"https:\/\/medytic.blog\/en\/2026\/06\/09\/replicating-and-modernizing-clinical-data-science-a-deep-dive-into-hba1c-screening-and-hospital-readmissions\/screenshot-2026-06-09-111722\/\" data-orig-file=\"https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/Screenshot-2026-06-09-111722.png?fit=706%2C766&amp;ssl=1\" data-orig-size=\"706,766\" data-comments-opened=\"1\" data-image-title=\"Screenshot 2026-06-09 111722\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/Screenshot-2026-06-09-111722.png?fit=706%2C766&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/Screenshot-2026-06-09-111722.png?resize=706%2C766&#038;ssl=1\" alt=\"\" class=\"wp-image-704\" style=\"aspect-ratio:0.9216754487809234;width:417px;height:auto\" srcset=\"https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/Screenshot-2026-06-09-111722.png?w=706&amp;ssl=1 706w, https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/Screenshot-2026-06-09-111722.png?resize=277%2C300&amp;ssl=1 277w\" sizes=\"auto, (max-width: 706px) 100vw, 706px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Data source<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The raw dataset contains 101,766 clinical encounters from 130 US hospitals.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Data is available on Kaggle: <a href=\"https:\/\/www.kaggle.com\/datasets\/brandao\/diabetes\/data\">Diabetes 130-US hospitals Schema<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Data preprocessing and cleaning<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Cohort Selection<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Using R (<code>preprocess.R<\/code>), I applied the paper&#8217;s cohort selection filters:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Remove deaths and hospice discharges<\/strong>: Excluded lethal discharge codes 11, 13, 14, 19, 20, and 21 to focus only on survivors who could be readmitted. (discard codes according to metadata &#8220;IDS_mapping.csv&#8221;)<\/li>\n\n\n\n<li><strong>Select independent encounters<\/strong>: Retained only the first encounter for each unique patient (<code>min(encounter_id)<\/code>) to maintain statistical independence.<\/li>\n\n\n\n<li><strong>Filter invalid data<\/strong>: Excluded records with invalid gender entries.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">My preprocessed cohort size is <strong>69,987<\/strong> records, matching the paper&#8217;s original cohort of <strong>69,984<\/strong> with a difference of just 3 records. This tiny difference is due to 3 patients over 60 who expired during their first encounter but had subsequent encounters retained by our pipeline.<\/p>\n\n\n\n<div class=\"wp-block-jetpack-markdown\"><table>\n<thead>\n<tr>\n<th style=\"text-align:left\">Demographic Category<\/th>\n<th style=\"text-align:left\">Replicated Cohort ($N=69,987$)<\/th>\n<th style=\"text-align:left\">Stated Paper Cohort ($N=69,984$)<\/th>\n<th style=\"text-align:left\">Discrepancy<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align:left\"><strong>Age: Under 30<\/strong><\/td>\n<td style=\"text-align:left\">1,808<\/td>\n<td style=\"text-align:left\">1,808<\/td>\n<td style=\"text-align:left\">0<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:left\"><strong>Age: 30 to 60<\/strong><\/td>\n<td style=\"text-align:left\">21,871<\/td>\n<td style=\"text-align:left\">21,871<\/td>\n<td style=\"text-align:left\">0<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:left\"><strong>Age: Over 60<\/strong><\/td>\n<td style=\"text-align:left\">46,308<\/td>\n<td style=\"text-align:left\">46,305<\/td>\n<td style=\"text-align:left\">+3<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:left\"><strong>Discharged to Home<\/strong><\/td>\n<td style=\"text-align:left\">44,320<\/td>\n<td style=\"text-align:left\">44,339<\/td>\n<td style=\"text-align:left\">-19<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:left\"><strong>Otherwise Discharged<\/strong><\/td>\n<td style=\"text-align:left\">25,667<\/td>\n<td style=\"text-align:left\">25,645<\/td>\n<td style=\"text-align:left\">+22<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:left\"><strong>Admitted from ER<\/strong><\/td>\n<td style=\"text-align:left\">37,271<\/td>\n<td style=\"text-align:left\">37,277<\/td>\n<td style=\"text-align:left\">-6<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:left\"><strong>Admitted via Referral<\/strong><\/td>\n<td style=\"text-align:left\">22,792<\/td>\n<td style=\"text-align:left\">22,800<\/td>\n<td style=\"text-align:left\">-8<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Feature Engineering &amp; Standardization<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Discharge Disposition: Collapsed 29 categories into a binary flag: <code>Home<\/code> vs. <code>Other<\/code> (transfer to rehab, nursing home, or hospice) to serve as a proxy for patient frailty and prevent sparse-cell model instability.<\/li>\n\n\n\n<li>Age: Grouped 10-year brackets into three mathematically justified categories (<code>&lt;30<\/code>, <code>[30, 60)<\/code>, <code>[60, 100)<\/code>) based on risk inflection points visualized on figure 2 of the article.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" data-attachment-id=\"659\" data-permalink=\"https:\/\/medytic.blog\/en\/2026\/06\/09\/replicating-and-modernizing-clinical-data-science-a-deep-dive-into-hba1c-screening-and-hospital-readmissions\/figure_2\/\" data-orig-file=\"https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/figure_2.png?fit=2400%2C1500&amp;ssl=1\" data-orig-size=\"2400,1500\" data-comments-opened=\"1\" data-image-title=\"figure_2\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/figure_2.png?fit=1024%2C640&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/figure_2.png?resize=1024%2C640&#038;ssl=1\" alt=\"\" class=\"wp-image-659\" srcset=\"https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/figure_2.png?resize=1024%2C640&amp;ssl=1 1024w, https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/figure_2.png?resize=300%2C188&amp;ssl=1 300w, https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/figure_2.png?resize=768%2C480&amp;ssl=1 768w, https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/figure_2.png?resize=1536%2C960&amp;ssl=1 1536w, https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/figure_2.png?resize=2048%2C1280&amp;ssl=1 2048w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The logit of readmission rates plotted across 10-year intervals shows three distinct slopes: a flat low risk (&lt;30), a moderately increasing risk (30-60), and a steep high-risk slope (&gt;60).<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li> <strong>Race<\/strong>:<br>In this clinical dataset, the distribution of patient races is highly skewed:\n<ul class=\"wp-block-list\">\n<li><strong>Caucasian<\/strong>: ~74.7% (52,305 patients)<\/li>\n\n\n\n<li><strong>African American<\/strong>: ~18.0% (12,627 patients)<\/li>\n\n\n\n<li><strong>Missing<\/strong>: ~2.7% (1,917 patients)<\/li>\n\n\n\n<li><strong>Other<\/strong>&nbsp;(combining Asian, Hispanic, and &#8220;Other&#8221;): ~4.5% (3,138 patients)<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Grouped minor demographics (Asian, Hispanic) into the <code>Other<\/code> category to prevent unstable estimates and quasi-complete separation during regression modeling.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>HbA1c Group<\/strong>: Grouped based on A1C result and diabetic medication changes:<\/li>\n<\/ul>\n\n\n\n<ol class=\"wp-block-list\">\n<li><code>Not measured<\/code> (Reference)<\/li>\n\n\n\n<li><code>Normal<\/code> (Result normal or &lt;8% with no medication changes)<\/li>\n\n\n\n<li><code>High, changed<\/code> (Result &gt;8% and medication changed)<\/li>\n\n\n\n<li><code>High, not changed<\/code> (Result &gt;8% and medication not changed)<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">These two encounter: <code>Low, not changed<\/code> and <code>Not measured, changed<\/code> are not included because medication changes for untested patients are guided by daily fingerstick glucose monitoring, which is a different clinical pathway. The authors wanted to isolate the response to a highly abnormal test\u00a0(HbA1c > 8%) specifically.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>Technical Insight: Standardizing High-Cardinals with ICD-9 Diagnosis Grouping<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The primary diagnosis (<code>diag_1<\/code>) contained over 800 distinct ICD-9 codes. I wrote a custom mapper based on clinical chapters that cross checked with <code>complete_icd-9_manual.pdf<\/code> to collapse these into 9 major diagnostic groups:<\/p>\n<\/blockquote>\n\n\n<div class=\"wp-block-code\">\n\t<div class=\"cm-editor\">\n\t\t<div class=\"cm-scroller\">\n\t\t\t\n<pre>\n<code class=\"language-r\"><div class=\"cm-line\"><span class=\"tok-comment\"># Preprocessing snippet from preprocess.R<\/span><\/div><div class=\"cm-line\"><span class=\"tok-variableName\">group_diagnosis<\/span> <span class=\"tok-operator\">&lt;-<\/span> <span class=\"tok-keyword\">function<\/span>(<span class=\"tok-variableName\">diag_1<\/span>) {<\/div><div class=\"cm-line\">  <span class=\"tok-variableName\">diag_short<\/span> <span class=\"tok-operator\">&lt;-<\/span> <span class=\"tok-variableName\">substr<\/span>(<span class=\"tok-variableName\">diag_1<\/span>, <span class=\"tok-number\">1<\/span>, <span class=\"tok-number\">3<\/span>)<\/div><div class=\"cm-line\">  <span class=\"tok-variableName\">diag_num<\/span> <span class=\"tok-operator\">&lt;-<\/span> <span class=\"tok-variableName\">suppressWarnings<\/span>(<span class=\"tok-variableName\">as.numeric<\/span>(<span class=\"tok-variableName\">diag_short<\/span>))<\/div><div class=\"cm-line\">  <\/div><div class=\"cm-line\">  <span class=\"tok-variableName\">case_when<\/span>(<\/div><div class=\"cm-line\">    <span class=\"tok-operator\">!<\/span><span class=\"tok-variableName\">is.na<\/span>(<span class=\"tok-variableName\">diag_num<\/span>) <span class=\"tok-operator\">&amp;<\/span> ((<span class=\"tok-variableName\">diag_num<\/span> <span class=\"tok-operator\">&gt;=<\/span> <span class=\"tok-number\">390<\/span> <span class=\"tok-operator\">&amp;<\/span> <span class=\"tok-variableName\">diag_num<\/span> <span class=\"tok-operator\">&lt;=<\/span> <span class=\"tok-number\">459<\/span>) <span class=\"tok-operator\">|<\/span> <span class=\"tok-variableName\">diag_num<\/span> <span class=\"tok-operator\">==<\/span> <span class=\"tok-number\">785<\/span>) <span class=\"tok-operator\">~<\/span> <span class=\"tok-string\">&quot;Circulatory&quot;<\/span>,<\/div><div class=\"cm-line\">    <span class=\"tok-operator\">!<\/span><span class=\"tok-variableName\">is.na<\/span>(<span class=\"tok-variableName\">diag_num<\/span>) <span class=\"tok-operator\">&amp;<\/span> ((<span class=\"tok-variableName\">diag_num<\/span> <span class=\"tok-operator\">&gt;=<\/span> <span class=\"tok-number\">460<\/span> <span class=\"tok-operator\">&amp;<\/span> <span class=\"tok-variableName\">diag_num<\/span> <span class=\"tok-operator\">&lt;=<\/span> <span class=\"tok-number\">519<\/span>) <span class=\"tok-operator\">|<\/span> <span class=\"tok-variableName\">diag_num<\/span> <span class=\"tok-operator\">==<\/span> <span class=\"tok-number\">786<\/span>) <span class=\"tok-operator\">~<\/span> <span class=\"tok-string\">&quot;Respiratory&quot;<\/span>,<\/div><div class=\"cm-line\">    <span class=\"tok-operator\">!<\/span><span class=\"tok-variableName\">is.na<\/span>(<span class=\"tok-variableName\">diag_num<\/span>) <span class=\"tok-operator\">&amp;<\/span> ((<span class=\"tok-variableName\">diag_num<\/span> <span class=\"tok-operator\">&gt;=<\/span> <span class=\"tok-number\">520<\/span> <span class=\"tok-operator\">&amp;<\/span> <span class=\"tok-variableName\">diag_num<\/span> <span class=\"tok-operator\">&lt;=<\/span> <span class=\"tok-number\">579<\/span>) <span class=\"tok-operator\">|<\/span> <span class=\"tok-variableName\">diag_num<\/span> <span class=\"tok-operator\">==<\/span> <span class=\"tok-number\">787<\/span>) <span class=\"tok-operator\">~<\/span> <span class=\"tok-string\">&quot;Digestive&quot;<\/span>,<\/div><div class=\"cm-line\">    <span class=\"tok-operator\">!<\/span><span class=\"tok-variableName\">is.na<\/span>(<span class=\"tok-variableName\">diag_num<\/span>) <span class=\"tok-operator\">&amp;<\/span> <span class=\"tok-variableName\">diag_num<\/span> <span class=\"tok-operator\">==<\/span> <span class=\"tok-number\">250<\/span> <span class=\"tok-operator\">~<\/span> <span class=\"tok-string\">&quot;Diabetes&quot;<\/span>,<\/div><div class=\"cm-line\">    <span class=\"tok-operator\">!<\/span><span class=\"tok-variableName\">is.na<\/span>(<span class=\"tok-variableName\">diag_num<\/span>) <span class=\"tok-operator\">&amp;<\/span> (<span class=\"tok-variableName\">diag_num<\/span> <span class=\"tok-operator\">&gt;=<\/span> <span class=\"tok-number\">800<\/span> <span class=\"tok-operator\">&amp;<\/span> <span class=\"tok-variableName\">diag_num<\/span> <span class=\"tok-operator\">&lt;=<\/span> <span class=\"tok-number\">999<\/span>) <span class=\"tok-operator\">~<\/span> <span class=\"tok-string\">&quot;Injury&quot;<\/span>, <\/div><div class=\"cm-line\">    <span class=\"tok-operator\">!<\/span><span class=\"tok-variableName\">is.na<\/span>(<span class=\"tok-variableName\">diag_num<\/span>) <span class=\"tok-operator\">&amp;<\/span> (<span class=\"tok-variableName\">diag_num<\/span> <span class=\"tok-operator\">&gt;=<\/span> <span class=\"tok-number\">710<\/span> <span class=\"tok-operator\">&amp;<\/span> <span class=\"tok-variableName\">diag_num<\/span> <span class=\"tok-operator\">&lt;=<\/span> <span class=\"tok-number\">739<\/span>) <span class=\"tok-operator\">~<\/span> <span class=\"tok-string\">&quot;Musculoskeletal&quot;<\/span>,<\/div><div class=\"cm-line\">    <span class=\"tok-operator\">!<\/span><span class=\"tok-variableName\">is.na<\/span>(<span class=\"tok-variableName\">diag_num<\/span>) <span class=\"tok-operator\">&amp;<\/span> ((<span class=\"tok-variableName\">diag_num<\/span> <span class=\"tok-operator\">&gt;=<\/span> <span class=\"tok-number\">580<\/span> <span class=\"tok-operator\">&amp;<\/span> <span class=\"tok-variableName\">diag_num<\/span> <span class=\"tok-operator\">&lt;=<\/span> <span class=\"tok-number\">629<\/span>) <span class=\"tok-operator\">|<\/span> <span class=\"tok-variableName\">diag_num<\/span> <span class=\"tok-operator\">==<\/span> <span class=\"tok-number\">788<\/span>) <span class=\"tok-operator\">~<\/span> <span class=\"tok-string\">&quot;Genitourinary&quot;<\/span>,<\/div><div class=\"cm-line\">    <span class=\"tok-operator\">!<\/span><span class=\"tok-variableName\">is.na<\/span>(<span class=\"tok-variableName\">diag_num<\/span>) <span class=\"tok-operator\">&amp;<\/span> (<span class=\"tok-variableName\">diag_num<\/span> <span class=\"tok-operator\">&gt;=<\/span> <span class=\"tok-number\">140<\/span> <span class=\"tok-operator\">&amp;<\/span> <span class=\"tok-variableName\">diag_num<\/span> <span class=\"tok-operator\">&lt;=<\/span> <span class=\"tok-number\">239<\/span>) <span class=\"tok-operator\">~<\/span> <span class=\"tok-string\">&quot;Neoplasms&quot;<\/span>,<\/div><div class=\"cm-line\">    <span class=\"tok-atom\">TRUE<\/span> <span class=\"tok-operator\">~<\/span> <span class=\"tok-string\">&quot;Other&quot;<\/span><\/div><div class=\"cm-line\">  )<\/div><div class=\"cm-line\">}<\/div><\/code><\/pre>\n\t\t<\/div>\n\t<\/div>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\">Descriptive profiling<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Comparing my preprocessed cohort distributions against the paper&#8217;s original Table 3 demonstrates the high fidelity of this replication:<\/p>\n\n\n\n<div class=\"wp-block-jetpack-markdown\"><table>\n<thead>\n<tr>\n<th style=\"text-align:left\">Demographic \/ Variable<\/th>\n<th style=\"text-align:left\">Category<\/th>\n<th style=\"text-align:left\">Replicated Count<\/th>\n<th style=\"text-align:left\">Paper Count<\/th>\n<th style=\"text-align:left\">Difference<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align:left\"><strong>Gender<\/strong><\/td>\n<td style=\"text-align:left\">Female<\/td>\n<td style=\"text-align:left\">37,239<\/td>\n<td style=\"text-align:left\">37,234<\/td>\n<td style=\"text-align:left\">+5<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:left\"><\/td>\n<td style=\"text-align:left\">Male<\/td>\n<td style=\"text-align:left\">32,748<\/td>\n<td style=\"text-align:left\">32,750<\/td>\n<td style=\"text-align:left\">-2<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:left\"><strong>Age Group<\/strong><\/td>\n<td style=\"text-align:left\">Under 30<\/td>\n<td style=\"text-align:left\">1,808<\/td>\n<td style=\"text-align:left\">1,808<\/td>\n<td style=\"text-align:left\">0<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:left\"><\/td>\n<td style=\"text-align:left\">30-60<\/td>\n<td style=\"text-align:left\">21,871<\/td>\n<td style=\"text-align:left\">21,871<\/td>\n<td style=\"text-align:left\">0<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:left\"><\/td>\n<td style=\"text-align:left\">Older than 60<\/td>\n<td style=\"text-align:left\">46,308<\/td>\n<td style=\"text-align:left\">46,305<\/td>\n<td style=\"text-align:left\">+3<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:left\"><strong>Discharge Status<\/strong><\/td>\n<td style=\"text-align:left\">Home<\/td>\n<td style=\"text-align:left\">44,320<\/td>\n<td style=\"text-align:left\">44,339<\/td>\n<td style=\"text-align:left\">-19<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:left\"><\/td>\n<td style=\"text-align:left\">Otherwise (Other)<\/td>\n<td style=\"text-align:left\">25,667<\/td>\n<td style=\"text-align:left\">25,645<\/td>\n<td style=\"text-align:left\">+22<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:left\"><strong>HbA1c Group<\/strong><\/td>\n<td style=\"text-align:left\">Not measured<\/td>\n<td style=\"text-align:left\">57,141<\/td>\n<td style=\"text-align:left\">57,080<\/td>\n<td style=\"text-align:left\">+61<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:left\"><\/td>\n<td style=\"text-align:left\">Normal<\/td>\n<td style=\"text-align:left\">6,607<\/td>\n<td style=\"text-align:left\">6,637<\/td>\n<td style=\"text-align:left\">-30<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:left\"><\/td>\n<td style=\"text-align:left\">High, changed<\/td>\n<td style=\"text-align:left\">4,058<\/td>\n<td style=\"text-align:left\">4,071<\/td>\n<td style=\"text-align:left\">-13<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:left\"><\/td>\n<td style=\"text-align:left\">High, not changed<\/td>\n<td style=\"text-align:left\">2,181<\/td>\n<td style=\"text-align:left\">2,196<\/td>\n<td style=\"text-align:left\">-15<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Logistic Regression Modeling &amp; Statistical Tests<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">I fitted five nested models to test the impact of covariates and interactions:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Model 1: Core Model with Gender<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In Model 1, I included every variable in the dataset except the HbA1c measurement groups. Every predictor group contained at least one variable that was statistically significant at the 0.05 confidence level, except for gender:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Gender Male (vs. Female)<\/strong>: <math data-latex=\"\\text{Estimate} = 0.0287, \\text{SE} = 0.0270, z = 1.06, p = 0.288\"><semantics><mrow><mtext>Estimate<\/mtext><mo>=<\/mo><mn>0.0287<\/mn><mo separator=\"true\">,<\/mo><mtext>SE<\/mtext><mo>=<\/mo><mn>0.0270<\/mn><mo separator=\"true\">,<\/mo><mi>z<\/mi><mo>=<\/mo><mn>1.06<\/mn><mo separator=\"true\">,<\/mo><mi>p<\/mi><mo>=<\/mo><mn>0.288<\/mn><\/mrow><annotation encoding=\"application\/x-tex\">\\text{Estimate} = 0.0287, \\text{SE} = 0.0270, z = 1.06, p = 0.288<\/annotation><\/semantics><\/math>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Because gender did not significantly change the deviance or improve model fit, it was dropped to establish our core baseline model.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Model 2: Core Baseline Model<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The baseline model controls for key demographics, severity, admitting specialty, and time in hospital:<\/p>\n\n\n<div class=\"wp-block-code\">\n\t<div class=\"cm-editor\">\n\t\t<div class=\"cm-scroller\">\n\t\t\t\n<pre>\n<code class=\"language-r\"><div class=\"cm-line\"><span class=\"tok-comment\"># Model 2 syntax in R<\/span><\/div><div class=\"cm-line\"><span class=\"tok-variableName\">core_model<\/span> <span class=\"tok-operator\">&lt;-<\/span> <span class=\"tok-variableName\">glm<\/span>(<\/div><div class=\"cm-line\">  <span class=\"tok-variableName\">readmitted_30<\/span> <span class=\"tok-operator\">~<\/span> <span class=\"tok-variableName\">age_group<\/span> <span class=\"tok-operator\">+<\/span> <span class=\"tok-variableName\">race_group<\/span> <span class=\"tok-operator\">+<\/span> <span class=\"tok-variableName\">admission_source<\/span> <span class=\"tok-operator\">+<\/span> <\/div><div class=\"cm-line\">    <span class=\"tok-variableName\">discharge_disposition<\/span> <span class=\"tok-operator\">+<\/span> <span class=\"tok-variableName\">primary_diagnosis<\/span> <span class=\"tok-operator\">+<\/span> <span class=\"tok-variableName\">medical_specialty_group<\/span> <span class=\"tok-operator\">+<\/span> <span class=\"tok-variableName\">time_in_hospital<\/span>,<\/div><div class=\"cm-line\">  <span class=\"tok-variableName\">data<\/span> <span class=\"tok-operator\">=<\/span> <span class=\"tok-variableName\">df_clean<\/span>,<\/div><div class=\"cm-line\">  <span class=\"tok-variableName\">family<\/span> <span class=\"tok-operator\">=<\/span> <span class=\"tok-variableName\">binomial<\/span>(<span class=\"tok-variableName\">link<\/span> <span class=\"tok-operator\">=<\/span> <span class=\"tok-string\">&quot;logit&quot;<\/span>)<\/div><div class=\"cm-line\">)<\/div><\/code><\/pre>\n\t\t<\/div>\n\t<\/div>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\">Partial Results from Model 2<\/h2>\n\n\n\n<div class=\"wp-block-jetpack-markdown\"><table>\n<thead>\n<tr>\n<th style=\"text-align:left\">Predictor Group<\/th>\n<th style=\"text-align:left\">Reference<\/th>\n<th style=\"text-align:left\">Replicated Estimate<\/th>\n<th style=\"text-align:left\">Std. Error<\/th>\n<th style=\"text-align:left\">z-value<\/th>\n<th style=\"text-align:left\">p-value<\/th>\n<th style=\"text-align:left\">Odds Ratio<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align:left\"><strong>Intercept<\/strong><\/td>\n<td style=\"text-align:left\">\u2014<\/td>\n<td style=\"text-align:left\">-2.8944<\/td>\n<td style=\"text-align:left\">0.0876<\/td>\n<td style=\"text-align:left\">-33.04<\/td>\n<td style=\"text-align:left\">&lt; 0.001<\/td>\n<td style=\"text-align:left\">0.055<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:left\"><strong>Age: Over 60<\/strong><\/td>\n<td style=\"text-align:left\"><code>[30, 60)<\/code><\/td>\n<td style=\"text-align:left\">0.2045<\/td>\n<td style=\"text-align:left\">0.0319<\/td>\n<td style=\"text-align:left\">6.41<\/td>\n<td style=\"text-align:left\">&lt; 0.001<\/td>\n<td style=\"text-align:left\">1.227<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:left\"><strong>Discharge: Other<\/strong><\/td>\n<td style=\"text-align:left\"><code>Home<\/code><\/td>\n<td style=\"text-align:left\">0.5406<\/td>\n<td style=\"text-align:left\">0.0292<\/td>\n<td style=\"text-align:left\">18.49<\/td>\n<td style=\"text-align:left\">&lt; 0.001<\/td>\n<td style=\"text-align:left\">1.717<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:left\"><strong>Diag: Respiratory<\/strong><\/td>\n<td style=\"text-align:left\"><code>Diabetes<\/code><\/td>\n<td style=\"text-align:left\">-0.2830<\/td>\n<td style=\"text-align:left\">0.0623<\/td>\n<td style=\"text-align:left\">-4.54<\/td>\n<td style=\"text-align:left\">&lt; 0.001<\/td>\n<td style=\"text-align:left\">0.753<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:left\"><strong>Time in Hospital<\/strong><\/td>\n<td style=\"text-align:left\">Continuous<\/td>\n<td style=\"text-align:left\">0.0309<\/td>\n<td style=\"text-align:left\">0.0045<\/td>\n<td style=\"text-align:left\">6.87<\/td>\n<td style=\"text-align:left\">&lt; 0.001<\/td>\n<td style=\"text-align:left\">1.031<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Model 3: Core Baseline + HbA1c (Main Effect)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Model 3 builds on Model 2 by adding the <code>hba1c_group<\/code> predictor. The <code>Not measured<\/code> category serves as the reference baseline, comparing it against the other three HbA1c measurement\/medication change groups: <code>Normal<\/code>, <code>High, changed<\/code>, and <code>High, not changed<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I performed an Analysis of Deviance (likelihood ratio test) to evaluate if adding <code>hba1c_group<\/code> significantly improves the overall model fit:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Comparison: Core Model vs. Core + HbA1c<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Simpler Model<\/strong>: Model 2 (Core predictors)<\/li>\n\n\n\n<li><strong>Complex Model<\/strong>: Model 3 (Core predictors + <code>hba1c_group<\/code>)<\/li>\n<\/ul>\n\n\n\n<div class=\"wp-block-jetpack-markdown\"><table>\n<thead>\n<tr>\n<th style=\"text-align:left\">Model<\/th>\n<th style=\"text-align:left\">Resid. Df<\/th>\n<th style=\"text-align:left\">Resid. Dev<\/th>\n<th style=\"text-align:left\">Df Diff<\/th>\n<th style=\"text-align:left\">Deviance Drop<\/th>\n<th style=\"text-align:left\">p-value (Pr(&gt;Chi))<\/th>\n<th style=\"text-align:left\">Significance<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align:left\"><strong>A Core Model<\/strong><\/td>\n<td style=\"text-align:left\">69,964<\/td>\n<td style=\"text-align:left\">41,482<\/td>\n<td style=\"text-align:left\">\u2014<\/td>\n<td style=\"text-align:left\">\u2014<\/td>\n<td style=\"text-align:left\">\u2014<\/td>\n<td style=\"text-align:left\">\u2014<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:left\"><strong>B Core + HbA1c<\/strong><\/td>\n<td style=\"text-align:left\">69,961<\/td>\n<td style=\"text-align:left\">41,474<\/td>\n<td style=\"text-align:left\">3<\/td>\n<td style=\"text-align:left\"><strong>8.6377<\/strong><\/td>\n<td style=\"text-align:left\"><strong>0.03452<\/strong><\/td>\n<td style=\"text-align:left\"><code>*<\/code> ($p &lt; 0.05$)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Conclusion<\/strong>: Adding the main effect of <code>hba1c_group<\/code> significantly improved the fit over the core model (<math data-latex=\"p = 0.0345^*\"><semantics><mrow><mi>p<\/mi><mo>=<\/mo><msup><mn>0.0345<\/mn><mo>\u2217<\/mo><\/msup><\/mrow><annotation encoding=\"application\/x-tex\">p = 0.0345^*<\/annotation><\/semantics><\/math>), showing that HbA1c measurement is globally associated with lower readmission risk.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Model 4: Core Baseline + Significant Interactions (without HbA1c)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To account for complex interdependencies among patient characteristics, Model 4 introduces significant pairwise interaction terms between baseline covariates.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Relationship Selection for Interactions<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">With 7 baseline variable groups in the core model, there are 21 possible pairwise combinations. The researchers selected only 7 specific interaction pairs based on clinical hypotheses and statistical significance using likelihood ratio tests (Analysis of Deviance).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Our replication validates this selection, showing high fidelity to the paper&#8217;s original findings:<\/p>\n\n\n\n<div class=\"wp-block-jetpack-markdown\"><table>\n<thead>\n<tr>\n<th style=\"text-align:left\">Interaction Pair<\/th>\n<th style=\"text-align:left\">Stated $p$-value (Paper)<\/th>\n<th style=\"text-align:left\">Replicated $p$-value (Cohort)<\/th>\n<th style=\"text-align:left\">Df<\/th>\n<th style=\"text-align:left\">Significant in Paper ($p &lt; 0.01$)?<\/th>\n<th style=\"text-align:left\">Significant in Replication ($p &lt; 0.01$)?<\/th>\n<th style=\"text-align:left\">Status \/ Practical Interpretation<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align:left\"><strong><code>primary_diagnosis * time_in_hospital<\/code><\/strong><\/td>\n<td style=\"text-align:left\">$P &lt; 0.001$<\/td>\n<td style=\"text-align:left\"><strong><code>0.00006<\/code><\/strong><\/td>\n<td style=\"text-align:left\">8<\/td>\n<td style=\"text-align:left\">Yes<\/td>\n<td style=\"text-align:left\"><strong>Yes<\/strong><\/td>\n<td style=\"text-align:left\"><strong>Perfect match<\/strong>. Readmission risk over time varies significantly depending on the clinical diagnosis.<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:left\"><strong><code>discharge_disposition * primary_diagnosis<\/code><\/strong><\/td>\n<td style=\"text-align:left\">$P = 0.005$<\/td>\n<td style=\"text-align:left\"><strong><code>0.00025<\/code><\/strong><\/td>\n<td style=\"text-align:left\">8<\/td>\n<td style=\"text-align:left\">Yes<\/td>\n<td style=\"text-align:left\"><strong>Yes<\/strong><\/td>\n<td style=\"text-align:left\"><strong>Perfect match<\/strong>. The impact of discharge status (Home vs. Other) depends heavily on the primary diagnosis.<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:left\"><strong><code>age_group * medical_specialty_group<\/code><\/strong><\/td>\n<td style=\"text-align:left\">$P &lt; 0.001$<\/td>\n<td style=\"text-align:left\"><strong><code>0.00028<\/code><\/strong><\/td>\n<td style=\"text-align:left\">10<\/td>\n<td style=\"text-align:left\">Yes<\/td>\n<td style=\"text-align:left\"><strong>Yes<\/strong><\/td>\n<td style=\"text-align:left\"><strong>Perfect match<\/strong>. Patient age profile varies dramatically by the admitting physician\u2019s specialty.<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:left\"><strong><code>discharge_disposition * time_in_hospital<\/code><\/strong><\/td>\n<td style=\"text-align:left\">$P &lt; 0.001$<\/td>\n<td style=\"text-align:left\"><strong><code>0.00030<\/code><\/strong><\/td>\n<td style=\"text-align:left\">1<\/td>\n<td style=\"text-align:left\">Yes<\/td>\n<td style=\"text-align:left\"><strong>Yes<\/strong><\/td>\n<td style=\"text-align:left\"><strong>Perfect match<\/strong>. The relationship between length of stay and discharge destination is highly significant.<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:left\"><strong><code>race_group * discharge_disposition<\/code><\/strong><\/td>\n<td style=\"text-align:left\">$P &lt; 0.001$<\/td>\n<td style=\"text-align:left\"><strong><code>0.00208<\/code><\/strong><\/td>\n<td style=\"text-align:left\">3<\/td>\n<td style=\"text-align:left\">Yes<\/td>\n<td style=\"text-align:left\"><strong>Yes<\/strong><\/td>\n<td style=\"text-align:left\"><strong>Perfect match<\/strong>. Demographics interact with discharge destination patterns.<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:left\"><strong><code>discharge_disposition * medical_specialty_group<\/code><\/strong><\/td>\n<td style=\"text-align:left\">$P = 0.001$<\/td>\n<td style=\"text-align:left\"><strong><code>0.00221<\/code><\/strong><\/td>\n<td style=\"text-align:left\">5<\/td>\n<td style=\"text-align:left\">Yes<\/td>\n<td style=\"text-align:left\"><strong>Yes<\/strong><\/td>\n<td style=\"text-align:left\"><strong>Perfect match<\/strong>. Admitting specialty influences discharge patterns and associated frailty levels.<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:left\"><strong><code>medical_specialty_group * time_in_hospital<\/code><\/strong><\/td>\n<td style=\"text-align:left\">$P = 0.001$<\/td>\n<td style=\"text-align:left\"><strong><code>0.02692<\/code><\/strong><\/td>\n<td style=\"text-align:left\">5<\/td>\n<td style=\"text-align:left\">Yes<\/td>\n<td style=\"text-align:left\"><strong>No<\/strong><\/td>\n<td style=\"text-align:left\"><strong>Slight Mismatch<\/strong>. Significant at $p &lt; 0.05$, but fails the stricter $p &lt; 0.01$ threshold in our replication.<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:left\"><strong><code>primary_diagnosis * medical_specialty_group<\/code><\/strong><\/td>\n<td style=\"text-align:left\"><em>Not included<\/em><\/td>\n<td style=\"text-align:left\"><strong><code>0.00035<\/code><\/strong><\/td>\n<td style=\"text-align:left\">40<\/td>\n<td style=\"text-align:left\">No<\/td>\n<td style=\"text-align:left\"><strong>Yes<\/strong><\/td>\n<td style=\"text-align:left\"><strong>Excluded by authors<\/strong>. Although highly significant in both cohorts, including a term with <strong>40 degrees of freedom<\/strong> risks overfitting the model.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Clinical and Statistical Rationale<\/em>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Discharge Destination Interactions<\/strong>: Discharging a patient to home versus an alternative facility (rehab, nursing home, or hospice) represents very different clinical pathways and patient frailty levels. This status interacts strongly with the severity of their condition (measured by <code>time_in_hospital<\/code>), their demographic profile (<code>race_group<\/code>), and the specialty of the physician managing their care.<\/li>\n\n\n\n<li><strong>Methodological Choice of <code>anova()<\/code><\/strong>: In linear regression, ANOVA compares the Sum of Squared Errors (SSE) using the F-test. However, in R&#8217;s logistic regression framework, <code>anova(..., test=\"Chisq\")<\/code> performs an <strong>Analysis of Deviance<\/strong> (likelihood ratio test) using Chi-square distribution of the deviance drop, assessing whether the extra parameters introduced by the interaction term significantly improve model fit.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Logistic Model Setup in R<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The R syntax fits the baseline variables and the 7 selected pairwise interaction terms:<\/p>\n\n\n<div class=\"wp-block-code\">\n\t<div class=\"cm-editor\">\n\t\t<div class=\"cm-scroller\">\n\t\t\t\n<pre>\n<code class=\"language-r\"><div class=\"cm-line\"><span class=\"tok-comment\"># Model 4 setup in R<\/span><\/div><div class=\"cm-line\"><span class=\"tok-variableName\">interactions_model<\/span> <span class=\"tok-operator\">&lt;-<\/span> <span class=\"tok-variableName\">glm<\/span>(<\/div><div class=\"cm-line\">  <span class=\"tok-variableName\">readmitted_30<\/span> <span class=\"tok-operator\">~<\/span> <span class=\"tok-variableName\">age_group<\/span> <span class=\"tok-operator\">+<\/span> <span class=\"tok-variableName\">race_group<\/span> <span class=\"tok-operator\">+<\/span> <span class=\"tok-variableName\">admission_source<\/span> <span class=\"tok-operator\">+<\/span> <\/div><div class=\"cm-line\">    <span class=\"tok-variableName\">discharge_disposition<\/span> <span class=\"tok-operator\">+<\/span> <span class=\"tok-variableName\">primary_diagnosis<\/span> <span class=\"tok-operator\">+<\/span> <span class=\"tok-variableName\">medical_specialty_group<\/span> <span class=\"tok-operator\">+<\/span> <span class=\"tok-variableName\">time_in_hospital<\/span> <span class=\"tok-operator\">+<\/span><\/div><div class=\"cm-line\">    <span class=\"tok-variableName\">discharge_disposition<\/span><span class=\"tok-operator\">:<\/span><span class=\"tok-variableName\">race_group<\/span> <span class=\"tok-operator\">+<\/span> <\/div><div class=\"cm-line\">    <span class=\"tok-variableName\">discharge_disposition<\/span><span class=\"tok-operator\">:<\/span><span class=\"tok-variableName\">medical_specialty_group<\/span> <span class=\"tok-operator\">+<\/span> <\/div><div class=\"cm-line\">    <span class=\"tok-variableName\">discharge_disposition<\/span><span class=\"tok-operator\">:<\/span><span class=\"tok-variableName\">primary_diagnosis<\/span> <span class=\"tok-operator\">+<\/span> <\/div><div class=\"cm-line\">    <span class=\"tok-variableName\">discharge_disposition<\/span><span class=\"tok-operator\">:<\/span><span class=\"tok-variableName\">time_in_hospital<\/span> <span class=\"tok-operator\">+<\/span> <\/div><div class=\"cm-line\">    <span class=\"tok-variableName\">medical_specialty_group<\/span><span class=\"tok-operator\">:<\/span><span class=\"tok-variableName\">time_in_hospital<\/span> <span class=\"tok-operator\">+<\/span> <\/div><div class=\"cm-line\">    <span class=\"tok-variableName\">medical_specialty_group<\/span><span class=\"tok-operator\">:<\/span><span class=\"tok-variableName\">age_group<\/span> <span class=\"tok-operator\">+<\/span> <\/div><div class=\"cm-line\">    <span class=\"tok-variableName\">primary_diagnosis<\/span><span class=\"tok-operator\">:<\/span><span class=\"tok-variableName\">time_in_hospital<\/span>,<\/div><div class=\"cm-line\">  <span class=\"tok-variableName\">data<\/span> <span class=\"tok-operator\">=<\/span> <span class=\"tok-variableName\">df_clean<\/span>,<\/div><div class=\"cm-line\">  <span class=\"tok-variableName\">family<\/span> <span class=\"tok-operator\">=<\/span> <span class=\"tok-variableName\">binomial<\/span>(<span class=\"tok-variableName\">link<\/span> <span class=\"tok-operator\">=<\/span> <span class=\"tok-string\">&quot;logit&quot;<\/span>)<\/div><div class=\"cm-line\">)<\/div><\/code><\/pre>\n\t\t<\/div>\n\t<\/div>\n<\/div>\n\n\n<h3 class=\"wp-block-heading\">Model 4 Fit &amp; Quality Summary<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Model 4 results in a substantial improvement in fit compared to the core baseline models:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Null Deviance<\/strong>: 42,283 (on 69,986 DF)<\/li>\n\n\n\n<li><strong>Residual Deviance<\/strong>: 41,331 (on 69,924 DF) \u2014 a deviance drop of <strong>151<\/strong> compared to Model 2.<\/li>\n\n\n\n<li><strong>AIC<\/strong>: 41,457 \u2014 a decrease from Model 2 (41,528) and Model 3 (41,526), confirming that the added complexity of these interactions is statistically justified.<\/li>\n\n\n\n<li><strong>Fisher Iterations<\/strong>: 5 (converged successfully).<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Model 5: The Final Model (Interactions + HbA1c)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Model 5 (Final Model) builds on Model 4 by re-introducing the main effect of <code>hba1c_group<\/code> along with the crucial interaction between the patient&#8217;s primary diagnosis and their HbA1c measurement: <code>primary_diagnosis * hba1c_group<\/code>.<\/p>\n\n\n<div class=\"wp-block-code\">\n\t<div class=\"cm-editor\">\n\t\t<div class=\"cm-scroller\">\n\t\t\t\n<pre>\n<code class=\"language-r\"><div class=\"cm-line\"><span class=\"tok-comment\"># Model 5 (Final Model) setup in R<\/span><\/div><div class=\"cm-line\"><span class=\"tok-variableName\">final_model<\/span> <span class=\"tok-operator\">&lt;-<\/span> <span class=\"tok-variableName\">glm<\/span>(<\/div><div class=\"cm-line\">  <span class=\"tok-variableName\">readmitted_30<\/span> <span class=\"tok-operator\">~<\/span> <span class=\"tok-variableName\">age_group<\/span> <span class=\"tok-operator\">+<\/span> <span class=\"tok-variableName\">race_group<\/span> <span class=\"tok-operator\">+<\/span> <span class=\"tok-variableName\">admission_source<\/span> <span class=\"tok-operator\">+<\/span> <\/div><div class=\"cm-line\">    <span class=\"tok-variableName\">discharge_disposition<\/span> <span class=\"tok-operator\">+<\/span> <span class=\"tok-variableName\">primary_diagnosis<\/span> <span class=\"tok-operator\">+<\/span> <span class=\"tok-variableName\">medical_specialty_group<\/span> <span class=\"tok-operator\">+<\/span> <span class=\"tok-variableName\">time_in_hospital<\/span> <span class=\"tok-operator\">+<\/span><\/div><div class=\"cm-line\">    <span class=\"tok-variableName\">hba1c_group<\/span> <span class=\"tok-operator\">+<\/span><\/div><div class=\"cm-line\">    <span class=\"tok-variableName\">discharge_disposition<\/span><span class=\"tok-operator\">:<\/span><span class=\"tok-variableName\">race_group<\/span> <span class=\"tok-operator\">+<\/span> <\/div><div class=\"cm-line\">    <span class=\"tok-variableName\">discharge_disposition<\/span><span class=\"tok-operator\">:<\/span><span class=\"tok-variableName\">medical_specialty_group<\/span> <span class=\"tok-operator\">+<\/span> <\/div><div class=\"cm-line\">    <span class=\"tok-variableName\">discharge_disposition<\/span><span class=\"tok-operator\">:<\/span><span class=\"tok-variableName\">primary_diagnosis<\/span> <span class=\"tok-operator\">+<\/span> <\/div><div class=\"cm-line\">    <span class=\"tok-variableName\">discharge_disposition<\/span><span class=\"tok-operator\">:<\/span><span class=\"tok-variableName\">time_in_hospital<\/span> <span class=\"tok-operator\">+<\/span> <\/div><div class=\"cm-line\">    <span class=\"tok-variableName\">medical_specialty_group<\/span><span class=\"tok-operator\">:<\/span><span class=\"tok-variableName\">time_in_hospital<\/span> <span class=\"tok-operator\">+<\/span> <\/div><div class=\"cm-line\">    <span class=\"tok-variableName\">medical_specialty_group<\/span><span class=\"tok-operator\">:<\/span><span class=\"tok-variableName\">age_group<\/span> <span class=\"tok-operator\">+<\/span> <\/div><div class=\"cm-line\">    <span class=\"tok-variableName\">primary_diagnosis<\/span><span class=\"tok-operator\">:<\/span><span class=\"tok-variableName\">time_in_hospital<\/span> <span class=\"tok-operator\">+<\/span><\/div><div class=\"cm-line\">    <span class=\"tok-variableName\">primary_diagnosis<\/span><span class=\"tok-operator\">:<\/span><span class=\"tok-variableName\">hba1c_group<\/span>,<\/div><div class=\"cm-line\">  <span class=\"tok-variableName\">data<\/span> <span class=\"tok-operator\">=<\/span> <span class=\"tok-variableName\">df_clean<\/span>,<\/div><div class=\"cm-line\">  <span class=\"tok-variableName\">family<\/span> <span class=\"tok-operator\">=<\/span> <span class=\"tok-variableName\">binomial<\/span>(<span class=\"tok-variableName\">link<\/span> <span class=\"tok-operator\">=<\/span> <span class=\"tok-string\">&quot;logit&quot;<\/span>)<\/div><div class=\"cm-line\">)<\/div><\/code><\/pre>\n\t\t<\/div>\n\t<\/div>\n<\/div>\n\n\n<h3 class=\"wp-block-heading\">Nested Model Comparison and Analysis of Deviance<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">An <strong>Analysis of Deviance<\/strong> (likelihood ratio test using R&#8217;s <code>anova()<\/code>) confirms the progressive improvements in fit, validating that both the baseline interactions and the HbA1c-specific interactions are statistically warranted:<\/p>\n\n\n\n<div class=\"wp-block-jetpack-markdown\"><table>\n<thead>\n<tr>\n<th style=\"text-align:left\">Model Comparison<\/th>\n<th style=\"text-align:left\">Resid. Df<\/th>\n<th style=\"text-align:left\">Resid. Dev<\/th>\n<th style=\"text-align:left\">Df Diff<\/th>\n<th style=\"text-align:left\">Deviance Drop<\/th>\n<th style=\"text-align:left\">$p$-value ($Pr(&gt;\\chi^2)$)<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align:left\"><strong>1. Core Baseline (Model 2)<\/strong><\/td>\n<td style=\"text-align:left\">69,964<\/td>\n<td style=\"text-align:left\">41,482<\/td>\n<td style=\"text-align:left\">\u2014<\/td>\n<td style=\"text-align:left\">\u2014<\/td>\n<td style=\"text-align:left\">\u2014<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:left\"><strong>2. Core + HbA1c (Model 3)<\/strong> (vs. Model 2)<\/td>\n<td style=\"text-align:left\">69,961<\/td>\n<td style=\"text-align:left\">41,474<\/td>\n<td style=\"text-align:left\">3<\/td>\n<td style=\"text-align:left\"><strong>8.64<\/strong><\/td>\n<td style=\"text-align:left\"><strong>0.0345<\/strong> <code>*<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:left\"><strong>3. Baseline + Interactions (Model 4)<\/strong> (vs. Model 2)<\/td>\n<td style=\"text-align:left\">69,924<\/td>\n<td style=\"text-align:left\">41,331<\/td>\n<td style=\"text-align:left\">40<\/td>\n<td style=\"text-align:left\"><strong>151.00<\/strong><\/td>\n<td style=\"text-align:left\"><strong>&lt; 0.001<\/strong> <code>***<\/code><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:left\"><strong>4. Final Model with HbA1c Interactions (Model 5)<\/strong> (vs. Model 4)<\/td>\n<td style=\"text-align:left\">69,897<\/td>\n<td style=\"text-align:left\">41,279<\/td>\n<td style=\"text-align:left\">27<\/td>\n<td style=\"text-align:left\"><strong>51.91<\/strong><\/td>\n<td style=\"text-align:left\"><strong>0.0027<\/strong> <code>**<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Model Summary<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Model 5 is the final specification. It excludes the non-significant <code>gender<\/code> variable while incorporating baseline covariates, the main effect of <code>hba1c_group<\/code>, significant baseline interactions, and the primary diagnosis-to-HbA1c interaction terms. It represents the best-fitting, statistically validated model in our nested sequence.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Data Visualization &amp; Critique<\/h1>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"607\" data-attachment-id=\"675\" data-permalink=\"https:\/\/medytic.blog\/en\/2026\/06\/09\/replicating-and-modernizing-clinical-data-science-a-deep-dive-into-hba1c-screening-and-hospital-readmissions\/screenshot-2026-06-08-140729\/\" data-orig-file=\"https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/Screenshot-2026-06-08-140729.png?fit=1066%2C632&amp;ssl=1\" data-orig-size=\"1066,632\" data-comments-opened=\"1\" data-image-title=\"Screenshot 2026-06-08 140729\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/Screenshot-2026-06-08-140729.png?fit=1024%2C607&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/Screenshot-2026-06-08-140729.png?resize=1024%2C607&#038;ssl=1\" alt=\"\" class=\"wp-image-675\" srcset=\"https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/Screenshot-2026-06-08-140729.png?resize=1024%2C607&amp;ssl=1 1024w, https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/Screenshot-2026-06-08-140729.png?resize=300%2C178&amp;ssl=1 300w, https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/Screenshot-2026-06-08-140729.png?resize=768%2C455&amp;ssl=1 768w, https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/Screenshot-2026-06-08-140729.png?w=1066&amp;ssl=1 1066w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"366\" data-attachment-id=\"676\" data-permalink=\"https:\/\/medytic.blog\/en\/2026\/06\/09\/replicating-and-modernizing-clinical-data-science-a-deep-dive-into-hba1c-screening-and-hospital-readmissions\/screenshot-2026-06-08-140909\/\" data-orig-file=\"https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/Screenshot-2026-06-08-140909.png?fit=1798%2C642&amp;ssl=1\" data-orig-size=\"1798,642\" data-comments-opened=\"1\" data-image-title=\"Screenshot 2026-06-08 140909\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/Screenshot-2026-06-08-140909.png?fit=1024%2C366&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/Screenshot-2026-06-08-140909.png?resize=1024%2C366&#038;ssl=1\" alt=\"\" class=\"wp-image-676\" srcset=\"https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/Screenshot-2026-06-08-140909.png?resize=1024%2C366&amp;ssl=1 1024w, https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/Screenshot-2026-06-08-140909.png?resize=300%2C107&amp;ssl=1 300w, https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/Screenshot-2026-06-08-140909.png?resize=768%2C274&amp;ssl=1 768w, https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/Screenshot-2026-06-08-140909.png?resize=1536%2C548&amp;ssl=1 1536w, https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/Screenshot-2026-06-08-140909.png?w=1798&amp;ssl=1 1798w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Critique of Stated Probability Plots (Figures 1 and 3)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The original paper presented readmission probabilities across HbA1c groups for selected diagnoses across separate plots:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Figure 1<\/strong>: Focus exclusively on the 3 most prevalent and statistically significant from three-degree-of-freedom (3-df) tests: primary diagnoses Diabetes, Circulatory, Respiratory (Y-axis: <code>0.02 to 0.11<\/code>).<\/li>\n\n\n\n<li><strong>Figure 3<\/strong>: displays predicted readmission probabilities for all 9 primary diagnosis categories in the study, split across two panels.<\/li>\n\n\n\n<li><strong>Figure 3a<\/strong>: Diabetes, Other, Digestive, Respiratory, Circulatory (Y-axis: <code>0.00 to 0.12<\/code>).<\/li>\n\n\n\n<li><strong>Figure 3b<\/strong>: Diabetes, Genitourinary, Injury, Musculoskeletal, Neoplasms (Y-axis: <code>0.00 to 0.25<\/code>).<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Problems with this visualization<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This layout creates visual scale distortions. Because the Y-axes have different ranges, the slope of the <em>same<\/em> baseline curve (Diabetes) looks much steeper in Figure 1 than in Figure 3b, misleading readers about the relative effect sizes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The Modernized Faceted Forest Plot<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To resolve these visual scaling issues, I developed a faceted forest plot of <strong>Odds Ratios (OR)<\/strong> compared directly to the untested reference group (<code>Not measured<\/code>) within each diagnosis:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"838\" data-attachment-id=\"646\" data-permalink=\"https:\/\/medytic.blog\/en\/2026\/06\/09\/replicating-and-modernizing-clinical-data-science-a-deep-dive-into-hba1c-screening-and-hospital-readmissions\/figure_odds_ratios_faceted\/\" data-orig-file=\"https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/figure_odds_ratios_faceted.png?fit=3300%2C2700&amp;ssl=1\" data-orig-size=\"3300,2700\" data-comments-opened=\"1\" data-image-title=\"figure_odds_ratios_faceted\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/figure_odds_ratios_faceted.png?fit=1024%2C838&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/figure_odds_ratios_faceted.png?resize=1024%2C838&#038;ssl=1\" alt=\"\" class=\"wp-image-646\" srcset=\"https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/figure_odds_ratios_faceted.png?resize=1024%2C838&amp;ssl=1 1024w, https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/figure_odds_ratios_faceted.png?resize=300%2C245&amp;ssl=1 300w, https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/figure_odds_ratios_faceted.png?resize=768%2C628&amp;ssl=1 768w, https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/figure_odds_ratios_faceted.png?resize=1536%2C1257&amp;ssl=1 1536w, https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/figure_odds_ratios_faceted.png?resize=2048%2C1676&amp;ssl=1 2048w, https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/figure_odds_ratios_faceted.png?w=3000&amp;ssl=1 3000w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Dynamic Global &amp; Individual Testing<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Global 3-df Wald test p-values<\/strong> are calculated using <code>car::linearHypothesis()<\/code> and printed in the facet headers.<\/li>\n\n\n\n<li><strong>Significant panels<\/strong> (p &lt; 0.05) are painted <strong>Blue<\/strong>, while non-significant ones are <strong>Grey<\/strong>.<\/li>\n\n\n\n<li><strong>Individual category significance stars<\/strong> are plotted directly above the points.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Technical Insight: Understanding the Global 3-df Wald Test<\/strong><br>When evaluating multi-categorical variables like <code>hba1c_group<\/code> (which has 4 levels: <code>Not measured<\/code> as reference, <code>Normal<\/code>, <code>High, changed<\/code>, and <code>High, not changed<\/code>), checking individual category p-values separately increases the risk of Type I error (false positives). To resolve this, we use a <strong>joint hypothesis test<\/strong>\u2014the Wald test\u2014to evaluate if the variable has a significant effect globally.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Why 3 Degrees of Freedom (3-df)?<\/strong>: Since <code>hba1c_group<\/code> has 4 levels, the regression model estimates 3 distinct dummy coefficients. The Wald test jointly tests the null hypothesis that all 3 coefficients are simultaneously zero <math data-latex=\"H_0: \\beta_{\\text{Normal}} = \\beta_{\\text{High, changed}} = \\beta_{\\text{High, not changed}} = 0\"><semantics><mrow><msub><mi>H<\/mi><mn>0<\/mn><\/msub><mo lspace=\"0.2222em\" rspace=\"0.2222em\">:<\/mo><msub><mi>\u03b2<\/mi><mtext>Normal<\/mtext><\/msub><mo>=<\/mo><msub><mi>\u03b2<\/mi><mtext>High,&nbsp;changed<\/mtext><\/msub><mo>=<\/mo><msub><mi>\u03b2<\/mi><mtext>High,&nbsp;not&nbsp;changed<\/mtext><\/msub><mo>=<\/mo><mn>0<\/mn><\/mrow><annotation encoding=\"application\/x-tex\">H_0: \\beta_{\\text{Normal}} = \\beta_{\\text{High, changed}} = \\beta_{\\text{High, not changed}} = 0<\/annotation><\/semantics><\/math>. Testing these 3 independent parameters yields a test statistic that follows a Chi-square distribution with exactly <strong>3 degrees of freedom<\/strong>.<\/li>\n\n\n\n<li><strong>Testing Subgroup Interactions<\/strong>: For non-baseline diagnoses (e.g., Circulatory), the Wald test evaluates whether the 3 diagnosis-specific interaction terms:<br><math data-latex=\"\\beta_{\\text{Normal} \\times \\text{Diag}}\"><semantics><msub><mi>\u03b2<\/mi><mrow><mtext>Normal<\/mtext><mo>\u00d7<\/mo><mtext>Diag<\/mtext><\/mrow><\/msub><annotation encoding=\"application\/x-tex\">\\beta_{\\text{Normal} \\times \\text{Diag}}<\/annotation><\/semantics><\/math><br><math data-latex=\"\\beta_{\\text{High, changed} \\times \\text{Diag}}\"><semantics><msub><mi>\u03b2<\/mi><mrow><mtext>High,&nbsp;changed<\/mtext><mo>\u00d7<\/mo><mtext>Diag<\/mtext><\/mrow><\/msub><annotation encoding=\"application\/x-tex\">\\beta_{\\text{High, changed} \\times \\text{Diag}}<\/annotation><\/semantics><\/math> <br><math data-latex=\"\\beta_{\\text{High, not changed} \\times \\text{Diag}}\"><semantics><msub><mi>\u03b2<\/mi><mrow><mtext>High,&nbsp;not&nbsp;changed<\/mtext><mo>\u00d7<\/mo><mtext>Diag<\/mtext><\/mrow><\/msub><annotation encoding=\"application\/x-tex\">\\beta_{\\text{High, not changed} \\times \\text{Diag}}<\/annotation><\/semantics><\/math><br>They are simultaneously zero. This verifies whether the HbA1c effect for that particular diagnosis is statistically different from the baseline Diabetes group.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Technical Insight: Standard Error Calculation with Covariance Matrix<\/strong><br>Because of the primary diagnosis $\\times$ HbA1c interaction terms in the final model, the log-Odds Ratio for non-reference diagnoses is a linear combination of coefficients: <math data-latex=\"\\beta_{\\text{HbA1c}} + \\beta_{\\text{HbA1c} \\times \\text{Diagnosis}}\"><semantics><mrow><msub><mi>\u03b2<\/mi><mtext>HbA1c<\/mtext><\/msub><mo>+<\/mo><msub><mi>\u03b2<\/mi><mrow><mtext>HbA1c<\/mtext><mo>\u00d7<\/mo><mtext>Diagnosis<\/mtext><\/mrow><\/msub><\/mrow><annotation encoding=\"application\/x-tex\">\\beta_{\\text{HbA1c}} + \\beta_{\\text{HbA1c} \\times \\text{Diagnosis}}<\/annotation><\/semantics><\/math>. I calculate the standard error utilizing the covariance matrix:<\/p>\n\n\n<div class=\"wp-block-code\">\n\t<div class=\"cm-editor\">\n\t\t<div class=\"cm-scroller\">\n\t\t\t\n<pre>\n<code class=\"language-r\"><div class=\"cm-line\"><span class=\"tok-comment\"># Covariance-based standard error calculation in R (visualization_improved.R)<\/span><\/div><div class=\"cm-line\"><span class=\"tok-variableName\">log_or<\/span> <span class=\"tok-operator\">&lt;-<\/span> <span class=\"tok-variableName\">coefs<\/span>[<span class=\"tok-variableName\">coef_hba1c<\/span>] <span class=\"tok-operator\">+<\/span> <span class=\"tok-variableName\">coefs<\/span>[<span class=\"tok-variableName\">coef_interaction<\/span>]<\/div><div class=\"cm-line\"><\/div><div class=\"cm-line\"><span class=\"tok-comment\"># Var(A + B) = Var(A) + Var(B) + 2 * Cov(A, B)<\/span><\/div><div class=\"cm-line\"><span class=\"tok-variableName\">var_log_or<\/span> <span class=\"tok-operator\">&lt;-<\/span> <span class=\"tok-variableName\">vc_mat<\/span>[<span class=\"tok-variableName\">coef_hba1c<\/span>, <span class=\"tok-variableName\">coef_hba1c<\/span>] <span class=\"tok-operator\">+<\/span> <\/div><div class=\"cm-line\">              <span class=\"tok-variableName\">vc_mat<\/span>[<span class=\"tok-variableName\">coef_interaction<\/span>, <span class=\"tok-variableName\">coef_interaction<\/span>] <span class=\"tok-operator\">+<\/span> <\/div><div class=\"cm-line\">              <span class=\"tok-number\">2<\/span> <span class=\"tok-operator\">*<\/span> <span class=\"tok-variableName\">vc_mat<\/span>[<span class=\"tok-variableName\">coef_hba1c<\/span>, <span class=\"tok-variableName\">coef_interaction<\/span>]<\/div><div class=\"cm-line\"><\/div><div class=\"cm-line\"><span class=\"tok-variableName\">se_log_or<\/span> <span class=\"tok-operator\">&lt;-<\/span> <span class=\"tok-variableName\">sqrt<\/span>(<span class=\"tok-variableName\">var_log_or<\/span>)<\/div><div class=\"cm-line\"><span class=\"tok-variableName\">odds_ratio<\/span> <span class=\"tok-operator\">&lt;-<\/span> <span class=\"tok-variableName\">exp<\/span>(<span class=\"tok-variableName\">log_or<\/span>)<\/div><div class=\"cm-line\"><span class=\"tok-variableName\">ci_lower<\/span> <span class=\"tok-operator\">&lt;-<\/span> <span class=\"tok-variableName\">exp<\/span>(<span class=\"tok-variableName\">log_or<\/span> <span class=\"tok-operator\">-<\/span> <span class=\"tok-number\">1.96<\/span> <span class=\"tok-operator\">*<\/span> <span class=\"tok-variableName\">se_log_or<\/span>)<\/div><div class=\"cm-line\"><span class=\"tok-variableName\">ci_upper<\/span> <span class=\"tok-operator\">&lt;-<\/span> <span class=\"tok-variableName\">exp<\/span>(<span class=\"tok-variableName\">log_or<\/span> <span class=\"tok-operator\">+<\/span> <span class=\"tok-number\">1.96<\/span> <span class=\"tok-operator\">*<\/span> <span class=\"tok-variableName\">se_log_or<\/span>)<\/div><div class=\"cm-line\"><\/div><div class=\"cm-line\"><span class=\"tok-comment\"># Individual two-tailed p-value<\/span><\/div><div class=\"cm-line\"><span class=\"tok-variableName\">indiv_p<\/span> <span class=\"tok-operator\">&lt;-<\/span> <span class=\"tok-number\">2<\/span> <span class=\"tok-operator\">*<\/span> <span class=\"tok-variableName\">pnorm<\/span>(<span class=\"tok-operator\">-<\/span><span class=\"tok-variableName\">abs<\/span>(<span class=\"tok-variableName\">log_or<\/span> <span class=\"tok-operator\">\/<\/span> <span class=\"tok-variableName\">se_log_or<\/span>))<\/div><\/code><\/pre>\n\t\t<\/div>\n\t<\/div>\n<\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Findings &amp; The Statistical Paradox<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">My modernized forest plot uncovers a fascinating statistical paradox: <strong>global interaction significance does not always align with individual category significance.<\/strong><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. The Circulatory Paradox (Globally Significant, Individually Non-Significant)<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Global Test<\/strong>: <math data-latex=\"\\chi^2(3) = 14.26, p = 0.0026^{**}\"><semantics><mrow><msup><mi>\u03c7<\/mi><mn>2<\/mn><\/msup><mo form=\"prefix\" stretchy=\"false\">(<\/mo><mn>3<\/mn><mo form=\"postfix\" stretchy=\"false\">)<\/mo><mo>=<\/mo><mn>14.26<\/mn><mo separator=\"true\">,<\/mo><mi>p<\/mi><mo>=<\/mo><msup><mn>0.0026<\/mn><mrow><mo lspace=\"0em\" rspace=\"0em\">\u2217<\/mo><mo form=\"prefix\" stretchy=\"false\" lspace=\"0em\" rspace=\"0em\">\u2217<\/mo><\/mrow><\/msup><\/mrow><annotation encoding=\"application\/x-tex\">\\chi^2(3) = 14.26, p = 0.0026^{**}<\/annotation><\/semantics><\/math>(Blue Panel)<\/li>\n\n\n\n<li><strong>Individual Odds Ratios<\/strong>:<\/li>\n\n\n\n<li>High, changed: <math data-latex=\"\\text{OR} = 1.16, p = 0.116\"><semantics><mrow><mtext>OR<\/mtext><mo>=<\/mo><mn>1.16<\/mn><mo separator=\"true\">,<\/mo><mi>p<\/mi><mo>=<\/mo><mn>0.116<\/mn><\/mrow><annotation encoding=\"application\/x-tex\">\\text{OR} = 1.16, p = 0.116<\/annotation><\/semantics><\/math><\/li>\n\n\n\n<li>High, not changed: <math data-latex=\"\\text{OR} = 0.99, p = 0.946\"><semantics><mrow><mtext>OR<\/mtext><mo>=<\/mo><mn>0.99<\/mn><mo separator=\"true\">,<\/mo><mi>p<\/mi><mo>=<\/mo><mn>0.946<\/mn><\/mrow><annotation encoding=\"application\/x-tex\">\\text{OR} = 0.99, p = 0.946<\/annotation><\/semantics><\/math><\/li>\n\n\n\n<li>Normal: <math data-latex=\"\\text{OR} = 0.96, p = 0.550\"><semantics><mrow><mtext>OR<\/mtext><mo>=<\/mo><mn>0.96<\/mn><mo separator=\"true\">,<\/mo><mi>p<\/mi><mo>=<\/mo><mn>0.550<\/mn><\/mrow><annotation encoding=\"application\/x-tex\">\\text{OR} = 0.96, p = 0.550<\/annotation><\/semantics><\/math><\/li>\n\n\n\n<li><strong>The Paradox<\/strong>: Even though Circulatory is globally significant, <strong>not a single individual HbA1c category is statistically different from the untested reference group<\/strong> (all 95% CIs cross 1.0). The global significance is driven entirely by the comparison to the Diabetes baseline: Circulatory patients&#8217; readmission risk trends <em>upward<\/em> for high HbA1c, while Diabetes trends <em>downward<\/em>.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">2. The Injury Discovery (Globally Non-Significant, Individually Significant)<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Global Test<\/strong>: <math data-latex=\"\\chi^2(3) = 5.94, p = 0.1148\"><semantics><mrow><msup><mi>\u03c7<\/mi><mn>2<\/mn><\/msup><mo form=\"prefix\" stretchy=\"false\">(<\/mo><mn>3<\/mn><mo form=\"postfix\" stretchy=\"false\">)<\/mo><mo>=<\/mo><mn>5.94<\/mn><mo separator=\"true\">,<\/mo><mi>p<\/mi><mo>=<\/mo><mn>0.1148<\/mn><\/mrow><annotation encoding=\"application\/x-tex\">\\chi^2(3) = 5.94, p = 0.1148<\/annotation><\/semantics><\/math> (Grey Panel)<\/li>\n\n\n\n<li><strong>Individual Category Estimates<\/strong>:<\/li>\n\n\n\n<li>Normal: <math data-latex=\"\\text{OR} = 0.55, p = 0.0051^{**}\"><semantics><mrow><mtext>OR<\/mtext><mo>=<\/mo><mn>0.55<\/mn><mo separator=\"true\">,<\/mo><mi>p<\/mi><mo>=<\/mo><msup><mn>0.0051<\/mn><mrow><mo lspace=\"0em\" rspace=\"0em\">\u2217<\/mo><mo form=\"prefix\" stretchy=\"false\" lspace=\"0em\" rspace=\"0em\">\u2217<\/mo><\/mrow><\/msup><\/mrow><annotation encoding=\"application\/x-tex\">\\text{OR} = 0.55, p = 0.0051^{**}<\/annotation><\/semantics><\/math> (Highly Significant)<\/li>\n\n\n\n<li><strong>The Story<\/strong>: Although the overall trend for Injury does not differ enough from baseline to pass global interaction significance, Injury patients who received an HbA1c test that came back <strong>Normal<\/strong> had a <strong>45% lower risk of readmission<\/strong> (<math data-latex=\"\\text{OR} = 0.55\"><semantics><mrow><mtext>OR<\/mtext><mo>=<\/mo><mn>0.55<\/mn><\/mrow><annotation encoding=\"application\/x-tex\">\\text{OR} = 0.55<\/annotation><\/semantics><\/math>) than those who were not tested.<br>The injury diagnosis group has a total of 4,649 patients, while the untested reference category (<code>Not measured<\/code>) contains 4,117 patients (88.56%). This high proportion of untested patients causes a disproportionality in the data (leaving very few tested cases), which can lead to less reliable statistical estimates for the tested subgroups. Consequently, this finding needs further investigation to confirm its validity.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">3. The Diabetes Story (Globally and Individually Significant)<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Global Test<\/strong>: <math data-latex=\"\\chi^2(3) = 12.97, p = 0.0047^{**}\"><semantics><mrow><msup><mi>\u03c7<\/mi><mn>2<\/mn><\/msup><mo form=\"prefix\" stretchy=\"false\">(<\/mo><mn>3<\/mn><mo form=\"postfix\" stretchy=\"false\">)<\/mo><mo>=<\/mo><mn>12.97<\/mn><mo separator=\"true\">,<\/mo><mi>p<\/mi><mo>=<\/mo><msup><mn>0.0047<\/mn><mrow><mo lspace=\"0em\" rspace=\"0em\">\u2217<\/mo><mo form=\"prefix\" stretchy=\"false\" lspace=\"0em\" rspace=\"0em\">\u2217<\/mo><\/mrow><\/msup><\/mrow><annotation encoding=\"application\/x-tex\">\\chi^2(3) = 12.97, p = 0.0047^{**}<\/annotation><\/semantics><\/math> (Blue Panel)<\/li>\n\n\n\n<li><strong>Individual Category Estimates<\/strong>:<\/li>\n\n\n\n<li>High, changed: <math data-latex=\"\\text{OR} = 0.67, p = 0.0048^{**}\"><semantics><mrow><mtext>OR<\/mtext><mo>=<\/mo><mn>0.67<\/mn><mo separator=\"true\">,<\/mo><mi>p<\/mi><mo>=<\/mo><msup><mn>0.0048<\/mn><mrow><mo lspace=\"0em\" rspace=\"0em\">\u2217<\/mo><mo form=\"prefix\" stretchy=\"false\" lspace=\"0em\" rspace=\"0em\">\u2217<\/mo><\/mrow><\/msup><\/mrow><annotation encoding=\"application\/x-tex\">\\text{OR} = 0.67, p = 0.0048^{**}<\/annotation><\/semantics><\/math> (Highly Significant)<\/li>\n\n\n\n<li>High, not changed: <math data-latex=\"\\text{OR} = 0.59, p = 0.0148^*\"><semantics><mrow><mtext>OR<\/mtext><mo>=<\/mo><mn>0.59<\/mn><mo separator=\"true\">,<\/mo><mi>p<\/mi><mo>=<\/mo><msup><mn>0.0148<\/mn><mo>\u2217<\/mo><\/msup><\/mrow><annotation encoding=\"application\/x-tex\">\\text{OR} = 0.59, p = 0.0148^*<\/annotation><\/semantics><\/math> (Significant)<\/li>\n\n\n\n<li>Normal: <math data-latex=\"\\text{OR} = 1.01, p = 0.944\"><semantics><mrow><mtext>OR<\/mtext><mo>=<\/mo><mn>1.01<\/mn><mo separator=\"true\">,<\/mo><mi>p<\/mi><mo>=<\/mo><mn>0.944<\/mn><\/mrow><annotation encoding=\"application\/x-tex\">\\text{OR} = 1.01, p = 0.944<\/annotation><\/semantics><\/math> (Not significant)<\/li>\n\n\n\n<li><strong>The Story<\/strong>: For primary Diabetes admissions, measuring HbA1c is associated with a significant reduction in readmissions <strong>only if the result is high<\/strong> (prompting active medication changes). Testing normal HbA1c does not change readmission rates.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">4. The Respiratory Story (Globally and Individually Significant)<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Global Test<\/strong>: <math data-latex=\"\\chi^2(3) = 9.43, p = 0.0240^*\"><semantics><mrow><msup><mi>\u03c7<\/mi><mn>2<\/mn><\/msup><mo form=\"prefix\" stretchy=\"false\">(<\/mo><mn>3<\/mn><mo form=\"postfix\" stretchy=\"false\">)<\/mo><mo>=<\/mo><mn>9.43<\/mn><mo separator=\"true\">,<\/mo><mi>p<\/mi><mo>=<\/mo><msup><mn>0.0240<\/mn><mo>\u2217<\/mo><\/msup><\/mrow><annotation encoding=\"application\/x-tex\">\\chi^2(3) = 9.43, p = 0.0240^*<\/annotation><\/semantics><\/math> (Blue Panel)<\/li>\n\n\n\n<li><strong>Individual Category Estimates<\/strong>:<\/li>\n\n\n\n<li><strong>Normal:<\/strong> <math data-latex=\"\\text{OR} = 0.62, p = 0.0011^{**}\"><semantics><mrow><mtext>OR<\/mtext><mo>=<\/mo><mn>0.62<\/mn><mo separator=\"true\">,<\/mo><mi>p<\/mi><mo>=<\/mo><msup><mn>0.0011<\/mn><mrow><mo lspace=\"0em\" rspace=\"0em\">\u2217<\/mo><mo form=\"prefix\" stretchy=\"false\" lspace=\"0em\" rspace=\"0em\">\u2217<\/mo><\/mrow><\/msup><\/mrow><annotation encoding=\"application\/x-tex\">\\text{OR} = 0.62, p = 0.0011^{**}<\/annotation><\/semantics><\/math> (Highly Significant)<\/li>\n\n\n\n<li><strong>The Story<\/strong>: For Respiratory patients, the reduction in readmission is isolated entirely to the <strong>Normal HbA1c<\/strong> group (<math data-latex=\"\\text{OR} = 0.62\"><semantics><mrow><mtext>OR<\/mtext><mo>=<\/mo><mn>0.62<\/mn><\/mrow><annotation encoding=\"application\/x-tex\">\\text{OR} = 0.62<\/annotation><\/semantics><\/math>), while high HbA1c groups show no significant benefit.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Discussions<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">Clinical Nuances &amp; Cohort Context<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Cohort Selection<\/strong>: Out of over 100,000 raw clinical encounters, only <strong>69,987<\/strong> records met the strict inclusion criteria. This filtering was necessary to focus on independent, non-procedure-based encounters for patients surviving their hospital stay.<\/li>\n\n\n\n<li><strong>Low Historical Prevalence<\/strong>: In this historical cohort (1999\u20132008), the HbA1c test was ordered in only <strong>18.4%<\/strong> of inpatient stays. This indicates that inpatient screening was historically underutilized. However, the average length of stay of <strong>4.27 days<\/strong> represents a highly sufficient clinical window for performing the test and receiving results.<\/li>\n\n\n\n<li><strong>EHR Data Limitations<\/strong>: It is possible that HbA1c tests were evaluated in practice but not documented in the electronic health record (EHR) database, or that practitioners had access to other unrecorded blood glucose metrics (e.g., fingerstick logs) that guided medication adjustments. Additionally, standard guidelines recommending the discontinuation of outpatient diabetic medications upon admission were only adopted late in the study period.<\/li>\n\n\n\n<li><strong>Modern Context (The HITECH Act)<\/strong>: Since the <strong>2009 HITECH Act<\/strong> and the introduction of hospital quality incentives (e.g., HEDIS\/CMS measures), modern inpatient HbA1c screening has skyrocketed to exceed <strong>70\u201380%<\/strong> for diabetic inpatients, representing a massive shift in standards of care compared to the historical baseline.<\/li>\n\n\n\n<li><strong>Glycemic Attention &amp; Readmission<\/strong>: With respect to readmission rates, simply measuring HbA1c is associated with a lower rate of readmission in individuals with diabetes as a primary diagnosis, whereas respiratory and circulatory diseases as primary diagnoses are not. This suggests that greater attention to diabetes care during hospitalization (specifically for these high-risk individuals) can have a significant clinical impact on readmission outcomes.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Methodological Limitations<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Retrospective, Nonrandomized Design<\/strong>: Unlike a randomized clinical trial (RCT), this study relies on a retrospective observational database. Because clinicians do not order HbA1c tests randomly, tested patients likely had different baseline risks, introducing selection bias.<\/li>\n\n\n\n<li><strong>Association vs. Causal Inference<\/strong>: Consequently, this regression analysis reveals statistical associations rather than direct cause-and-effect relationships. However, these associations provide a strong empirical basis for developing and testing structured clinical protocols.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Proposed Future Improvements<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To overcome the inherent limitations of the 2014 study design and nested logistic regression, three major methodological extensions are proposed:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. Causal Inference (Selection Bias &amp; Propensity Score Matching)<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Because this is a retrospective clinical database and not a randomized controlled trial, physicians do not order HbA1c tests randomly. Sicker patients or those showing poor glycemic control are tested more frequently, introducing selection bias.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Proposed Enhancement<\/strong>: Implementing <strong>Propensity Score Matching (PSM)<\/strong> to match tested and untested patients with identical baseline covariates (demographics, comorbidities, time in hospital) will allow us to isolate the true causal effect of inpatient HbA1c testing on readmissions.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">2. Machine Learning &amp; Model Interpretability<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Logistic regression assumes linear log-odds relations and struggles to capture complex, high-order interactions without manual specification.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Proposed Enhancement<\/strong>: Training a tree-based machine learning model (such as <strong>XGBoost<\/strong>) and generating <strong>SHAP (Shapley Additive exPlanations) values<\/strong> will allow us to capture non-linear risks and identify the exact contribution of medications and comorbidity scores to readmission.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">3. Survival Analysis (Time-to-Event Modeling)<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Analyzing readmissions as a binary 30-day flag ignores the timing of the readmission and treats a patient readmitted on day 31 identically to one who was never readmitted.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Proposed Enhancement<\/strong>: Transitioning to a <strong>Cox Proportional Hazards<\/strong> model allows us to analyze the <em>time-to-event<\/em> outcome. This treats patients who were never readmitted (or discharged safely beyond the observation window) as right-censored, preserving temporal detail and statistical power.<\/li>\n<\/ul>\n\n\n\n<h1 class=\"wp-block-heading\">Conclusion<\/h1>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Clinical Value of HbA1c Screening<\/strong>: Inpatient HbA1c measurement is a highly valuable predictor of 30-day readmission rates, particularly for patients admitted with a primary diagnosis of Diabetes.<\/li>\n\n\n\n<li><strong>Reducing Rates &amp; Healthcare Costs<\/strong>: By identifying poorly controlled glycemic status during hospital stays and prompting active treatment adjustments, inpatient screening serves as a powerful catalyst for reducing costly readmissions and improving diabetic patient care.<\/li>\n\n\n\n<li><strong>Empirical Foundation<\/strong>: Although the study is limited by its retrospective, nonrandomized design, the findings provide a strong empirical foundation for developing hospital protocols to test this clinical hypothesis directly.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">Scripts<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Full scripts are available at<a href=\"https:\/\/github.com\/eettirk\/readmission_HbA1c_analysis\">  <img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"30\" height=\"30\" data-attachment-id=\"544\" data-permalink=\"https:\/\/medytic.blog\/en\/portfolio\/attachment\/25231\/\" data-orig-file=\"https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/05\/25231.png?fit=512%2C512&amp;ssl=1\" data-orig-size=\"512,512\" data-comments-opened=\"1\" data-image-title=\"25231\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/05\/25231.png?fit=512%2C512&amp;ssl=1\" class=\"wp-image-544\" style=\"width: 30px;\" src=\"https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/05\/25231.png?resize=30%2C30&#038;ssl=1\" alt=\"\" srcset=\"https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/05\/25231.png?w=512&amp;ssl=1 512w, https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/05\/25231.png?resize=300%2C300&amp;ssl=1 300w, https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/05\/25231.png?resize=150%2C150&amp;ssl=1 150w\" sizes=\"auto, (max-width: 30px) 100vw, 30px\" \/><\/a><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>preprocess.R<\/code>: Data filtering, ICD-9 diagnosis mapping, and cohort cleaning.<\/li>\n\n\n\n<li><code>analysis.R<\/code>: Fits nested logistic regression models and calculates ANOVA deviance tables.<\/li>\n\n\n\n<li><code>visualization.R<\/code>: Replicates the original paper&#8217;s Figures 1, 2, and 3.<\/li>\n\n\n\n<li><code>visualization_improved.R<\/code>: The modernized visualization script implementing Wald tests and the faceted forest plot.<\/li>\n\n\n\n<li><code>run_pipeline.R<\/code>: Master orchestrator script that runs the entire pipeline end-to-end and outputs a verification summary report.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">Thank you for making it this far! This project demonstrates the power of transforming complex raw tabulations into granular, actionable clinical insights. Stay tuned for my next data science project!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This project aims to replicate and analyze the 2014 Strack et al. study on hospital readmissions among diabetic patients using modern data science methods. It involves extensive statistical modeling, data preprocessing, and improved visualizations. The findings highlight significant yet counterintuitive relationships within the data, addressing critical issues in patient care.<\/p>\n","protected":false},"author":273023487,"featured_media":646,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_seo_schema_type":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_wpcom_ai_launchpad_first_post":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[34555906,413477,231379257,10189],"tags":[231379294,231379293,231379284,231379277,231379292,231379291,231379287,231379288,231379286,231379296,231379290,231379285,231379289,231379295],"class_list":["post-640","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-healthcare-analysis","category-personal-project","category-portfolio","category-r","tag-biostatistics","tag-causal-inference","tag-clinical-data-science","tag-data-visualization","tag-diabetes-care","tag-epidemiological-modeling","tag-hba1c-screening","tag-hospital-readmission","tag-logistic-regression","tag-propensity-score-matching","tag-r-programming","tag-statistical-paradox","tag-survival-analysis","tag-wald-test"],"jetpack_publicize_connections":[],"jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pgTbA2-ak","jetpack-related-posts":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/medytic.blog\/wp-content\/uploads\/2026\/06\/figure_odds_ratios_faceted.png?fit=3300%2C2700&ssl=1","_links":{"self":[{"href":"https:\/\/medytic.blog\/en\/wp-json\/wp\/v2\/posts\/640","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/medytic.blog\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/medytic.blog\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/medytic.blog\/en\/wp-json\/wp\/v2\/users\/273023487"}],"replies":[{"embeddable":true,"href":"https:\/\/medytic.blog\/en\/wp-json\/wp\/v2\/comments?post=640"}],"version-history":[{"count":57,"href":"https:\/\/medytic.blog\/en\/wp-json\/wp\/v2\/posts\/640\/revisions"}],"predecessor-version":[{"id":710,"href":"https:\/\/medytic.blog\/en\/wp-json\/wp\/v2\/posts\/640\/revisions\/710"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/medytic.blog\/en\/wp-json\/wp\/v2\/media\/646"}],"wp:attachment":[{"href":"https:\/\/medytic.blog\/en\/wp-json\/wp\/v2\/media?parent=640"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/medytic.blog\/en\/wp-json\/wp\/v2\/categories?post=640"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/medytic.blog\/en\/wp-json\/wp\/v2\/tags?post=640"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}