Skip to content

Commit

Permalink
nis
Browse files Browse the repository at this point in the history
  • Loading branch information
ajdamico committed Dec 12, 2024
1 parent 9537e41 commit 0226a6c
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 34 deletions.
22 changes: 11 additions & 11 deletions docs/national-immunization-survey-nis.html
Original file line number Diff line number Diff line change
Expand Up @@ -1231,18 +1231,18 @@ <h2>Recommended Reading<a href="national-immunization-survey-nis.html#recommende
</div>
<div id="download-import-preparation-27" class="section level2 unnumbered hasAnchor">
<h2>Download, Import, Preparation<a href="national-immunization-survey-nis.html#download-import-preparation-27" class="anchor-section" aria-label="Anchor link to header"></a></h2>
<p>Download the fixed-width file:</p>
<p>Download the 2023 fixed-width file:</p>
<div class="sourceCode" id="cb798"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb798-1"><a href="national-immunization-survey-nis.html#cb798-1" tabindex="-1"></a>dat_tf <span class="ot">&lt;-</span> <span class="fu">tempfile</span>()</span>
<span id="cb798-2"><a href="national-immunization-survey-nis.html#cb798-2" tabindex="-1"></a></span>
<span id="cb798-3"><a href="national-immunization-survey-nis.html#cb798-3" tabindex="-1"></a>dat_url <span class="ot">&lt;-</span> <span class="st">&quot;https://ftp.cdc.gov/pub/Vaccines_NIS/NISPUF21.DAT&quot;</span></span>
<span id="cb798-3"><a href="national-immunization-survey-nis.html#cb798-3" tabindex="-1"></a>dat_url <span class="ot">&lt;-</span> <span class="st">&quot;https://ftp.cdc.gov/pub/Vaccines_NIS/NISPUF23.DAT&quot;</span></span>
<span id="cb798-4"><a href="national-immunization-survey-nis.html#cb798-4" tabindex="-1"></a></span>
<span id="cb798-5"><a href="national-immunization-survey-nis.html#cb798-5" tabindex="-1"></a><span class="fu">download.file</span>( dat_url , dat_tf , <span class="at">mode =</span> <span class="st">&#39;wb&#39;</span> )</span></code></pre></div>
<p>Edit then execute the import script provided by the CDC:</p>
<div class="sourceCode" id="cb799"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb799-1"><a href="national-immunization-survey-nis.html#cb799-1" tabindex="-1"></a><span class="fu">library</span>(Hmisc)</span>
<span id="cb799-2"><a href="national-immunization-survey-nis.html#cb799-2" tabindex="-1"></a></span>
<span id="cb799-3"><a href="national-immunization-survey-nis.html#cb799-3" tabindex="-1"></a>r_tf <span class="ot">&lt;-</span> <span class="fu">tempfile</span>()</span>
<span id="cb799-4"><a href="national-immunization-survey-nis.html#cb799-4" tabindex="-1"></a></span>
<span id="cb799-5"><a href="national-immunization-survey-nis.html#cb799-5" tabindex="-1"></a>r_script_url <span class="ot">&lt;-</span> <span class="st">&quot;https://ftp.cdc.gov/pub/Vaccines_NIS/NISPUF21.R&quot;</span></span>
<span id="cb799-5"><a href="national-immunization-survey-nis.html#cb799-5" tabindex="-1"></a>r_script_url <span class="ot">&lt;-</span> <span class="st">&quot;https://ftp.cdc.gov/pub/Vaccines_NIS/NISPUF23.R&quot;</span></span>
<span id="cb799-6"><a href="national-immunization-survey-nis.html#cb799-6" tabindex="-1"></a></span>
<span id="cb799-7"><a href="national-immunization-survey-nis.html#cb799-7" tabindex="-1"></a>r_input_lines <span class="ot">&lt;-</span> <span class="fu">readLines</span>( r_script_url )</span>
<span id="cb799-8"><a href="national-immunization-survey-nis.html#cb799-8" tabindex="-1"></a></span>
Expand All @@ -1259,7 +1259,7 @@ <h2>Download, Import, Preparation<a href="national-immunization-survey-nis.html#
<span id="cb799-19"><a href="national-immunization-survey-nis.html#cb799-19" tabindex="-1"></a><span class="fu">source</span>( r_tf , <span class="at">echo =</span> <span class="cn">TRUE</span> )</span>
<span id="cb799-20"><a href="national-immunization-survey-nis.html#cb799-20" tabindex="-1"></a></span>
<span id="cb799-21"><a href="national-immunization-survey-nis.html#cb799-21" tabindex="-1"></a><span class="co"># rename the resultant data.frame object</span></span>
<span id="cb799-22"><a href="national-immunization-survey-nis.html#cb799-22" tabindex="-1"></a>nis_df <span class="ot">&lt;-</span> NISPUF21</span>
<span id="cb799-22"><a href="national-immunization-survey-nis.html#cb799-22" tabindex="-1"></a>nis_df <span class="ot">&lt;-</span> NISPUF23</span>
<span id="cb799-23"><a href="national-immunization-survey-nis.html#cb799-23" tabindex="-1"></a></span>
<span id="cb799-24"><a href="national-immunization-survey-nis.html#cb799-24" tabindex="-1"></a><span class="fu">names</span>( nis_df ) <span class="ot">&lt;-</span> <span class="fu">tolower</span>( <span class="fu">names</span>( nis_df ) )</span>
<span id="cb799-25"><a href="national-immunization-survey-nis.html#cb799-25" tabindex="-1"></a></span>
Expand Down Expand Up @@ -1446,7 +1446,7 @@ <h3>Regression Models and Tests of Association<a href="national-immunization-sur
</div>
<div id="replication-example-25" class="section level2 unnumbered hasAnchor">
<h2>Replication Example<a href="national-immunization-survey-nis.html#replication-example-25" class="anchor-section" aria-label="Anchor link to header"></a></h2>
<p>This example matches the statistics and standard errors from <a href="https://www.cdc.gov/vaccines/imz-managers/nis/downloads/NIS-PUF21-DUG.pdf#page=35">Data User’s Guide Table 4</a>:</p>
<p>This example matches the statistics and standard errors from <a href="https://www.cdc.gov/nis/media/pdfs/2024/11/NISPUF23DUG.pdf#page=36">Data User’s Guide Table 4</a>:</p>
<div class="sourceCode" id="cb822"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb822-1"><a href="national-immunization-survey-nis.html#cb822-1" tabindex="-1"></a>results <span class="ot">&lt;-</span></span>
<span id="cb822-2"><a href="national-immunization-survey-nis.html#cb822-2" tabindex="-1"></a> <span class="fu">svyby</span>( </span>
<span id="cb822-3"><a href="national-immunization-survey-nis.html#cb822-3" tabindex="-1"></a> <span class="sc">~</span> p_utd431h314_rout_s , </span>
Expand All @@ -1459,12 +1459,12 @@ <h2>Replication Example<a href="national-immunization-survey-nis.html#replicatio
<span id="cb822-10"><a href="national-immunization-survey-nis.html#cb822-10" tabindex="-1"></a></span>
<span id="cb822-11"><a href="national-immunization-survey-nis.html#cb822-11" tabindex="-1"></a>standard_errors <span class="ot">&lt;-</span> results[ , <span class="st">&quot;se.p_utd431h314_rout_sUTD&quot;</span> , drop <span class="ot">=</span> <span class="cn">FALSE</span> ]</span>
<span id="cb822-12"><a href="national-immunization-survey-nis.html#cb822-12" tabindex="-1"></a></span>
<span id="cb822-13"><a href="national-immunization-survey-nis.html#cb822-13" tabindex="-1"></a><span class="fu">stopifnot</span>( <span class="fu">round</span>( coefficients[ <span class="st">&quot;HISPANIC&quot;</span> , ] , <span class="dv">3</span> ) <span class="sc">==</span> .<span class="dv">711</span> )</span>
<span id="cb822-14"><a href="national-immunization-survey-nis.html#cb822-14" tabindex="-1"></a><span class="fu">stopifnot</span>( <span class="fu">round</span>( coefficients[ <span class="st">&quot;NON-HISPANIC WHITE ONLY&quot;</span> , ] , <span class="dv">3</span> ) <span class="sc">==</span> .<span class="dv">742</span> )</span>
<span id="cb822-15"><a href="national-immunization-survey-nis.html#cb822-15" tabindex="-1"></a><span class="fu">stopifnot</span>( <span class="fu">round</span>( coefficients[ <span class="st">&quot;NON-HISPANIC BLACK ONLY&quot;</span> , ] , <span class="dv">3</span> ) <span class="sc">==</span> .<span class="dv">647</span> )</span>
<span id="cb822-16"><a href="national-immunization-survey-nis.html#cb822-16" tabindex="-1"></a><span class="fu">stopifnot</span>( <span class="fu">round</span>( standard_errors[ <span class="st">&quot;HISPANIC&quot;</span> , ] , <span class="dv">3</span> ) <span class="sc">==</span> .<span class="dv">015</span> )</span>
<span id="cb822-17"><a href="national-immunization-survey-nis.html#cb822-17" tabindex="-1"></a><span class="fu">stopifnot</span>( <span class="fu">round</span>( standard_errors[ <span class="st">&quot;NON-HISPANIC WHITE ONLY&quot;</span> , ] , <span class="dv">3</span> ) <span class="sc">==</span> .<span class="dv">009</span> )</span>
<span id="cb822-18"><a href="national-immunization-survey-nis.html#cb822-18" tabindex="-1"></a><span class="fu">stopifnot</span>( <span class="fu">round</span>( standard_errors[ <span class="st">&quot;NON-HISPANIC BLACK ONLY&quot;</span> , ] , <span class="dv">3</span> ) <span class="sc">==</span> .<span class="dv">022</span> )</span></code></pre></div>
<span id="cb822-13"><a href="national-immunization-survey-nis.html#cb822-13" tabindex="-1"></a><span class="fu">stopifnot</span>( <span class="fu">round</span>( coefficients[ <span class="st">&quot;HISPANIC&quot;</span> , ] , <span class="dv">3</span> ) <span class="sc">==</span> .<span class="dv">674</span> )</span>
<span id="cb822-14"><a href="national-immunization-survey-nis.html#cb822-14" tabindex="-1"></a><span class="fu">stopifnot</span>( <span class="fu">round</span>( coefficients[ <span class="st">&quot;NON-HISPANIC WHITE ONLY&quot;</span> , ] , <span class="dv">3</span> ) <span class="sc">==</span> .<span class="dv">716</span> )</span>
<span id="cb822-15"><a href="national-immunization-survey-nis.html#cb822-15" tabindex="-1"></a><span class="fu">stopifnot</span>( <span class="fu">round</span>( coefficients[ <span class="st">&quot;NON-HISPANIC BLACK ONLY&quot;</span> , ] , <span class="dv">3</span> ) <span class="sc">==</span> .<span class="dv">666</span> )</span>
<span id="cb822-16"><a href="national-immunization-survey-nis.html#cb822-16" tabindex="-1"></a><span class="fu">stopifnot</span>( <span class="fu">round</span>( standard_errors[ <span class="st">&quot;HISPANIC&quot;</span> , ] , <span class="dv">3</span> ) <span class="sc">==</span> .<span class="dv">017</span> )</span>
<span id="cb822-17"><a href="national-immunization-survey-nis.html#cb822-17" tabindex="-1"></a><span class="fu">stopifnot</span>( <span class="fu">round</span>( standard_errors[ <span class="st">&quot;NON-HISPANIC WHITE ONLY&quot;</span> , ] , <span class="dv">3</span> ) <span class="sc">==</span> .<span class="dv">008</span> )</span>
<span id="cb822-18"><a href="national-immunization-survey-nis.html#cb822-18" tabindex="-1"></a><span class="fu">stopifnot</span>( <span class="fu">round</span>( standard_errors[ <span class="st">&quot;NON-HISPANIC BLACK ONLY&quot;</span> , ] , <span class="dv">3</span> ) <span class="sc">==</span> .<span class="dv">023</span> )</span></code></pre></div>
<hr />
</div>
<div id="analysis-examples-with-srvyr-18" class="section level2 unnumbered hasAnchor">
Expand Down
2 changes: 1 addition & 1 deletion docs/search_index.json

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions metadata/nis.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ One Haiku:

~~~{download_and_import_block}

Download the fixed-width file:
Download the 2023 fixed-width file:
```{r eval = FALSE , results = "hide" }
dat_tf <- tempfile()

dat_url <- "https://ftp.cdc.gov/pub/Vaccines_NIS/NISPUF21.DAT"
dat_url <- "https://ftp.cdc.gov/pub/Vaccines_NIS/NISPUF23.DAT"

download.file( dat_url , dat_tf , mode = 'wb' )
```
Expand All @@ -86,7 +86,7 @@ library(Hmisc)

r_tf <- tempfile()

r_script_url <- "https://ftp.cdc.gov/pub/Vaccines_NIS/NISPUF21.R"
r_script_url <- "https://ftp.cdc.gov/pub/Vaccines_NIS/NISPUF23.R"

r_input_lines <- readLines( r_script_url )

Expand All @@ -103,7 +103,7 @@ writeLines( r_input_lines , r_tf )
source( r_tf , echo = TRUE )

# rename the resultant data.frame object
chapter_tag_df <- NISPUF21
chapter_tag_df <- NISPUF23

names( chapter_tag_df ) <- tolower( names( chapter_tag_df ) )

Expand Down Expand Up @@ -195,7 +195,7 @@ needs_srvyr_block: yes
## Replication Example {-}


This example matches the statistics and standard errors from [Data User's Guide Table 4](https://www.cdc.gov/vaccines/imz-managers/nis/downloads/NIS-PUF21-DUG.pdf#page=35):
This example matches the statistics and standard errors from [Data User's Guide Table 4](https://www.cdc.gov/nis/media/pdfs/2024/11/NISPUF23DUG.pdf#page=36):

```{r eval = FALSE , results = "hide" }

Expand All @@ -211,12 +211,12 @@ coefficients <- results[ , "p_utd431h314_rout_sUTD" , drop = FALSE ]

standard_errors <- results[ , "se.p_utd431h314_rout_sUTD" , drop = FALSE ]

stopifnot( round( coefficients[ "HISPANIC" , ] , 3 ) == .711 )
stopifnot( round( coefficients[ "NON-HISPANIC WHITE ONLY" , ] , 3 ) == .742 )
stopifnot( round( coefficients[ "NON-HISPANIC BLACK ONLY" , ] , 3 ) == .647 )
stopifnot( round( standard_errors[ "HISPANIC" , ] , 3 ) == .015 )
stopifnot( round( standard_errors[ "NON-HISPANIC WHITE ONLY" , ] , 3 ) == .009 )
stopifnot( round( standard_errors[ "NON-HISPANIC BLACK ONLY" , ] , 3 ) == .022 )
stopifnot( round( coefficients[ "HISPANIC" , ] , 3 ) == .674 )
stopifnot( round( coefficients[ "NON-HISPANIC WHITE ONLY" , ] , 3 ) == .716 )
stopifnot( round( coefficients[ "NON-HISPANIC BLACK ONLY" , ] , 3 ) == .666 )
stopifnot( round( standard_errors[ "HISPANIC" , ] , 3 ) == .017 )
stopifnot( round( standard_errors[ "NON-HISPANIC WHITE ONLY" , ] , 3 ) == .008 )
stopifnot( round( standard_errors[ "NON-HISPANIC BLACK ONLY" , ] , 3 ) == .023 )
```

~~~
Expand Down
22 changes: 11 additions & 11 deletions nis.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ One Haiku:

## Download, Import, Preparation {-}

Download the fixed-width file:
Download the 2023 fixed-width file:
```{r eval = FALSE , results = "hide" }
dat_tf <- tempfile()
dat_url <- "https://ftp.cdc.gov/pub/Vaccines_NIS/NISPUF21.DAT"
dat_url <- "https://ftp.cdc.gov/pub/Vaccines_NIS/NISPUF23.DAT"
download.file( dat_url , dat_tf , mode = 'wb' )
```
Expand All @@ -73,7 +73,7 @@ library(Hmisc)
r_tf <- tempfile()
r_script_url <- "https://ftp.cdc.gov/pub/Vaccines_NIS/NISPUF21.R"
r_script_url <- "https://ftp.cdc.gov/pub/Vaccines_NIS/NISPUF23.R"
r_input_lines <- readLines( r_script_url )
Expand All @@ -90,7 +90,7 @@ writeLines( r_input_lines , r_tf )
source( r_tf , echo = TRUE )
# rename the resultant data.frame object
nis_df <- NISPUF21
nis_df <- NISPUF23
names( nis_df ) <- tolower( names( nis_df ) )
Expand Down Expand Up @@ -336,7 +336,7 @@ summary( glm_result )

## Replication Example {-}

This example matches the statistics and standard errors from [Data User's Guide Table 4](https://www.cdc.gov/vaccines/imz-managers/nis/downloads/NIS-PUF21-DUG.pdf#page=35):
This example matches the statistics and standard errors from [Data User's Guide Table 4](https://www.cdc.gov/nis/media/pdfs/2024/11/NISPUF23DUG.pdf#page=36):

```{r eval = FALSE , results = "hide" }
Expand All @@ -352,12 +352,12 @@ coefficients <- results[ , "p_utd431h314_rout_sUTD" , drop = FALSE ]
standard_errors <- results[ , "se.p_utd431h314_rout_sUTD" , drop = FALSE ]
stopifnot( round( coefficients[ "HISPANIC" , ] , 3 ) == .711 )
stopifnot( round( coefficients[ "NON-HISPANIC WHITE ONLY" , ] , 3 ) == .742 )
stopifnot( round( coefficients[ "NON-HISPANIC BLACK ONLY" , ] , 3 ) == .647 )
stopifnot( round( standard_errors[ "HISPANIC" , ] , 3 ) == .015 )
stopifnot( round( standard_errors[ "NON-HISPANIC WHITE ONLY" , ] , 3 ) == .009 )
stopifnot( round( standard_errors[ "NON-HISPANIC BLACK ONLY" , ] , 3 ) == .022 )
stopifnot( round( coefficients[ "HISPANIC" , ] , 3 ) == .674 )
stopifnot( round( coefficients[ "NON-HISPANIC WHITE ONLY" , ] , 3 ) == .716 )
stopifnot( round( coefficients[ "NON-HISPANIC BLACK ONLY" , ] , 3 ) == .666 )
stopifnot( round( standard_errors[ "HISPANIC" , ] , 3 ) == .017 )
stopifnot( round( standard_errors[ "NON-HISPANIC WHITE ONLY" , ] , 3 ) == .008 )
stopifnot( round( standard_errors[ "NON-HISPANIC BLACK ONLY" , ] , 3 ) == .023 )
```

---
Expand Down

0 comments on commit 0226a6c

Please sign in to comment.