Skip to content

Instantly share code, notes, and snippets.

@icaroagostino
Created August 15, 2020 19:10
Show Gist options
  • Save icaroagostino/33ee39147371986b7377705fdf6fce54 to your computer and use it in GitHub Desktop.
Save icaroagostino/33ee39147371986b7377705fdf6fce54 to your computer and use it in GitHub Desktop.
Exemplo para calculo do R0 utilizando o pacote R0 em R.
library(R0)
# Historico de casos
historico <- c( 3, 3, 2, 4, 3, 5, 1, 2, 4, 2,
10, 10, 7, 2, 3, 4, 6, 2, 15, 15,
12, 4, 14, 25, 21, 12, 18, 20, 4, 51,
20, 14, 17, 43, 15, 10, 18, 17, 15, 33,
20, 67, 43, 45, 44, 76, 27, 17, 25, 11,
61, 102, 3, 26, 16, 24)
# Tamanho da populacao
popSize <- 1000
# Parametro para gerar distribuição
shape <- 3.16
rate <- 1.52
# Gerar distribuicao
mGT <- generation.time('gamma', c(shape, rate))
# Calcular R0
estR0 <- estimate.R(historico,
mGT,
begin = 1,
end = 56,
methods = c("EG", "ML"),
pop.size = popSize, nsim = 100)
# Mostrar resultado
estR0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment