A website to share code and data from our paper about effects of ACF on TB notifications in Blantyre
This website is show code to accompany the paper XXXXX.
The work is an interupted time series about the impact of Active Case Finding for TB on TB Case Notifications in Blantyre.
The github repo is at https://github.com/rachaelmburke/tbacf
To summarise:
Contents: This website has “knitted” Rmarkdown files to show our code. Data needed is in the “mlwdata” package and in the github repo under “data_sharing” folder.
Repo: Over in the github repo you can have the unknitted .rmd files, which you should be able to use on your own computer (in the “docs” subfolder). I have made extensive use of the “here” package with a file root in the main github repo (i.e. not in the “docs” subfolder), but you might find you nonetheless you will probably need to fix some relative file paths. If you work through the four .rmd files in order and create a “data” folder locally, each markdown will save files needed for subsequent markdown files. The only thing not included here is shape files to recreate the map (the basemap is open source), so b_tableandfig.rmd will not run straight through. We are working on confirming if we can make these freely available and will add in due course if possible.
Documents:
A Setup: Gets data from “mlwdata” package (which is at github/petermacp/mlwdata) and from “extra_info.rds” (in “data_sharing” on this repo) and wrangles into format needed for these analyses. We use both “long” (one row per person diagnosed with TB) data and “grouped” data (grouped in number diagnosed per quarter - often by Bac+ vs. Bac- and by ACF area vs. non-ACF area).
B Tables and Figs: Draws figure 1 (map of ACF vs. non-ACF areas), figure 2 (CNRs over time by area and method of diagnosis) and the numbers referenced in text. Also draws a “base graph” of observed CNRs over time (this gets addedd to in d_tableandfig.rmd) to put the modelled prediction and counterfactual lines.
C Analysis: Runs models for predicting “real” vs. counterfactual [no ACF] scenarios, the difference and the CI of the difference. For details see the paper. Briefly there is a “without control” (“woc”) set of models looking at time trends only within the ACF areas, and a “with control” (“wc”) that compares trends in ACF areas with pre-ACF trends and trends in non-ACF areas. For each set of models we consider Bac+ and all form TB seperately. We calculate sum of difference in cases between observed v. counterfactual, and the difference in mean CNR. We use delta method to calculate CIs of these differences. See paper, and in particular appendix for more information. Appendix is in “files” folder in main repo.
D Tables and Figs: Draws graphs of predictions from all models (for figure 3 in paper.)
Final NB: This website is made with “distill” and github (wonderful - thank you! See https://rstudio4edu.github.io/rstudio4edu-book/intro-distill.html). I know some of the annotation in code chunks is cut off on most web-browers and I don’t think distill supports adding horiztonal scroll or making code much smaller. All details can be see in the R markdown files on the repo, or (as a work around) if you go to the site on a mobile webbrowser, horziontal scrolling is implemented and you can see the full width of the lines.
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.