You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>This tutorial reproduces the key tables from the <ahref="https://jamanetwork.com/journals/jama/article-abstract/2526639">Flegal et al. (2016)</a> article. The analysis uses the same NHANES data and aims to replicate the unweighted sample size counts from Table 1 and the weighted logistic regression models from Table 3. We incorporate <ahref="https://wwwn.cdc.gov/nchs/nhanes/tutorials/reliabilityofestimates.aspx">NCHS/CDC reliability standards</a> to ensure estimates are statistically defensible <spanclass="citation" data-cites="nhanes_reliability_estimates">(<ahref="#ref-nhanes_reliability_estimates" role="doc-biblioref">Disease Control and Prevention 2025</a>)</span>.</p>
1393
+
<p>This tutorial reproduces the key tables from the <ahref="https://jamanetwork.com/journals/jama/article-abstract/2526639">Flegal et al. (2016)</a> article<spanclass="citation" data-cites="flegal2016trends">(<ahref="#ref-flegal2016trends" role="doc-biblioref">Flegal et al. 2016</a>)</span>. The analysis uses the same NHANES data and aims to replicate the unweighted sample size counts from Table 1 and the weighted logistic regression models from Table 3. We incorporate <ahref="https://wwwn.cdc.gov/nchs/nhanes/tutorials/reliabilityofestimates.aspx">NCHS/CDC reliability standards</a> to ensure estimates are statistically defensible <spanclass="citation" data-cites="nhanes_reliability_estimates">(<ahref="#ref-nhanes_reliability_estimates" role="doc-biblioref">Disease Control and Prevention 2025</a>)</span>.</p>
1369
1394
</section><sectionid="setup-and-data-preparation" class="level2"><h2class="anchored" data-anchor-id="setup-and-data-preparation">Setup and Data Preparation</h2>
1370
1395
<p>This first section prepares the data for analysis. The key steps are:</p>
<p>The <code>svytable1</code> function creates a descriptive summary table—commonly referred to as a <strong>“Table 1”</strong>—from complex survey data <spanclass="citation" data-cites="svyTable1">(<ahref="#ref-svyTable1" role="doc-biblioref">Karim 2025</a>)</span>. It is specifically designed to produce publication-ready results that align with <ahref="https://wwwn.cdc.gov/nchs/nhanes/tutorials/reliabilityofestimates.aspx">NCHS Data Presentation Standards for reliability</a>.</p>
<p>When you call <code>svytable1</code> (<ahref="https://github.com/ehsanx/svyTable1">link</a>), it performs the following steps for each analysis (for example, for all participants, men, and women):</p>
1484
+
<p>When we call <code>svytable1</code> (<ahref="https://github.com/ehsanx/svyTable1">link</a>), it performs the following steps for each analysis (for example, for all participants, men, and women):</p>
It summarizes categorical variables (like <code>Age</code>) by calculating the proportion of participants in each category (e.g., 20–39, 40–59, ≥60).</p></li>
Each of these flags indicates limited precision or instability in the estimate.</li>
1496
1521
</ul>
1497
1522
<p>In the output, the asterisks appear in the <strong>“Other” race</strong> column for certain age groups (such as “40–59” and “≥60”).<br>
1498
-
This happens because the <strong>number of participants</strong> in those cells is very small, producing unstable or wide confidence intervals. Thus, the function correctly replaces the unreliable estimates with <code>*</code>, ensuring your published results remain statistically defensible and transparent.</p>
1523
+
This happens because the <strong>number of participants</strong> in those cells is very small, producing unstable or wide confidence intervals. Thus, the function correctly replaces the unreliable estimates with <code>*</code>, ensuring the published results remain statistically defensible and transparent.</p>
<p>In addition to the detailed checks for proportions, the <code>svytable1</code> function also assesses the reliability of means for numeric variables. For these estimates, it applies the standard NCHS recommendation, which uses the Relative Standard Error (RSE). If a mean’s RSE is 30% or greater, it is considered statistically unreliable and will be suppressed with an asterisk (*) in the formatted table.</p>
1501
-
<p>The <code>$reliability_metrics</code> table will be printed with the output if you select <code>return_metrics = TRUE</code> which will include rows for each mean, reporting the calculated RSE and the outcome of this check in the <code>fail_rse_30</code> column.</p>
1526
+
<p>The <code>$reliability_metrics</code> table will be printed with the output if we select <code>return_metrics = TRUE</code> which will include rows for each mean, reporting the calculated RSE and the outcome of this check in the <code>fail_rse_30</code> column.</p>
1502
1527
<divclass="cell">
1503
1528
<divclass="sourceCode cell-code" id="cb2"><preclass="sourceCode numberSource r number-lines code-with-copy"><codeclass="sourceCode r"><spanid="cb2-1"><ahref="#cb2-1"></a><spanclass="co"># View reliability_metrics</span></span>
<li><p><strong>The Standard Error (SE)</strong>: A direct measure of the coefficient’s precision. A smaller SE relative to its coefficient suggests a more reliable estimate.</p></li>
1976
-
<li><p><strong>The p-value</strong>: Tells you if the coefficient is statistically distinguishable from zero. A non-significant p-value (e.g., p > 0.05) means we cannot be confident the predictor has any association with the outcome.</p></li>
2001
+
<li><p><strong>The p-value</strong>: Tells if the coefficient is statistically distinguishable from zero. A non-significant p-value (e.g., p > 0.05) means we cannot be confident the predictor has any association with the outcome.</p></li>
1977
2002
<li><p><strong>The Confidence Interval (CI)</strong>: Provides a plausible range for the true value of the coefficient. A very wide CI indicates a high degree of uncertainty and, therefore, low reliability. For logistic regression, if the CI for the odds ratio contains 1.0, the result is not statistically significant.</p></li>
1978
2003
</ol>
1979
2004
<p>We will also calculate the RSE to demonstrate why it can be misleading. Finally, we’ll run a quick check for multicollinearity using the Variance Inflation Factor (VIF), as this is a common cause of unstable (unreliable) coefficients.</p>
<p>Generally, the model shows limited reliability and predictive power. Most of the predictor variables, such as <code>Age</code> and <code>smoking status</code>, are not statistically significant (their <code>p.value</code> is high). This indicates that, for men in this dataset, these factors don’t have a clear, reliable association with obesity.</p>
2155
2180
<p>The few significant predictors are <code>raceNon-Hispanic Asian</code> and <code>education\<High school</code>. These coefficients are considered stable and reliable. The unreliability of the other terms is not caused by the variables being correlated with each other, as the multicollinearity check shows.</p>
2156
-
<p><strong>The RSE Can Be Misleading for Regression</strong>: Notice that some statistically insignificant coefficients (like <code>Age40-59</code> and <code>raceHispanic</code>) have high RSEs, which is expected. However, the <code>education\>High school</code> coefficient is highly insignificant: p-value of 0.932 correctly tells you that this coefficient is not statistically significant and is not reliably different from zero. However its RSE is flagged as “TRUE” for being unreliable. The RSE is calculated as (0.147 / -0.013) * 100 = 1109%. Here, the extremely high RSE here is not a result of a large standard error, but of the coefficient estimate being very close to zero. An inflated RSE doesn’t provide any new or more accurate information than the p-value; it simply reflects that the coefficient itself is minuscule. This is a great example of why RSE isn’t a primary tool for regression coefficients: it can be inflated by estimates close to zero, regardless of their precision.</p>
2181
+
<p><strong>The RSE Can Be Misleading for Regression</strong>: Notice that some statistically insignificant coefficients (like <code>Age40-59</code> and <code>raceHispanic</code>) have high RSEs, which is expected. However, the <code>education\>High school</code> coefficient is highly insignificant: p-value of 0.932 correctly tells that this coefficient is not statistically significant and is not reliably different from zero. However its RSE is flagged as “TRUE” for being unreliable. The RSE is calculated as (0.147 / -0.013) * 100 = 1109%. Here, the extremely high RSE here is not a result of a large standard error, but of the coefficient estimate being very close to zero. An inflated RSE doesn’t provide any new or more accurate information than the p-value; it simply reflects that the coefficient itself is minuscule. This is a great example of why RSE isn’t a primary tool for regression coefficients: it can be inflated by estimates close to zero, regardless of their precision.</p>
2157
2182
</section><sectionid="check-for-multicollinearity" class="level3"><h3class="anchored" data-anchor-id="check-for-multicollinearity">Check for Multicollinearity</h3>
2158
-
<p>Multicollinearity occurs when predictor variables in a model are highly correlated with each other. This can inflate the standard errors and make your coefficient estimates unstable. The VIF is used to detect this issue.</p>
2183
+
<p>Multicollinearity occurs when predictor variables in a model are highly correlated with each other. This can inflate the standard errors and make the coefficient estimates unstable. The VIF is used to detect this issue.</p>
2159
2184
<p><code>GVIF^(1/(2*Df))</code> is a scaled version of the Generalized Variance Inflation Factor (GVIF) used to assess multicollinearity in regression models with categorical predictors <spanclass="citation" data-cites="fox1992generalized">(<ahref="#ref-fox1992generalized" role="doc-biblioref">Fox and Monette 1992</a>)</span>. It adjusts for the number of dummy variables created for a categorical variable, making its value directly comparable to the traditional VIF used for continuous predictors within the same model.</p>
2160
2185
<sectionid="why-gvif12df-is-necessary-for-categorical-variables" class="level4"><h4class="anchored" data-anchor-id="why-gvif12df-is-necessary-for-categorical-variables">Why GVIF<sup>1/(2×Df)</sup> is Necessary for Categorical Variables</h4>
2161
2186
<p>A categorical variable with (k) levels (e.g., <em>race</em>) is typically represented in a regression model by (k - 1) <strong>dummy variables</strong>. Dummy variables are inherently correlated because they all describe the same categorical feature. This intrinsic relationship would lead to very high — but misleading — <strong>GVIF</strong> scores if the overall GVIF were interpreted directly.</p>
<p>A more conservative cutoff of *3** is sometimes used. The scaled GVIF, (GVIF^{1/(2·df)}), is designed to be comparable to the square root of the VIF, which explains the use of cutoffs like () (≈ 2.24) and () (≈ 3.16) <spanclass="citation" data-cites="nahhas2024introduction">(<ahref="#ref-nahhas2024introduction" role="doc-biblioref">Nahhas 2024</a>)</span>. Larger than () (≈ 4.47) is therefore the case of severe multicollinearity.</p>
2218
+
<p>A more conservative cutoff of <strong>3</strong> is sometimes used. The scaled GVIF, <spanclass="math inline">\(GVIF^{1/(2·df)}\)</span>, is designed to be comparable to the square root of the VIF, which explains the use of cutoffs like <spanclass="math inline">\(\sqrt{5}\)</span> (≈ 2.24) and <spanclass="math inline">\(\sqrt{10}\)</span> (≈ 3.16) <spanclass="citation" data-cites="nahhas2024introduction">(<ahref="#ref-nahhas2024introduction" role="doc-biblioref">Nahhas 2024</a>)</span>. Larger than <spanclass="math inline">\(\sqrt{20}\)</span> (≈ 4.47) is therefore the case of severe multicollinearity.</p>
2194
2219
<divclass="cell">
2195
2220
<divclass="sourceCode cell-code" id="cb10"><preclass="sourceCode numberSource r number-lines code-with-copy"><codeclass="sourceCode r"><spanid="cb10-1"><ahref="#cb10-1"></a>vif_values <spanclass="ot"><-</span><spanclass="fu">vif</span>(fit_men_obese)</span>
<spanid="cb10-7"><ahref="#cb10-7"></a><spanclass="co">#> education 6.381028 2 1.589361</span></span></code><buttontitle="Copy to Clipboard" class="code-copy-button"><iclass="bi"></i></button></pre></div>
2202
2227
</div>
2203
-
<p>The key values in the <code>GVIF\^(1/(2\*Df))</code> column are all low (below 2.5). This confirms that your predictor variables are independent enough from one another and are not artificially inflating each other’s standard errors. The lack of precision in the model comes from other sources, not from multicollinearity.</p>
2228
+
<p>The key values in the <code>GVIF\^(1/(2\*Df))</code> column are all low (below 2.5). This confirms that the predictor variables are independent enough from one another and are not artificially inflating each other’s standard errors. The lack of precision in the model comes from other sources, not from multicollinearity.</p>
2204
2229
</section></section></section><sectionid="formatting-the-table" class="level3"><h3class="anchored" data-anchor-id="formatting-the-table">Formatting the Table</h3>
2205
2230
<divclass="cell">
2206
2231
<divclass="sourceCode cell-code" id="cb11"><preclass="sourceCode numberSource r number-lines code-with-copy"><codeclass="sourceCode r"><spanid="cb11-1"><ahref="#cb11-1"></a><spanclass="co"># --- Use the helper function to format results from each model ---</span></span>
Disease Control, Centers for, and Prevention. 2025. <span>“NHANES Tutorials: Reliability of Estimates Module.”</span> National Center for Health Statistics. <ahref="https://wwwn.cdc.gov/nchs/nhanes/tutorials/reliabilityofestimates.aspx">https://wwwn.cdc.gov/nchs/nhanes/tutorials/reliabilityofestimates.aspx</a>.
Flegal, Katherine M, Deanna Kruszon-Moran, Margaret D Carroll, Cheryl D Fryar, and Cynthia L Ogden. 2016. <span>“Trends in Obesity Among Adults in the United States, 2005 to 2014.”</span><em>Jama</em> 315 (21): 2284–91.
Fox, John, and Georges Monette. 1992. <span>“Generalized Collinearity Diagnostics.”</span><em>Journal of the American Statistical Association</em> 87 (417): 178–83.
0 commit comments