title | output |
---|---|
Brazil mortality replication code |
html_document |
It is likely that you have different versions of R and specific R packages than we did when we wrote our code. Thus, we recommend using Docker to replicate our results. Using Docker will ensure that you have exactly the same computing environment that we did when we conducted our analyses.
To use Docker
-
Install Docker Desktop (if you don't already have it)
-
Clone this repository
-
Be sure that your current working directory is the one that you downloaded the repository into. It's probably called
brazil-mortality-release/
-
If you are using a recent Mac (with Apple silicon), then you might need to type
export DOCKER_DEFAULT_PLATFORM=linux/amd64
-
Build the docker image.
docker build --rm -t brazil-replication .
This step will likely take a little time, as Docker builds your image (including installing various R packages) -
Run the docker image
docker run -d --rm -p 8888:8787 -e PASSWORD=pass --name brazil brazil-replication
OR, to mount a local drive, you will need something like:docker run -d --rm -p 8888:8787 -e PASSWORD=pass --name brazil -v $(pwd):/home/rstudio/ brazil-replication
-
Open a web browser and point it to localhost:8888
-
Log onto Rstudio with username 'rstudio' and password 'pass'
-
Open the file
brazil-mortality-release/code/00_run_all.r
-
Running the file should download the data and replicate everything.
This directory contains the files that produce estimates from the sibling and network methods, and then compares those estimates to the vital registration data.
It is organized into subdirectories:
code
- has R scripts00_run_all.R
- a script that downloads the data and runs everything00_sample_map.Rmd
- create the map showing the cities in our sample01_vr_completeness.Rmd
- summarize estimated VR completeness by city02_get_vr_estimates.Rmd
- calculate VR death rates for each city and region03_network_estimates.Rmd
- calculate network estimates04_sibling_estimates.Rmd
- calculate sibling estimates05_run_comparison.Rmd
- run comparisons between estimates and the vital registration06_plots.Rmd
- make several plots99_vr_comparison.Rmd
- has the code that compares estimates to VR; only to be run by00_run_all.R
data
- has the data used in the analysis; this will be downloaded by00_run_all.R
cities.csv
- data on the cities in our studyibge-capture-recapture
- results from IBGE's capture-recapture studysurvey
- data from the surveybootstrap_weights_1k.csv
- bootstrap resampling weights that account for our survey's complex sample designindividual.csv
- data on the respondents to the surveynetwork_reports.csv
- data on deaths reported in the network part of the survey (one row per reported death)sibling_reports.csv
- data on siblings reported in the sibling module (one row per reported sib)
vr
- raw vital registration datadeaths
- data on deathspopn
- data on popn size
vr_prepped
- VR data after being prepared for comparison (created by script)
A small part of our results are not produced by the code included here, because they depend on data that we cannot release (because they have identifiers). These results include:
- The response rates presented in Table S2
- The numbers shown in Figure S2
- The numbers shown in Figure S3