covid19BH: Covid-19 data for Belo Horizonte/MG - Brazil

covid19BHR Documentation

Covid-19 data for Belo Horizonte/MG - Brazil

Description

The purpose of this page is to show the user how to format the Y input argument in the pandemic_model function, when epidemiological data was obtained outside of the load_covid function.

The Covid-19 data for the city of Belo Horizonte, MG - Brazil will be used to illustrate how to correctly format the epidemiological data required in the pandemic_model function, using the function format_data. See the Examples section.

For complete information on the required data format, check the Y input argument description in ?pandemic_model.

Usage

covid19BH

Format

This data frame has 103 observations and 6 variables. It contains the number of Covid-19 confirmed cases and deaths for the city of Belo Horizonte, from the date of the first notified case in 2020-03-16 to 2020-06-26.

  1. date - dates in the YYYY-MM-DD format

  2. new_confirmed - number of new cases

  3. new_deaths - number of new deaths

  4. last_available_confirmed - cumulative number of cases

  5. last_available_deaths - cumulative number of deaths

  6. estimated_population_2019 - size of Belo Horizonte's population

Source

https://brasil.io/dataset/covid19

References

CovidLP Team, 2020. CovidLP: Short and Long-term Prediction for COVID-19. Departamento de Estatistica. UFMG, Brazil. URL: http://est.ufmg.br/covidlp/home/en/

See Also

load_covid, format_data, pandemic_model, posterior_predict.pandemicEstimated, pandemic_stats and plot.pandemicPredicted.

Examples

## formating the data frame for pandemic_model function

#loading data
data <- covid19BH
data
names(data)

#re-order data in ascending order
class(data$date)
data$date = as.Date(data$date)
class(data$date)
data <- data[order(data$date), ]
head(data)

# building the Y list required
start <- data$date[1]
end <- data$date[nrow(data)]
cases <- data$last_available_confirmed
new_cases <- data$new_confirmed
deaths <- data$last_available_deaths
new_deaths <- data$new_deaths
pop <- data$estimated_population_2019[1]

Y <- format_data(s_date = start, e_date = end,
                 cases = cases, n_cases = new_cases,
                 deaths = deaths, n_deaths = new_deaths,
                 name = "Belo Horizonte/MG", pop = pop)
Y
plot(Y)

## fitted model:
##pandemic_model function may take a few minutes...
## Not run: 
outputBH = pandemic_model(Y, control = list(max_treedepth = 50, adapt_delta = 0.999))
outputBH

summary(outputBH)

##convergence diagnostics
traceplot(outputBH)
density(outputBH)
stan_ac(outputBH$fit, pars = c("a","b","c","f"))

## making predictions
predictions = posterior_predict(outputBH)

## calculating prediction intervals and statistics
stats = pandemic_stats(predictions)

## plotting results
plot(predictions)
## End(Not run)

PandemicLP documentation built on March 18, 2022, 6:22 p.m.