Background
“
The COVID-19 pandemic has significantly impacted communities
worldwide, and Toronto, as one of Canada’s largest and most populous
cities, has been no exception. The analysis of COVID-19 data in Toronto
provides crucial insights into the spread of the virus, also the level
of spread.
Prior to executing the code, kindly adhere to the provided
instructions
Please install the following packages to run
the program smoothly
- library(ggthemes)
- library(ggrepel)
- library(hrbrthemes)
- library(ggridges)
- library(gganimate)
- library(babynames)
- library(RColorBrewer)
- library(scales)
- library(viridis)
- library(eurostat)
- library(kableExtra)
- library(lubridate)
- library(tidyverse)
- library(dplyr)
- library(ggsignif)
- library(summarytools)
- library(corrplot)
Types of Analysis we are doing
- Age Group Level Analysis and Their
Contribution
- Tracking COVID-19: Monthly and Yearly Case
Count
- Analysis of COVID-19 by Gender in Toronto Over
Years
- Case Level Analysis
- Frequency Analysis of COVID-19 at the Source
Level
- T-Test: Two Independent Groups (Below 30 and Above
30)
- Correlation Plot: COVID Case Analysis
Trend Analysis
Unveiling Demographic Dynamics: An In-Depth Exploration of
COVID-19 Impact through Age Group Level Analysis and
Contribution
Introduction:
As we look at how COVID-19 is affecting Toronto, it’s
important to check out different age groups. This study is all about
that. We’re going to dive into the details of how different age ranges
impact the way the virus is spreading. We’ll look at the numbers of
confirmed and likely cases across age groups, trying to find patterns
and understand who might be more vulnerable. This will help us see the
unique situations each age group brings to the COVID-19 story in
Toronto. Come along as we uncover the interesting stuff hidden in the
age group data. It’s like putting on glasses to see the challenges
COVID-19 is throwing at Toronto more clearly.
1. Table -1 Breakdown of Age Groups and Their
Influence
Total Cases by Age Group
|
Age.Group
|
Total_cases
|
Male
|
Female
|
contribution
|
|
19 and younger
|
55077
|
27965
|
26681
|
13.44 %
|
|
20 to 29 Years
|
77452
|
35400
|
40850
|
18.9 %
|
|
30 to 39 Years
|
73292
|
33566
|
38946
|
17.88 %
|
|
40 to 49 Years
|
56970
|
24612
|
31818
|
13.9 %
|
|
50 to 59 Years
|
52610
|
23493
|
28664
|
12.84 %
|
|
60 to 69 Years
|
35282
|
17262
|
17762
|
8.61 %
|
|
70 to 79 Years
|
23321
|
11698
|
11539
|
5.69 %
|
|
80 to 89 Years
|
22216
|
9302
|
12861
|
5.42 %
|
|
90 and older
|
13664
|
4177
|
9456
|
3.33 %
|
Major Findings
The table shows the percentage of total cases by age group. The
highest percentage of cases is in the 20-29 age group, followed by the
30-39 age group and the 40-49 age group. The percentage of cases
decreases with age, with the lowest percentage of cases in the 90 and
older age group.
This suggests that younger people are more likely to contract
COVID-19 than older people. This may be due to a number of factors, such
as younger people being more likely to socialize and participate in
activities that put them at risk of exposure to the virus, as well as
younger people having stronger immune systems, which may make them more
likely to show symptoms of COVID-19.
2. Graph-1 Breakdown of Age Groups and Their
Influence

3. Tracking COVID-19: Monthly and Yearly Case Count - Bar
plot
Introduction:
Let’s take a step back in time to see how many COVID-19 cases
popped up each month and year. This look into the past helps us spot any
patterns and understand how the virus has changed over time. Come along
as we explore the numbers and get a clearer picture of how the situation
unfolded month by month.

4. Tracking COVID-19: Monthly and Yearly Case Count - Line
plot

Major Findings
The graph shows that the number of COVID-19 cases in Toronto has
fluctuated over time, with four distinct waves of cases occurring since
the start of the pandemic. The first wave, which occurred in the spring
of 2020, was the largest, with over 20,000 cases reported in that month.
The subsequent waves have been smaller, with the largest number of cases
reported in the second wave at around 40,000 cases per month,Especially
the end of 2021 and starting of 2022 we have a significant surge in
covid 19 cases which exceeded more than 50,000 per month.
5. Mapping Peaks: Identifying Monthly COVID-19 Spikes with
Density Plots
Introduction:
In our exploration of COVID-19 trends at a monthly level, we’re
honing in on the moments when the virus made a significant jump. This
analysis utilizes density plots to highlight those spikes, giving us a
clear visual of the intensity each month.

Major Findings
The graph shows that the number of cases increased steadily from
January to April. In May, the number of cases peaked and then began to
decline. The number of cases continued to decline in June and July, but
then began to increase again in August. In September and October, the
number of cases plateaued. In November, the number of cases began to
increase again, and in December, the number of cases reached a new
peak.
Gender Analysis
1. Analysis of COVID-19 by Gender in Toronto over
years.
The graph shows that the total number of confirmed cases is
higher for women than for men in all years except for 2020. This is
likely due to a number of factors, including the fact that women are
more likely to work in healthcare and other front-line occupations, and
the fact that women are more likely to have underlying health conditions
that make them more vulnerable to COVID-19.

