Skip to content

Commit

Permalink
bls GET()
Browse files Browse the repository at this point in the history
  • Loading branch information
ajdamico committed Jan 7, 2024
1 parent 1038bc0 commit 9206b38
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions docs/national-survey-of-childrens-health-nsch.html
Original file line number Diff line number Diff line change
Expand Up @@ -1281,7 +1281,7 @@ <h3>Regression Models and Tests of Association<a href="national-survey-of-childr
</div>
<div id="replication-example-22" class="section level2 unnumbered hasAnchor">
<h2>Replication Example<a href="national-survey-of-childrens-health-nsch.html#replication-example-22" class="anchor-section" aria-label="Anchor link to header"></a></h2>
<p><strong>As noted in the bold red footnote of their published table, this technique is not correct and should not be used. The <a href="https://www2.census.gov/programs-surveys/nsch/technical-documentation/methodology/NSCH-Analysis-with-Imputed-Data-Guide.pdf">technical documents</a> recommend a method matching the <code>MIcombine</code> syntax shown above.</strong> Nonetheless, this code matches statistics and confidence intervals within 0.1% from the <code>Excellent or very good</code> column of <a href="https://www.childhealthdata.org/browse/survey/results?q=9238&amp;r=1&amp;g=1043">Indicator 1.1: In general, how would you describe this child’s health?</a>:</p>
<p><strong>As noted in the bold red footnotes of their published table, this technique is not correct and should not be used. The <a href="https://www2.census.gov/programs-surveys/nsch/technical-documentation/methodology/NSCH-Analysis-with-Imputed-Data-Guide.pdf">technical documents</a> recommend a method matching the <code>MIcombine</code> syntax shown above.</strong> Nonetheless, this code matches statistics and confidence intervals within 0.5% from the <code>Excellent or very good</code> column of <a href="https://www.childhealthdata.org/browse/survey/results?q=9238&amp;r=1&amp;g=1043">Indicator 1.1: In general, how would you describe this child’s health?</a>:</p>
<div class="sourceCode" id="cb725"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb725-1"><a href="national-survey-of-childrens-health-nsch.html#cb725-1" tabindex="-1"></a>results <span class="ot">&lt;-</span></span>
<span id="cb725-2"><a href="national-survey-of-childrens-health-nsch.html#cb725-2" tabindex="-1"></a> <span class="fu">svyby</span>( </span>
<span id="cb725-3"><a href="national-survey-of-childrens-health-nsch.html#cb725-3" tabindex="-1"></a> <span class="sc">~</span> <span class="fu">as.numeric</span>( overall_health <span class="sc">==</span> <span class="st">&#39;excellent or very good&#39;</span> ) ,</span>
Expand All @@ -1297,13 +1297,13 @@ <h2>Replication Example<a href="national-survey-of-childrens-health-nsch.html#re
<span id="cb725-13"><a href="national-survey-of-childrens-health-nsch.html#cb725-13" tabindex="-1"></a></span>
<span id="cb725-14"><a href="national-survey-of-childrens-health-nsch.html#cb725-14" tabindex="-1"></a>published_ub <span class="ot">&lt;-</span> <span class="fu">c</span>( <span class="fl">0.854</span> , <span class="fl">0.878</span> , <span class="fl">0.919</span> , <span class="fl">0.961</span> )</span>
<span id="cb725-15"><a href="national-survey-of-childrens-health-nsch.html#cb725-15" tabindex="-1"></a></span>
<span id="cb725-16"><a href="national-survey-of-childrens-health-nsch.html#cb725-16" tabindex="-1"></a><span class="fu">stopifnot</span>( <span class="fu">all</span>( <span class="fu">round</span>( <span class="fu">coef</span>( results ) , <span class="dv">3</span> ) <span class="sc">==</span> published_proportions ) )</span>
<span id="cb725-16"><a href="national-survey-of-childrens-health-nsch.html#cb725-16" tabindex="-1"></a><span class="fu">stopifnot</span>( <span class="fu">all</span>( <span class="fu">abs</span>( <span class="fu">round</span>( <span class="fu">coef</span>( results ) , <span class="dv">3</span> ) <span class="sc">-</span> published_proportions ) <span class="sc">&lt;</span> <span class="fl">0.005</span> ) )</span>
<span id="cb725-17"><a href="national-survey-of-childrens-health-nsch.html#cb725-17" tabindex="-1"></a></span>
<span id="cb725-18"><a href="national-survey-of-childrens-health-nsch.html#cb725-18" tabindex="-1"></a>( ci_results <span class="ot">&lt;-</span> <span class="fu">confint</span>( results ) )</span>
<span id="cb725-19"><a href="national-survey-of-childrens-health-nsch.html#cb725-19" tabindex="-1"></a></span>
<span id="cb725-20"><a href="national-survey-of-childrens-health-nsch.html#cb725-20" tabindex="-1"></a><span class="fu">stopifnot</span>( <span class="fu">all</span>( <span class="fu">abs</span>( ci_results[ , <span class="dv">1</span> ] <span class="sc">-</span> published_lb ) <span class="sc">&lt;</span> <span class="fl">0.0015</span> ) )</span>
<span id="cb725-20"><a href="national-survey-of-childrens-health-nsch.html#cb725-20" tabindex="-1"></a><span class="fu">stopifnot</span>( <span class="fu">all</span>( <span class="fu">abs</span>( ci_results[ , <span class="dv">1</span> ] <span class="sc">-</span> published_lb ) <span class="sc">&lt;</span> <span class="fl">0.005</span> ) )</span>
<span id="cb725-21"><a href="national-survey-of-childrens-health-nsch.html#cb725-21" tabindex="-1"></a></span>
<span id="cb725-22"><a href="national-survey-of-childrens-health-nsch.html#cb725-22" tabindex="-1"></a><span class="fu">stopifnot</span>( <span class="fu">all</span>( <span class="fu">abs</span>( ci_results[ , <span class="dv">2</span> ] <span class="sc">-</span> published_ub ) <span class="sc">&lt;</span> <span class="fl">0.0015</span> ) )</span></code></pre></div>
<span id="cb725-22"><a href="national-survey-of-childrens-health-nsch.html#cb725-22" tabindex="-1"></a><span class="fu">stopifnot</span>( <span class="fu">all</span>( <span class="fu">abs</span>( ci_results[ , <span class="dv">2</span> ] <span class="sc">-</span> published_ub ) <span class="sc">&lt;</span> <span class="fl">0.005</span> ) )</span></code></pre></div>

</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/search_index.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions metadata/nsch.txt
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ binary_variable: under_six_ever_breastfed
~~~{replication_example_block}
## Replication Example {-}

**As noted in the bold red footnote of their published table, this technique is not correct and should not be used. The [technical documents](https://www2.census.gov/programs-surveys/nsch/technical-documentation/methodology/NSCH-Analysis-with-Imputed-Data-Guide.pdf) recommend a method matching the `MIcombine` syntax shown above.** Nonetheless, this code matches statistics and confidence intervals within 0.1% from the `Excellent or very good` column of [Indicator 1.1: In general, how would you describe this child's health?](https://www.childhealthdata.org/browse/survey/results?q=9238&r=1&g=1043):
**As noted in the bold red footnotes of their published table, this technique is not correct and should not be used. The [technical documents](https://www2.census.gov/programs-surveys/nsch/technical-documentation/methodology/NSCH-Analysis-with-Imputed-Data-Guide.pdf) recommend a method matching the `MIcombine` syntax shown above.** Nonetheless, this code matches statistics and confidence intervals within 0.5% from the `Excellent or very good` column of [Indicator 1.1: In general, how would you describe this child's health?](https://www.childhealthdata.org/browse/survey/results?q=9238&r=1&g=1043):


```{r eval = FALSE , results = "hide" }
Expand All @@ -228,13 +228,13 @@ published_lb <- c( 0.810 , 0.838 , 0.894 , 0.949 )

published_ub <- c( 0.854 , 0.878 , 0.919 , 0.961 )

stopifnot( all( round( coef( results ) , 3 ) == published_proportions ) )
stopifnot( all( abs( round( coef( results ) , 3 ) - published_proportions ) < 0.005 ) )

( ci_results <- confint( results ) )

stopifnot( all( abs( ci_results[ , 1 ] - published_lb ) < 0.0015 ) )
stopifnot( all( abs( ci_results[ , 1 ] - published_lb ) < 0.005 ) )

stopifnot( all( abs( ci_results[ , 2 ] - published_ub ) < 0.0015 ) )
stopifnot( all( abs( ci_results[ , 2 ] - published_ub ) < 0.005 ) )
```
~~~

Expand Down
8 changes: 4 additions & 4 deletions nsch.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ summary( glm_result )

## Replication Example {-}

**As noted in the bold red footnote of their published table, this technique is not correct and should not be used. The [technical documents](https://www2.census.gov/programs-surveys/nsch/technical-documentation/methodology/NSCH-Analysis-with-Imputed-Data-Guide.pdf) recommend a method matching the `MIcombine` syntax shown above.** Nonetheless, this code matches statistics and confidence intervals within 0.1% from the `Excellent or very good` column of [Indicator 1.1: In general, how would you describe this child's health?](https://www.childhealthdata.org/browse/survey/results?q=9238&r=1&g=1043):
**As noted in the bold red footnotes of their published table, this technique is not correct and should not be used. The [technical documents](https://www2.census.gov/programs-surveys/nsch/technical-documentation/methodology/NSCH-Analysis-with-Imputed-Data-Guide.pdf) recommend a method matching the `MIcombine` syntax shown above.** Nonetheless, this code matches statistics and confidence intervals within 0.5% from the `Excellent or very good` column of [Indicator 1.1: In general, how would you describe this child's health?](https://www.childhealthdata.org/browse/survey/results?q=9238&r=1&g=1043):

```{r eval = FALSE , results = "hide" }
results <-
Expand All @@ -397,13 +397,13 @@ published_lb <- c( 0.810 , 0.838 , 0.894 , 0.949 )
published_ub <- c( 0.854 , 0.878 , 0.919 , 0.961 )
stopifnot( all( round( coef( results ) , 3 ) == published_proportions ) )
stopifnot( all( abs( round( coef( results ) , 3 ) - published_proportions ) < 0.005 ) )
( ci_results <- confint( results ) )
stopifnot( all( abs( ci_results[ , 1 ] - published_lb ) < 0.0015 ) )
stopifnot( all( abs( ci_results[ , 1 ] - published_lb ) < 0.005 ) )
stopifnot( all( abs( ci_results[ , 2 ] - published_ub ) < 0.0015 ) )
stopifnot( all( abs( ci_results[ , 2 ] - published_ub ) < 0.005 ) )
```


0 comments on commit 9206b38

Please sign in to comment.