Theoretical details can be seen in our preprint:
Avelar, P. H. da C., Lamb, L. C., Tsoka, S., & Cardoso-Silva, J. (2021). Weekly Bayesian modelling strategy to predict deaths by COVID-19: a model and case study for the state of Santa Catarina, Brazil. (preprint) http://arxiv.org/abs/2104.01133
If you reuse this code, please cite the reference above.
In case you encounter any problems replicating this code or have any suggestions, you can open a new issue here on Github.
Ideas, questions and other general comments can be made at the Discussions page.
You can see our project board here.
Tutorials are available in Brazilian Portuguese (PT-BR):
Our earlier reports (2020) with weekly experiments and testes are available online every at this dedicated Social Good Brasil website.
If you want to understand how R packages work, this online book is the best source for it.
If you are using Debian-based Linux distributions, the following packages have to be installed prior to installing the R dependencies:
sudo apt install libcurl4-openssl-dev libssl-dev libxml2-dev libv8-dev
First, install the following packages to be able to build the package locally in your machine and run the scripts:
Now, you need to install the R packages below to get it to work for you. The easiest way to do this is by opening your terminal and running the script:
R -f install_dependencies.R
This will guarantee that you have the same setup as the developers of the project:
If you are using RStudio, create a new project by using the parent directory. Otherwise, if you want to run it from the command line, just go to the project directory: cd modelo-epidemiologico-sc
.
Within an R terminal, run the following commands to build both epiCata
and epiCataPlot
packages:
setwd("epiCata")
devtools::build()
devtools::install(upgrade="never")
setwd("../")
setwd("epiCataPlot")
devtools::build()
devtools::install(upgrade="never")
setwd("../")
After this, make sure that both libraries are accessible and installed with:
library(epiCataPlot)
library(epiCata)
The current standard way of running the model is by following the steps below:
Place required data in the parent directory: deaths.csv
and Global_Mobility_Report.csv
. For information on how to obtain death data for Santa Catarina, refer to Tutorial 01 (currently available only in Brazilian Portuguese) and see sections below to understand how to download these data.
Run scripts A and B simultaneously to make a better use of time. For example, to use base-reported.stan
model with 4000 iterations (2000 of which are warmup), 4 chains and a max tree depth of 9, you can run the commands:
nohup Rscript run_health_regions_A.R -u "base-reported" -m DEVELOP -k 7 -i 4000 -w 2000 -c 4 -t 9 -r "2021-07-19" > ../logs/health-regions-B-base-reported-2021-07-19-DEVELOP-4000-2000-4-9.out &
and
nohup Rscript run_health_regions_B.R -u "base-reported" -m DEVELOP -k 7 -i 4000 -w 2000 -c 4 -t 9 -r "2021-07-19" > ../logs/health-regions-B-base-reported-2021-07-19-DEVELOP-4000-2000-4-9.out &
tail
or, prettier, with multitail
command. Example:multitail -c ../logs/health-regions-A-base-reported-2021-07-19-DEVELOP-4000-2000-4-9.out
multitail -c ../logs/health-regions-B-base-reported-2021-07-19-DEVELOP-4000-2000-4-9.out
Rscript combine_independent_results.R -u "base-reported" -m DEVELOP -k 7 -i 4000 -w 2000 -c 4 -t 9 -r "2021-07-19"
Use the same parameters just to make sure names and dates are properly referenced.
Have a look at the generated figures, which will usually be saved by default to the path ../figures/YYYY_MM_DD
and a .Rdata file will be saved to ../results/YYYY_MM_DD
To generate plots with the same format as in the reports, use :
cd epiCataDashboard/dashboard_results/
vim plot_report.R #edit the reference date
R -f plot_report.R