2. Analysis of gender - frequency of confirmed
cases
The graph shows that the female population has the highest
number of confirmed cases, followed by the male population. The
non-binary, not listed,other, trans man, trans woman, transgender, and
unknown populations have relatively fewer confirmed cases.
Graph -1 Box-plot

Graph -2 Bar-plot with year

Case Level Analysis
1. Table case level analysis
It shows that for confirmed cases, the vast majority (98.33%)
have recovered, with a mere 0.4% still active. This suggests that the
vast majority of those who contracted COVID-19 have successfully fought
off the infection. The statement further draws a
parallel to probable COVID-19 cases, indicating that a similar trend is
observed. In probable cases, 99.49% have resolved, while only 0.35%
remain active and 0.17% have fatal outcomes. This implies that probable
cases also exhibit a high recovery rate, with only a small fraction
leading to fatalities.
Total Cases by Classification, and Outcome
|
Classification
|
Outcome
|
Total_cases
|
Ever_Hospitalized
|
Ever_in_ICU
|
Ever_Intubated
|
contribution
|
|
CONFIRMED
|
ACTIVE
|
1575
|
96
|
12
|
8
|
0.4 %
|
|
CONFIRMED
|
FATAL
|
5013
|
3285
|
1195
|
852
|
1.27 %
|
|
CONFIRMED
|
RESOLVED
|
388730
|
14754
|
1828
|
873
|
98.33 %
|
|
PROBABLE
|
ACTIVE
|
52
|
0
|
0
|
0
|
0.35 %
|
|
PROBABLE
|
FATAL
|
25
|
4
|
1
|
1
|
0.17 %
|
|
PROBABLE
|
RESOLVED
|
14911
|
50
|
7
|
2
|
99.49 %
|
2. Graph Case level Analysis
the graph shows the representation of total cases by
classification

3. Analysis of COVID-19 at the source level in
Toronto.
This data provides insights into the distribution of cases based
on the sources of infection. It highlights the importance of categories
like community, close contact, and healthcare institutions in
contributing to the total number of cases. Additionally, a significant
portion of cases (50.76%) has no information regarding the source of
infection.

3.1 frequency Analysis of COVID-19 at the source level in
Toronto.

Primary Sources of Infection:
1. Community (28.91%): The community is a significant source of
infection, indicating that a substantial portion of cases is originating
from general interactions within the community.
2. Close Contact (7.14%): While not as prominent as the
community, close contact still plays a notable role in the spread of the
infection.
3. Household Contact (14.34%): Infections within households
contribute significantly, highlighting the importance of preventive
measures within family settings.
4. criticality of cases Vs Source of infection
Examining the criticality of COVID-19 cases involves a specific
focus on individuals who have experienced hospitalization, ICU
admission, or intubation. This analysis further centers on determining
the source through which individuals contracted the virus. By assessing
the number of hospitalizations and ICU admissions attributed to each
source, the goal is to identify and prioritize sources that warrant
heightened caution and preventive measures
Looking at all the information, it’s clear that most people are
getting COVID-19 from the community, and a lot of them end up in the
hospital because of it. The same goes for the healthcare sector – more
people from there are getting hospitalized compared to other sources.
Also, when it comes to serious cases needing ICU care or a ventilator,
the numbers follow a similar pattern for different sources. This tells
us that we need to be extra careful in the community and healthcare
settings because that’s where the risk of getting really sick is
higher
Correlation
Correlation Plot
This correlation plot examines the relationship between ICU
admissions and hospitalizations resulting from COVID-19 in Toronto. By
visualizing this connection we are aim to see any relation between these
two variables

Correlation Matrix
Variables we are considering
- Total Cases
- Ever Hospitalized
- Ever In ICU
- Ever Intubated
We are doing a correlation matrix to understand the relation between
all these 4 matrix and which is more related to each other
## Total_cases Ever_Hospitalized Ever_in_ICU Ever_Intubated
## Total_cases 1.0000000 0.7307022 0.6634514 0.6290552
## Ever_Hospitalized 0.7307022 1.0000000 0.9767905 0.9646499
## Ever_in_ICU 0.6634514 0.9767905 1.0000000 0.9940267
## Ever_Intubated 0.6290552 0.9646499 0.9940267 1.0000000

####Result
- correlation coefficients for the variables
- Total_cases and Ever_Hospitalized: 0.730
- Total_cases and Ever_in_ICU: 0.663
- Total_cases and Ever_Intubated: 0.629
- Ever_Hospitalized and Ever_in_ICU: 0.976
- Ever_Hospitalized and Ever_Intubated: 0.964
- Ever_in_ICU and Ever_Intubated: 0.994
These coefficients suggest positive correlations between all
pairs of variables, with stronger correlations between Ever_Hospitalized
and both Ever_in_ICU and Ever_Intubated. The values close to 1 indicate
a strong positive linear relationship between these
variables.