Vejamos a evolução da pandemia na América Latina para o mês de novembro.
library(tidyr)
##
## Attaching package: 'tidyr'
## The following object is masked _by_ '.GlobalEnv':
##
## population
#max(coronavirus$date)
data_november <- coronavirus %>% filter(country %in% south_america_b &
date >= '2020-11-01' & date <= '2020-11-25' &
type == "death") %>%
group_by(country, type, date) %>%
summarise(total_cases=sum(cases), .groups="drop") %>%
pivot_wider(names_from=type,
values_from=total_cases)# %>%
#arrange(-death)
data_november
## # A tibble: 300 × 3
## country date death
## <chr> <date> <dbl>
## 1 Argentina 2020-11-01 138
## 2 Argentina 2020-11-02 483
## 3 Argentina 2020-11-03 429
## 4 Argentina 2020-11-04 468
## 5 Argentina 2020-11-05 246
## 6 Argentina 2020-11-06 370
## 7 Argentina 2020-11-07 212
## 8 Argentina 2020-11-08 212
## 9 Argentina 2020-11-09 347
## 10 Argentina 2020-11-10 276
## # ℹ 290 more rows
round(mean(data_november$death, na.rm=TRUE))
## [1] 89
g1c <- ggplot(data=data_november, aes(x=date, y=death, colour=country)) +
geom_point(na.rm=TRUE) +
geom_line(size = 1) +
geom_hline(yintercept = mean(data_november$death, na.rm=TRUE),
linetype = 3, size=3.5, color="black") +
scale_x_date(date_breaks = "1 day", date_minor_breaks = "1 week",
date_labels = "%d") +
labs(title = "# Deaths COVID-19",
subtitle = "nov/2020",
y = "#deaths",
x = NULL,
color = NULL) +
theme_classic() +
guides(col = guide_legend(nrow = 2))+
theme(axis.title=element_text(size=8, face="italic"),
plot.caption = element_text(hjust = 0.0, size=8),
axis.line.y = element_blank(),
axis.line.x = element_line(lineend="round"),
axis.ticks.length.x =unit(0.2, "lines"),
axis.ticks.length.y =unit(0, "lines"),
axis.ticks.y = element_line(colour= "gray", size=1),
legend.background=element_rect(fill="white", colour=NA),
legend.position='top',
legend.justification='left',
legend.direction='horizontal',
legend.title=element_text(size=rel(0.8), face="bold", hjust=1),
panel.background=element_blank(),
panel.border=element_blank(),
panel.grid.minor = element_blank(),
panel.grid.major.y = element_line(colour= "gray",size=1),
plot.margin=unit(c(1, 1, 0.5, 0.5), "lines"),
plot.title=element_text(size=rel(1.2)),
strip.background=element_rect(fill="Set3", colour="Set2"),
strip.text.y=element_text(size=rel(0.8), angle=-90)
)
g1c
Para o mês de novembro os gráficos mostram que Brasil, Peru e Colômbia têm se mantido acima da média de mortes diárias por coronavírus na América Latina. Com exeção do Peru que ultrapassou a média de 85 mortes nos dias 4, 20 e 21, e dos 3 primeiros em mortes, o restante dos países da América Latina ficou abaixo deste valor. No dia 5 de novembro o número de mortes por coronavírus cadastrados no Brasil foi zero, indicando algum eventual problema.
data_november_br <- coronavirus %>% filter(country== "Brazil" &
date >= '2020-11-01' & date <= '2020-11-25' &
type == "death") %>%
group_by(country, type, date) %>%
summarise(total_cases=sum(cases), .groups="drop") %>%
pivot_wider(names_from=type,
values_from=total_cases)
data_november_br
## # A tibble: 25 × 3
## country date death
## <chr> <date> <dbl>
## 1 Brazil 2020-11-01 203
## 2 Brazil 2020-11-02 165
## 3 Brazil 2020-11-03 288
## 4 Brazil 2020-11-04 618
## 5 Brazil 2020-11-05 603
## 6 Brazil 2020-11-06 271
## 7 Brazil 2020-11-07 228
## 8 Brazil 2020-11-08 190
## 9 Brazil 2020-11-09 186
## 10 Brazil 2020-11-10 198
## # ℹ 15 more rows
g1d <- ggplot(data=data_november_br, aes(x=date, y=death, colour=country)) +
geom_point(na.rm=TRUE) +
geom_line(size = 1) +
geom_hline(yintercept = mean(data_november_br$death, na.rm=TRUE),
linetype = 2, size=1.5, color="black") +
scale_x_date(date_breaks = "2 day", date_minor_breaks = "1 week",
date_labels = "%d") +
labs(title = "# Deaths COVID-19",
subtitle = "nov/2020",
y = "#deaths",
x = NULL,
color = NULL) +
theme_classic() +
guides(col = guide_legend(nrow = 2))+
theme(axis.title=element_text(size=8, face="italic"),
plot.caption = element_text(hjust = 0.0, size=8),
axis.line.y = element_blank(),
axis.line.x = element_line(lineend="round"),
axis.ticks.length.x =unit(0.2, "lines"),
axis.ticks.length.y =unit(0, "lines"),
axis.ticks.y = element_line(colour= "gray", size=1),
legend.background=element_rect(fill="white", colour=NA),
legend.position='top',
legend.justification='left',
legend.direction='horizontal',
legend.title=element_text(size=rel(0.8), face="bold", hjust=1),
panel.background=element_blank(),
panel.border=element_blank(),
panel.grid.minor = element_blank(),
panel.grid.major.y = element_line(colour= "gray",size=1),
plot.margin=unit(c(1, 1, 0.5, 0.5), "lines"),
plot.title=element_text(size=rel(1.2)),
strip.background=element_rect(fill="Set3", colour="Set2"),
strip.text.y=element_text(size=rel(0.8), angle=-90)
)
g1d
round(mean(data_november_br$death, na.rm=TRUE))
## [1] 436
Olhando para o mÊs de novembro não é possível notar uma tendência que indique alguma possível estabilização do número de mortes por coronavírus no Brasil.
data_br <- coronavirus %>% filter(country== "Brazil" &
type == "death") %>%
group_by(country, type, date) %>%
summarise(total_cases=sum(cases), .groups="drop") %>%
pivot_wider(names_from=type,
values_from=total_cases)
data_br
## # A tibble: 1,143 × 3
## country date death
## <chr> <date> <dbl>
## 1 Brazil 2020-01-22 0
## 2 Brazil 2020-01-23 0
## 3 Brazil 2020-01-24 0
## 4 Brazil 2020-01-25 0
## 5 Brazil 2020-01-26 0
## 6 Brazil 2020-01-27 0
## 7 Brazil 2020-01-28 0
## 8 Brazil 2020-01-29 0
## 9 Brazil 2020-01-30 0
## 10 Brazil 2020-01-31 0
## # ℹ 1,133 more rows
g1f <- ggplot(data=data_br, aes(x=date, y=death, colour=country)) +
geom_col(mapping = aes(x=date, y=death), fill = "orange") +
geom_line(size=0.8, color="gray") +
geom_hline(yintercept = mean(data_br$death, na.rm=TRUE),
linetype=1, size=1.5, color="black") +
scale_x_date(date_breaks = "1 month", date_minor_breaks = "1 month",
date_labels = "%b/%y") +
labs(title = "# Deaths COVID-19 Brazil",
y = "#deaths",
x = NULL,
color = NULL) +
theme_classic() +
guides(col = guide_legend(nrow = 1))+
theme(axis.title=element_text(size=8, face="italic"),
plot.caption = element_blank(), #element_text(hjust = 0.0, size=8),
axis.line.y = element_blank(),
axis.line.x = element_line(lineend="round"),
axis.ticks.length.x =unit(0.2, "lines"),
axis.ticks.length.y =unit(0, "lines"),
axis.ticks.y = element_line(colour= "gray", size=1),
legend.background=element_rect(fill="white", colour=NA),
legend.position="none",#'top',
legend.justification='left',
legend.direction='horizontal',
legend.title=element_blank(), #element_text(size=rel(0.8), face="bold", hjust=1),
panel.background=element_blank(),
panel.border=element_blank(),
panel.grid.minor = element_blank(),
panel.grid.major.y = element_line(colour= "gray",size=1),
plot.margin=unit(c(1, 1, 0.5, 0.5), "lines"),
plot.title=element_text(size=rel(1.2)),
strip.background=element_rect(fill="Set3", colour="Set2"),
strip.text.y=element_text(size=rel(0.8), angle=-90)
)
g1f
?geom_smooth()
g1g <- ggplot(data=data_br, aes(x=date, y=death, colour=country)) +
geom_point() +
stat_smooth(method="loess", span=0.3, formula = y ~ poly(x, 1)) +
geom_hline(yintercept = mean(data_br$death, na.rm=TRUE),
linetype=1, size=1.5, color="black") +
scale_x_date(date_breaks = "1 month", date_minor_breaks = "1 month",
date_labels = "%b/%y") +
labs(title = "# Deaths COVID-19 Brazil",
y = "#deaths",
x = NULL,
color = NULL) +
theme_classic() +
guides(col = guide_legend(nrow = 1))+
theme(axis.title=element_text(size=8, face="italic"),
plot.caption = element_blank(), #element_text(hjust = 0.0, size=8),
axis.line.y = element_blank(),
axis.line.x = element_line(lineend="round"),
axis.ticks.length.x =unit(0.2, "lines"),
axis.ticks.length.y =unit(0, "lines"),
axis.ticks.y = element_line(colour= "gray", size=1),
legend.background=element_rect(fill="white", colour=NA),
legend.position="none",#'top',
legend.justification='left',
legend.direction='horizontal',
legend.title=element_blank(), #element_text(size=rel(0.8), face="bold", hjust=1),
panel.background=element_blank(),
panel.border=element_blank(),
panel.grid.minor = element_blank(),
panel.grid.major.y = element_line(colour= "gray",size=1),
plot.margin=unit(c(1, 1, 0.5, 0.5), "lines"),
plot.title=element_text(size=rel(1.2)),
strip.background=element_rect(fill="Set3", colour="Set2"),
strip.text.y=element_text(size=rel(0.8), angle=-90)
)
g1g
round(mean(data_br$death, na.rm=TRUE))
## [1] 612
Analisando a evolução do coronavírus desde o início de 2020 até o presente momento, pelo gráfico acima, nota-se que embora haja uma tendência de decaimento após agosto, no mês de novembro há um aumento no número de mortes por coronavírus. Destaca-se ainda que a média para o período é de 553 ao dia. Ainda não é possível afirmar que há uma tendência de diminuição efetiva no número de mortes, sendo que a curva exibida acima mostra o reflexo do efeito de uma mitigação inadequada no combate a pandemia.
data_br_cases <- coronavirus %>% filter(country== "Brazil" &
type == "confirmed") %>%
group_by(country, type, date) %>%
summarise(total_cases=sum(cases), .groups="drop") %>%
pivot_wider(names_from=type,
values_from=total_cases)
data_br_cases
## # A tibble: 1,143 × 3
## country date confirmed
## <chr> <date> <dbl>
## 1 Brazil 2020-01-22 0
## 2 Brazil 2020-01-23 0
## 3 Brazil 2020-01-24 0
## 4 Brazil 2020-01-25 0
## 5 Brazil 2020-01-26 0
## 6 Brazil 2020-01-27 0
## 7 Brazil 2020-01-28 0
## 8 Brazil 2020-01-29 0
## 9 Brazil 2020-01-30 0
## 10 Brazil 2020-01-31 0
## # ℹ 1,133 more rows
g2 <- ggplot(data=data_br_cases, aes(x=date, y=confirmed, colour=country)) +
geom_point() +
stat_smooth(method="loess", span=0.4, formula = y ~ poly(x, 1)) +
geom_hline(yintercept = mean(data_br_cases$confirmed, na.rm=TRUE),
linetype=1, size=1.5, color="black") +
scale_x_date(date_breaks = "1 month", date_minor_breaks = "1 month",
date_labels = "%b/%y") +
labs(title = "# Confirmed cases COVID-19 Brazil",
y = "#cases",
x = NULL,
color = NULL) +
theme_classic() +
guides(col = guide_legend(nrow = 1))+
theme(axis.title=element_text(size=8, face="italic"),
plot.caption = element_blank(), #element_text(hjust = 0.0, size=8),
axis.line.y = element_blank(),
axis.line.x = element_line(lineend="round"),
axis.ticks.length.x =unit(0.2, "lines"),
axis.ticks.length.y =unit(0, "lines"),
axis.ticks.y = element_line(colour= "gray", size=1),
legend.background=element_rect(fill="white", colour=NA),
legend.position="none",#'top',
legend.justification='left',
legend.direction='horizontal',
legend.title=element_blank(), #element_text(size=rel(0.8), face="bold", hjust=1),
panel.background=element_blank(),
panel.border=element_blank(),
panel.grid.minor = element_blank(),
panel.grid.major.y = element_line(colour= "gray",size=1),
plot.margin=unit(c(1, 1, 0.5, 0.5), "lines"),
plot.title=element_text(size=rel(1.2)),
strip.background=element_rect(fill="Set3", colour="Set2"),
strip.text.y=element_text(size=rel(0.8), angle=-90)
)
g2
round(mean(data_br_cases$confirmed, na.rm=TRUE))
## [1] 32437
O gráfico acima mostra o efeito de uma “segunda onda” de coronavírus atingindo o Brasil. Até meados de agosto a quantidade de casos de covid vinha diminuindo, mas no final de outubro houve uma mudança na inflexão da curva, passando então a refletir um aumento expressivo no número de casos confirmados. Mesmo com a diminuição no número de casos durante o mês de agosto e, principalmente em setembro, não foi possível o número de casos ficar abaixo da média de 20 mil casos por dia, valor considerado levando em conta todo período da pandemia.
Segundo especialistas, esse aumento se deve a ineficiência na implementação de medidas para combater o coronavírus. De fato, isso mostra que as várias recomendações no combate a doença não seguidas por muitos estados brasileiros começa a surtir efeito negativo no que tange a evolução da pandemia de coronavírus.
library(zoo)
library(tidyr)
data_br_cases_deaths <- coronavirus %>% filter(country== "Brazil" &
(type == "confirmed" | type == "death" )) %>%
group_by(country, type, date) %>%
summarise(total_cases=sum(cases), .groups="drop") %>%
pivot_wider(names_from=type,
values_from=total_cases)
head(data_br_cases_deaths)
## # A tibble: 6 × 4
## country date confirmed death
## <chr> <date> <dbl> <dbl>
## 1 Brazil 2020-01-22 0 0
## 2 Brazil 2020-01-23 0 0
## 3 Brazil 2020-01-24 0 0
## 4 Brazil 2020-01-25 0 0
## 5 Brazil 2020-01-26 0 0
## 6 Brazil 2020-01-27 0 0
names(data_br_cases_deaths)
## [1] "country" "date" "confirmed" "death"
movel <- data_br_cases_deaths %>%
mutate(média_móvel15=zoo::rollmean(confirmed, k=15, fill = NA, na.rm=TRUE))
#movel
g3 <- ggplot(data=movel, aes(x=date)) +
geom_bar(aes(y = confirmed, fill="#cases"),
stat="identity", alpha=0.6, na.rm=TRUE) +
geom_line(mapping=aes(x = date, y = média_móvel15, color="moving average"),
size=1.5, na.rm=TRUE) +
scale_colour_manual(" ", values=c("#cases"="violet", "moving average"="blue")) +
scale_fill_manual("",values="violet") +
labs(title = "Confirmed cases COVID-19",
subtitle = "Moving average (15 days) - Brazil",
y = "#cases",
x = NULL) +
scale_x_date(date_breaks = "2 month", date_minor_breaks = "1 month",
date_labels = "%b/%y") +
theme_classic() +
guides(col = guide_legend(nrow = 2))+
theme(axis.title=element_text(size=8, face="italic"),
plot.caption = element_text(hjust = 0.0, size=8),
axis.line.y = element_blank(),
axis.line.x = element_line(lineend="round"),
axis.ticks.length.x =unit(0.2, "lines"),
axis.ticks.length.y =unit(0, "lines"),
axis.ticks.y = element_line(colour= "gray", size=1),
legend.background=element_rect(fill="white", colour=NA),
legend.position='top',
legend.justification='left',
legend.direction='horizontal',
legend.title=element_text(size=rel(0.8), face="bold", hjust=1),
panel.background=element_blank(),
panel.border=element_blank(),
panel.grid.minor = element_blank(),
panel.grid.major.y = element_line(colour= "gray",size=1),
plot.margin=unit(c(1, 1, 0.5, 0.5), "lines"),
plot.title=element_text(size=rel(1.2)),
strip.background=element_rect(fill="Set3", colour="Set2"),
strip.text.y=element_text(size=rel(0.8), angle=-90)
)
movelb <- data_br_cases_deaths %>%
mutate(média_móvel15=zoo::rollmean(death, k=15, fill = NA, na.rm=TRUE))
g4 <- ggplot(data=movelb, aes(x=date)) +
geom_bar(aes(y=death, fill="#deaths"),
stat="identity", alpha=0.6, na.rm=TRUE) +
geom_line(mapping=aes(x=date, y=média_móvel15, color="moving average"),
size=1.5, na.rm=TRUE) +
scale_colour_manual(" ", values=c("#deaths"="lightgreen", "moving average"="orange")) +
scale_fill_manual("",values="lightgreen") +
labs(title = "Deaths COVID-19",
subtitle = "Moving average (15 days) - Brazil",
y = "#deaths",
x = NULL) +
scale_x_date(date_breaks = "2 month", date_minor_breaks = "1 month",
date_labels = "%b/%y") +
theme_classic() +
guides(col = guide_legend(nrow = 2))+
theme(axis.title=element_text(size=8, face="italic"),
plot.caption = element_text(hjust = 0.0, size=8),
axis.line.y = element_blank(),
axis.line.x = element_line(lineend="round"),
axis.ticks.length.x =unit(0.2, "lines"),
axis.ticks.length.y =unit(0, "lines"),
axis.ticks.y = element_line(colour= "gray", size=1),
legend.background=element_rect(fill="white", colour=NA),
legend.position='top',
legend.justification='left',
legend.direction='horizontal',
legend.title=element_text(size=rel(0.8), face="bold", hjust=1),
panel.background=element_blank(),
panel.border=element_blank(),
panel.grid.minor = element_blank(),
panel.grid.major.y = element_line(colour= "gray",size=1),
plot.margin=unit(c(1, 1, 0.5, 0.5), "lines"),
plot.title=element_text(size=rel(1.2)),
strip.background=element_rect(fill="Set3", colour="Set2"),
strip.text.y=element_text(size=rel(0.8), angle=-90)
)
library("gridExtra")
##
## Attaching package: 'gridExtra'
## The following object is masked from 'package:dplyr':
##
## combine
grid.arrange(g3, g4, nrow=1, ncol=2)
Os gráficos acima mostram a proximidade na evolução entre o número de mortes por coronavírus e o número de casos. Nota-se que ambos valores possuem muita semelhança, sendo que o mês no novembro notamos o a tendência de um novo crescimento de coronavírus no Brasil.
[1] R package: coronavirus https://github.com/RamiKrispin/coronavirus
[2] COVID-19 pandemic https://en.wikipedia.org/wiki/COVID-19_pandemic
[3] Coronavírus: ‘Brasil já está na 2ª onda de covid-19’, diz pesquisador da USP https://www.bbc.com/portuguese/brasil-54982109