<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Connornew on Medium]]></title>
        <description><![CDATA[Stories by Connornew on Medium]]></description>
        <link>https://medium.com/@connornew?source=rss-8b675a6756a0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*xzxSoRrmFcduLxs6</url>
            <title>Stories by Connornew on Medium</title>
            <link>https://medium.com/@connornew?source=rss-8b675a6756a0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 04:11:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@connornew/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Application of Data Analytics to Key Decision Making By NFL Coaches]]></title>
            <link>https://medium.com/@connornew/the-application-of-data-analytics-to-key-decision-making-by-nfl-coaches-7079f5f29b47?source=rss-8b675a6756a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/7079f5f29b47</guid>
            <category><![CDATA[analytics]]></category>
            <category><![CDATA[regression]]></category>
            <category><![CDATA[classification]]></category>
            <category><![CDATA[sports]]></category>
            <category><![CDATA[nfl]]></category>
            <dc:creator><![CDATA[Connornew]]></dc:creator>
            <pubDate>Wed, 17 Jun 2020 17:38:40 GMT</pubDate>
            <atom:updated>2020-06-17T17:38:40.604Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Introduction</strong></p><p>The National Football League (NFL) is one of the most successful sport leagues in the world with an approximate revenue of $16 billion (USD) in 2018 (Colangelo, 2019). The amount of financial motivation for teams as well as players to win and compete is tremendous. For example, players and coaches that negotiate performance based incentives into their contracts can receive up to $6.5 million in bonuses (ESPN, 2017). With this amount of monetary gain attainable, the importance of every play is critical. Sports are a fascinating industry where on a given night many outcomes are possible. The unpredictability of football has extended to where the NFL is one of the most popular leagues for gambling. In 2020 it was estimated in the United States alone, $6.8 billion would be gambled on the NFL’s championship game, referred to as the Super Bowl (Meltzer, 2020). The magnitude of the money that can be lost or made raises the question; Is there a way to predict the outcomes of plays before they happen? If so, can coaches apply these methods to ensure their teams success? What many football fans do not understand when watching their favorite team, is the amount of data analytics that goes into a team’s strategy. It was not until 2014 that NFL teams began adopting data analytics when the Philadelphia Eagles began incorporating analytics into all decisions (Awbrey, 2020). The Eagles went on to win their first ever Super Bowl in 2018 as extreme underdogs. Afterwards, Eagles Head Coach, Doug Peterson, spoke to his utilization of data analytics and its importance in winning football games. Peterson stated he is constantly in communication with another coach who determines success rates of the current play, in addition to the success of future plays based on various outcomes of the current play (Feng, 2018). I argue that the development of analytical models to predict the outcome of offensive plays can supplement both offensive and defensive coaches decision making, while improving their teams likelihood of winning games. The models that can provide the greatest benefit to coaches are those that can predict; the type of play an offensive team will run, the amount of yards from that play, classify if the play poses a large risk, and whether the team should take a chance on fourth down. Data provided by the NFL from a Big Data Competition will be used in the development of these models. This data depicts the real time information for every player on every play from the 2019 season. Additionally, data capturing the play by play breakdown from the 2019 season will be applied. The second data set is beneficial because it focuses less on individual players and more around the circumstances of the play. A detailed explanation of each data set and its variables is listed in Appendix A. For readers that are not familiar with football, the next section explains common terminology and the rules of football.</p><p><strong>Football’s Objective</strong></p><p><a href="https://www.youtube.com/watch?v=3t6hM5tRlfA">A brief holistic explanation of football can be found following this link.</a></p><p>Like most sports, the objective of football is to score more points than the opposing team throughout four quarters. A team can score points in many different ways, but for simplicity we will focus only on touchdowns. A touchdown is when one team is able to possess the football in the other teams endzone. Figure 1 displays the dimensions (yards) of a football field with red endzones. In order for the offensive team to retain possession of the football they must move the football ten yards towards the defending teams endzone. The offense gets four tries, called downs, to move the ball ten yards. If the team is able to move the ball ten yards, the downs reset to one. If the ball cannot be moved ten yards in four downs, the offense either has to kick the ball away or attempt the fourth down. Teams kick the ball because it makes the opposing team have to travel farther to score a touchdown. If a team were to undertake the fourth down successfully, the downs would reset at one. But if they failed, the opposing team gets the ball where the offensive team failed. Deciding whether the fourth down risk is worth it, is one of football’s greatest strategic decisions. This decision has tremendous impact on the game and if unsuccessful can hurt a team’s chances at winning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GkvAoGh1bGjfBIXmRd-KXw.png" /><figcaption><strong>Figure 1 — Football Field Diagram</strong></figcaption></figure><p><strong>Offense</strong></p><p>It is important to understand the offensive side of the ball to follow the models that will be developed later one. In football there is eleven players that are on the field for each team. As mentioned above, downs are the amount of tries a team has had to move the ball ten yards. Downs range from 1–4. Each time a play happens the number of yards needed to reach the required ten yards changes. This value is represented as the To Go variable throughout this project. If the offense ends up losing yards, To Go can be greater than ten. The ball can be moved by throwing the ball (passing) or running the ball (rushing). Another variable that is used is the Series First Down variable. A series is the set of plays an offense runs until they get a touchdown or turn the ball over to the defense. The Series First Down variable is a Boolean value, true or false, to signal whether the play occurred at the at the beginning of a series. This variable can be important because when the offense is not on the field, they have time to discuss and plan future plays with coaches. Therefore, the first plays of a series may behave differently than others. Line of scrimmage is a term used in football. Before a play the ball is on the ground where it is snapped (throw backwards to the quarterback) and the play begins. The line of scrimmage simply states what yard line the ball is placed on. Refer to Figure 1 to see each yard line. Lastly, the offense can position themselves in many different ways. Each arrangement corresponds to a different formation. Formations can be complicated to understand. However for the scope of this project, the reader only needs to be aware that different formations exist and they are simply the way the offense aligns before a play.</p><p><strong>Defense</strong></p><p>The goal of the defense is to get to the fourth down as fast as possible and prevent the offense from scoring. This project focuses on offense terminology and in result does not require much background knowledge on defense. A variable that will be used is the number of defenders in the box. The number of defenders in the box is simply a count of defensive players that are in an imaginary box on the football field. Figure 2 displays a visual of this box. In this picture the red team is the offense and the white team is the defense. This box is based on where the offensive players line up for the play. The idea of this variable is to quantify defensive pressure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8yal7bYOnGd565W8CkHngw.png" /><figcaption><strong>Figure 2 — Defenders in The Box Visual</strong></figcaption></figure><p><strong>Data Exploration</strong></p><p>When approaching an analytical problem, a crucial first step is the exploration of data. Investigating data and the relations of variables allows analysts to better understand what they’re working with, and begin developing ideas for models. Data exploration is a very general statistical method and cannot prove causation. The greatest take away from plotting data is identifying what variables appear to be correlated. The visuals that will be examined below relate to yards and play type because these are values that quantify play outcomes.</p><p><strong>Visualizations Using Yards As The Outcome Metric</strong></p><p>Figure 3 displays the relationship between yards and defenders in the box. It appears that defenses are prone to giving up more yards on plays when 6 or 7 defenders are in the box. One interpretation of this result could relate to the large volume of data points at these values. If more plays occur where 6 or 7 defenders are in the box, the opportunities for bigger plays to happen is increased. Figure 3 has a bell shaped distribution. This observation suggests that yards goes down when there are many defenders and few defenders in the box. A rationale for the normal distribution may be that yards decreases when there are 3–5 defenders in the box because the defense knows the offense is going to throw the ball and responds accordingly. The opposite can be said for 9–11 defenders, yards are reduced because the defense knows the offense is going to try to run the ball and they fill the box.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zImmMO-2EJ-NJwqZidwBlQ.png" /><figcaption><strong>Figure 3 — Defenders in The Box Compared to Yards</strong></figcaption></figure><p>Switching to the other side of the ball, Figure 4 compares the formation of the offensive team to the yards generated. Similar to Figure 3, it appears certain formations have the ability to generate big yardage. These formations are single back and I Form. Formations such as empty and wildcat also tend to yield lower yards. Wildcat is not a surprising result because the formation does not have a quarterback. Without a quarterback, gaining substantial yards tends be difficult. Additionally, the empty formation is designed so that the quarterback has less protection against defenders. This lack of security may relate to the reduced yards.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1yuRqIrUuoxfdsHtbHasuA.png" /><figcaption><strong>Figure 4 — Offense Formation Compared to Yards</strong></figcaption></figure><p>An extension of offensive formation is the actual positions on the field. Different positions have different roles such as; throwing the ball, running the ball, catching the ball, or protecting the ball carriers. Based on the personnel on the field, the yards of a play may be effected. This relation is presented in Figure 5. The Y-axis of Figure 5 lists all of the personnel groupings and their yards achieved. The letters on the Y-Axis correspond to the positions, whereas the number represents the amount of players on the field at those positions (i.e. 7 OL indicates seven offensive linemen). Figure 5 does not appear to present potential correlations. Additionally, similar data is communicated through Figure 4. For these reasons, this relationship will not be further explored in the models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7qld_QwfqvODxK-UTCqT-A.png" /><figcaption><strong>Figure 5 — Offense Personnel Compared to Yards</strong></figcaption></figure><p>How the difference between the time of a handoff and time of the snap compares to yards is an interesting correlation. This relationship can be seen in Figure 6. The snap is the movement that begins a play, and the hand off is when the quarterback gives the ball to the running back on a rushing play. Figure 6 suggests only plays with a difference of 1 or 2 seconds between snap and hand off will generate over 25 yards. This observation is likely linked to the reaction speed of the defense. If the ball is not handed off within 2 seconds, the defense will have applied pressure and the opportunity to gain larger yards is lost. A greater difference in time also allows the defense to recognize the play type is a run and adjust accordingly. A majority of the data is located at 1 or 2 seconds on the X-axis. Therefore, the likelihood of breakout plays is greater for these values. The data’s precision only goes until seconds. In reality Figure 6 should be plotted to show the millisecond decimal places of time between hand off and snap to show a more accurate depiction of this data. Grouping the data in Figure 6 as 0, 1, 2, 3, 4, or 5 seconds is too general of a measurement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oFSUIzKRmGMZUzc0gBSgqg.png" /><figcaption><strong>Figure 6 — Difference Between Handoff and Snap Compared to Yards</strong></figcaption></figure><p>The NFL is composed of 32 teams. Some of the teams are offensive powerhouses, and others have struggled for years. It is possible that predicting the outcome of plays accurately depends on the team. Figure 7 shows the yards for each play from all teams over the first twelve weeks of the 2019 season. It appears that apart from a few outliers, all teams have similar distributions. This result suggests that the team is not related to yards.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MEYoOCw__Ax3NeR1yn8d5g.png" /><figcaption><strong>Figure 7 — Every Teams Yard Through Weeks 1–12</strong></figcaption></figure><p>Figure 7 raises the question whether the week of the season impacts yards. Box plots communicating the variance in yards by week is shown in Figure 8. Box plots are useful because the horizontal lines at the bottom and top of the box represents the 25th and 75th percentile data points. The bold horizontal line within the box represents the median. Figure 8 is a useful visual because it implies the week does not affect yards as all of the boxes are relatively similar. All dots in Figure 8 are considered outliers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dCZfMqa0aKjcz4JlougW_Q.png" /><figcaption><strong>Figure 8 — Weekly Yard Variance</strong></figcaption></figure><p><strong>Visualizations Using Play Type As The Outcome Metric</strong></p><p>One of the most quoted sports sayings is defense wins championships. Being able to call defensive plays knowing what the offensive is going to do eliminates risk and surprise when the ball is snapped. Defensive coaches are always guessing what the offense is going to do and must be ready for anything. The plots below communicate how variables may be related to the type of play ran by the offense.</p><p>Figure 9 displays the number of running and passing plays by downs. Figure 9 is useful because it suggests as downs increase, the ratio of rush plays compared to pass plays decreases. First down play calls appear to have equal probability whether a pass or rush play is executed. But third down is almost exclusively pass plays. The high volume of pass plays on third down may be linked to offenses trying to get a difficult first down without reaching fourth down.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*4WVms7Zii8LyG2PcuPQMUQ.png" /><figcaption><strong>Figure 9 — Play Type By Down</strong></figcaption></figure><p>As the downs increase, the distance needed for a first down typically decreases. In order to explore if play type is related to the distance required for a first down, the yards to go is plotted with regards to play type in Figure 10. Figure 10’s X-axis presents the yards to go, and the Y-axis communicates the count of calls for each play type. It is not surprising the number of play calls is enormous at 10 yards because first downs begin at this measure. Pass plays are more common than rush plays in Figure 10. However, when only 1 yard is needed for the first down, rush plays tend to be called.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_Zu9K3oIBbdcVC0ytbxlQA.png" /><figcaption><strong>Figure 10 — Play Type By Distanced Needed Until First Down</strong></figcaption></figure><p>Similar to yards, it is possible that play type can vary between teams. Figure 11 plots the count of play calls on the X-axis and the team name on the Y-axis. Typically the count would be on the Y-axis, however this orientation makes the team names more legible. A general consensus exists between teams that more pass plays will be executed than rushing plays. There are slight discrepancies in the ratios, where Atlanta passes approximately twice for every run, but Minnesota is almost an equal split.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UhoObMsZhB7urw17kvUsiA.png" /><figcaption><strong>Figure 11 — Play Type By Team</strong></figcaption></figure><p>One of the more present relationships in the yards plots was the correlation between yards and offense formation. Shown in Figure 12 is the pattern between offense formation and number of times a play type is called. Figure 12 presents that rushes are most common when the offense formation is under center, whereas the shotgun formation indicates a pass. This result is not surprising because the shotgun formation is when the quarterback is a few steps behind his teammates and in a position where he is able to throw the ball very quickly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uCA3BXW0ubTlY6-1aO73vQ.png" /><figcaption><strong>Figure 12 — Play Type By Formation</strong></figcaption></figure><p><strong>Models</strong></p><p><strong>Yards Model</strong></p><p>The first model developed is a regression model with the objective of predicting the number of yards gained from a given play. Multivariable regression is used to identifying correlations in variables. Regression allows statistical models to quantitatively interpret patterns and determine if there is a likelihood that a relationship exists between variables (Newman, 2020). In order to begin creating this model, a technique called subset selection is applied. Subset selection is a tool that effectively chooses variables from a dataset to be used in the model. These variables are called predictors. Three common forms of subset selection are forward, backward, and best. Forward selection starts with an empty model and adds a predictor one at a time, selecting the predictor that will benefit the model the most in each iteration. Backward selection reverses this process and begins with a model including all variables and removes the predictor that impacts the model the least. Whereas, best subset selection searches for the most elite model at every iteration without regard for the predictors in the current model. Best subset selection is infeasible when many predictors exist because of its extensive search. For this reason forward subset will be utilized in this project. In regression a measure to quantify a models ability to account for data within the dataset is the R-squared value. The subset selection model that had the greatest R-squared value is presented in Table 1. The variables included in the model are To Go, Down, Yard Line, Series First Down, and Formation. This model was developed using an approach called validation, where the model is exposed to the entire dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JjpUbTiXfIlMrpMOhaZfAA.png" /></figure><p>Validation is a simple too that can easily create models and judge its capability for predicting results. However, in order to ensure the integrity of the models results, Cross Validation (CV) is utilized. CV will divide the dataset into two parts, training set and test set. Training and testing sets return better results because the model is built using the training set and then tested on data it has never seen before in the test set. This approach eliminates the risk of overfitting a model to its data. CV splits the dataset in equal halves which can be a pitfall of the method because it reduces the amount of data used in the development of the model. In order to mitigate this draw back K-Fold Cross Validation (KFCV) is used. The idea of KFCV is to randomly divide the data into K parts, design the model on K-1 parts, test the model on the Kth portion, and then repeat K times. KFCV grants the model exposure to all K parts of the data and tests on each portion of the data (Newman, 2020). 5-KFCV will explicitly be used to develop the models in this post. A visual snapshot of this process with a K value of 5 is shown in Figure 13. The iteration presented in Figure 13 is the scenario where the first fraction of the data is the test set and the model is developed from the four other parts (Newman, 2020).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8mVOzBM4Qx3dsvyBOL8iPQ.png" /><figcaption><strong>Figure 13 — KFCV Visual. Recreated from (Hastie &amp; Tibshirani, 2013)</strong></figcaption></figure><p>Using the model identified by subset selection in Table 1, 5-KFCV is applied to determine if a less complex model can return satisfactory results. The models developed are shown in Table 2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BLvzNn1P3AFs3Q_P4GRgQQ.png" /></figure><p>Comparing different models of varying complexity is easily executed through CV. The error rates of the models listed in Table 2, as well as their error bars are plotted in Figure 14. The X-axis of this plot represents the model complexity that aligns with Table 2, and the Y-axis shows their error rates. The horizontal lines on Figure 14 communicate the error bars. An error bar is an important tool that symbolizes one standard error from the mean to statistically communicate variability in the data (Newman, 2020). The best model is the one with the lowest error rate, show by the black dots. In Figure 14, model 4 is the strongest model. However, in analytics it is important to balance model capability with complexity. Model 4 may perform the best, but it’s complexity can cause issues. A common technique to select the model that is the best and least complex is the one standard error rule. To apply the one standard error rule locate the lowest error rate, model 4 in our case. Then, determine the simplest model with an average error rate between the error bars of model 4. The model with the least complexity and acceptable performance is model 2 because its error rate is within one standard error of model 4. The strength of model 2 comes from the To Go variable. In models 3, 4, and 5, the To Go variable is raised to exponential powers, putting more weight on the distance needed for a first down when predicting yards from a play. This extra consideration on the variable increases the complexity of the models while insignificantly improving results. Model 2 performs better than model 1 because of the interaction predictor including To Go, Down, and Yard Line. The increase in accuracy from the addition of this term implies the amount of yards generated from a play is related to a combination of distance to go, down of the play, and position of the ball.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/1*SIEXiaOOyYRYIBfEG2PZ9w.png" /><figcaption><strong>Figure 14 — Yards Model Error Rates and Error Bars</strong></figcaption></figure><p>CV is a reliable tool when selecting a model. Another tactic for deriving the model of choice is the Akaike Information Criterion (AIC) estimate. The AIC estimate generates a value based on a models predicted error and their complexity. Models can then be compared and selected in search of the lowest AIC value. Other estimators such as BIC and Cp, perform the same operation in slightly different ways. Figure 15 plots the AIC values for the models in Table 2. All values in Figure 15 are similar which aligns with the results in Figure 14. However, model 5 has the lowest AIC score. This discrepancy between AIC and CV comes from the AIC not putting enough weight on the increasing complexities. CV is always the preferred method because it returns actual test errors, whereas estimators provide approximated errors. Therefore, model 2 remains the selected model despite the results of the AIC estimate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*6rT2C_NTAqV-uTeWF3BXdw.png" /><figcaption><strong>Figure 14— Yards Model AIC Values</strong></figcaption></figure><p>Following the selection of model 2, the specifics of the model can be explored. Figure 15 communicates the coefficients, p values, F-statistic, and R-squared of the model. First lets assess the coefficients. The coefficients represents how a predictor will changed based on a unit increase in the response variable. If the number of yards increases by one yard, the To Go variable will increase by a 1.421 units. Negative coefficients indicate a decrease in the predictor value. For example a unit increase in yards would decrease the interaction of Down and Yard Line by 0.02683 units. The 1.421 coefficient for To Go means when the value for To Go is larger, the number of yards is also larger. This relationship makes sense because the offense has a greater distance until a first down and will be executing plays in attempts to generate more yards. A similar correlation is seen between Down and yards. When downs increase, yards also increase, likely because the number of opportunities to reach the required ten yards is limited. One interpretation of this could be as downs increase the offense is more confident that they will be able to reach the first down marker. This confidence grants the offense the ability to take more risks and attempt higher payoff plays. Additionally, this assumption may be communicated through the To Go and Down interaction which has a coefficient of -0.426. Yards will increase when the combination of to go and downs decreases. As the offense is close to a first down, with several remaining downs, they will see an increase in yard production. Another interesting coefficient is the Series First Down. Series First Down increases by 11.259 units with a unit increase in yards. This result indicates that a positive relation exists between greater yardage plays and plays occurring on the first down of a series. The Yard Line variable is also positively related to yards, with a coefficient of 0.01605. Football fields are designed so that the yard lines counts up towards 50 and then back down, as seen in Figure 1. The coefficient communicates that plays which take place around mid-field can initiate better yard production. The variable Formation Number is a categorical variable where the number corresponds to a different formation. Categorical values are included only if they impact the model. Only formation 2, 3, 4, 6, and 7 are included in Figure 15 because they are the ones the model deemed useful. The formations for numbers 2, 3, 4, 6, 7 are under center, shotgun, punt, field goal, wildcat respectively. Each formation, excluding 7, has a negative coefficient. This finding proposes a negative relation between the formation and yards. Formation 7, wildcat, shows a unit increase in yards corresponds to a 1.788 increase in plays using the wildcat formation.</p><p>The p-value is a measure of the significance of a relationship and it is one of the most important pieces of information in Figure 15. When the p-value is less than 0.05 it shows a strong statistical significance between predictors and the response. The closer a predictors p-value is to 0 the more significant it is. Anything greater than 0.05 communicates the interaction is not statistically significant. Nearly every predictor in Figure 15 has a p-value less than 0.05, indicating they are applicable to the model. Predictors that are not significant are formation 3, formation 7, as well as the interaction between To Go and Yard Line. It is acceptable to leave these predictors in the model because they are part of the Formation predictor and the To Go, Down, YardLine interaction, which are significant. The insignificant predictors do not contribute to the model but they do not damage it either. Another important measure from Figure 15 is the R-squared value of 0.417. A R-squared value is a number between 0 and 1 that measures the models ability to account for the data in the dataset. 1 is the largest the R-squared can be, but in the business world minimum R-squared values of 0.6 are desired. However, for the unpredictability of sports 0.417 is an adequate outcome. Lastly, the F-statistic is a verdict that conveys if at least one of the predictors are useful in predicting the response variable. With a large F-statistic, and many of the predictors being statistically significant, this model has a strong capability to predict yards.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*yuIFVQhos9r0O3bCvFcp6g.png" /><figcaption><strong>Figure 15 — Yards Model Summary</strong></figcaption></figure><p><strong>Play Type Model</strong></p><p>The second model explored predicts the type of play. This model has profitable applications for defensive play calling because it gives the defensive coach the advantage of knowing what type of play the offense is running. The defensive coach can then base his play based on what the offense is doing and increase his chance of winning. The play type model differs from the regression model that determined yards because play type is a classification model. Classification models predict categories opposed to specific values. The play type model will predict if the offensive play call is a pass or rush. A similar procedure will be conducted when designing this model compared to the yards model. Forward subset selection is utilized to determine the predictors that should be further explored. These subset selection models are created using validation on the complete dataset and evaluated by their R-squared values. Next, the chosen model is refined using KFCV and appraised with testing sets. Finally, similar models of decreasing complexity will be compared to the model identified during subset selection and the one standard error rule will be applied to obtain the best model. The subset selection model and models examined in 5-KFCV are listed in Table 3 and Table 4 respectively. All of the predictors used in Table 3 were also in the yards model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7XSg9MNgJD0D4cLUPvfN8g.png" /></figure><p>The error rates and error bars for the functions in Table 4 are shown in Figure 16. The model with the lowest error rate is model 5, but the simplest model within one standard error of model 5 is model 4. Model 3 is slightly above model 5’s upper error bar and therefore not chosen. These findings were cross referenced using the Cp estimator. The Cp estimator is used on classification models and behaves like the AIC estimator. Similar to the AIC estimator for the yards model, the Cp estimate of these models selects model 5 because not enough consideration is place on the complexity differences. As before, the results of KFCV take precedence to the estimate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*iQjz14Sp6GXdBzh69GCIOQ.png" /><figcaption><strong>Figure 16 — Play Type Model Error Rates and Error Bars</strong></figcaption></figure><p>The purpose of classification is to predict the category the outcome belongs to. Classification models are tested using a confusion matrix. The confusion matrix for model 4 is displayed in Figure 17. In the confusion matrix 1 represents passing plays and 2 corresponds to rushing. Correct predictions are the values on the diagonal of the matrix where the column number intersects with the row. The errors are all of the other values in the matrix (Newman, 2020). For example, in Figure 17 the model predicted the passing plays incorrectly 954 times and rushing plays 592 times. The success rate of model 4 is 73.2%. This rate is much better than “flipping a coin” and randomly guessing what the play type will be. The idea of randomly guessing with no consideration for the data is referred to as the null classifier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/472/1*FnV1HsMNR-7b0BglWiIrHg.png" /><figcaption><strong>Figure 17 —Play Type Model 4 Confusion Matrix</strong></figcaption></figure><p><strong>Big Play Model</strong></p><p>Over 100 plays occur in every football game. Many of them are insignificant and do not affect the overall game. However, a hand full of plays can severely impact the game, shifting momentum and influencing the outcome. The purpose of the big play model is to help defensive coaches identify when risks of giving up consequential plays are present. This model is a classification model where the response variable is the yard group. A yard grouping is a value from 0–5 based on the amount of yards obtained from the play. Table 5 communicates each yard grouping.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1P-ZotTU_0LC3PawW8QhUg.png" /></figure><p>Similar to the previous models, the foundation for the big play model was developed using forward subset selection. This function is shown in Table 6.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OVn4vy7ypHC5AxE0YasSeg.png" /></figure><p>To understand the approach for refining this model, the reasoning being its objective needs to be expanded. This model wants to warn coaches when a big play is about to happen. A high success rate could be created for this model, but if it doesn’t accurately predict the higher yard groups the model does not fulfill its purpose. A models predictions are based on values called posteriors. A posterior is essentially the probability of the outcome. Typically a model will predict the outcome with the greatest probability. The big play model needs to have adjusted posteriors to place a greater precedence on predicting the larger yard groups, especially group 5. The process of adjusting posteriors is explained in Appendix B. The main takeaways from Appendix B. is without posterior adjustments, the model has a success rate of 61.9%, correctly predicting 85% of plays over 10 yards, and only predicting 1.8% of plays belonging to yard groups 1–4.</p><p>After adjusting the posteriors, cross validation was applied to the models listed in Table 7. Each models error rate and error bars are shown in Figure 18. The best model is model 5. Model 5 is the selected model because no other model’s satisfies the one standard error rule.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*00SKcweJmYAgjwcekn4uZg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*dYLkE22uAem8khmtVda8uQ.png" /><figcaption><strong>Figure 18 — Big Play Model Error Rates and Error Bars</strong></figcaption></figure><p>The confusion matrix using the adjusted posterior is shown in Figure 19. The overall success rate of the model dropped to 36.5%, but increased to correctly predicting 87% of group 5 plays and 16.9% of group 1–4. Although the success rates seem worse than before posterior adjustments were made, this model better achieves its objective of predicting big plays. A majority of the errors in the big play model now occur from overestimating the outcome of a play. This drawback is desirable in the eyes of a conservative defensive coach when the penalty of underestimating is more consequential. If the predictions that overestimated the outcome were removed, this model performs with a 93.1% success rate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*mmtHxFtmi7GNsP9EhvO3Zg.png" /><figcaption><strong>Figure 19 — Big Play Model Confusion Matrix With Adjusted Posteriors</strong></figcaption></figure><p><strong>Fourth Down Conversion Model</strong></p><p>The final model is the fourth down conversion model. The decision an offensive coach must make went considering if the team should attempt the fourth down can have tremendous impact on the momentum of the game and the outcome. Making the wrong decision can cost a team field position and points. The fourth down conversion model is different than the previous models because it is a logistic regression model. Logistic regression is a classification algorithm that is used to predict the a binary outcome such as pass or fail (Thanda, 2020). Logistic regression can be applied to the fourth down conversion model because it is predicting whether the offense will succeed or fail when attempting a fourth down. The conversion response variable is 0 when the fourth down is unsuccessful, and 1 when it is successful. The dataset used for this model is also different from the previous models. This dataset is only for running plays. The Distance variable in the new dataset is the same as the To Go variable in previous model, Week is the week of the season that game was played, X is the rushers position along the long axis of the field, Y is the rushers position along the short axis of the field, and Quarter is the quarter of the game the play occurred it. Table 9 highlights the models that will be explored using KFCV.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lU6cYO9xGRxK809f1s0C8A.png" /></figure><p>Performing 5-KFCV and the AIC estimate generated the results presented in Figure 20 and Figure 21 respectively. KFCV indicates model 5 has the best error rate, but model 2 is chosen because of the one standard error rule. Model 2 is identical to model 5 except it excludes to poly, logarithmic, and exponential functions. This observation justifies the ability of the one standard error rule in selecting a model with acceptable performance but much less complexity. It is important to note that the null classifier for this model is equivalent to flipping a coin (50%). The only model with a lower error rate than 50% is model 5. Model 2’s error rate is approximately 52%. If an error rate greater than 50% was unacceptable, model 5 would be selected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/536/1*qHjMd9iiB1SHnLcPqEuXlg.png" /><figcaption><strong>Figure 20 — Fourth Down Conversion Model Error Rates and Error Bars</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/536/1*e9U_h2qhZ5mrYZC7HOhaFA.png" /><figcaption><strong>Figure 21 — Fourth Down Conversion Model AIC Values</strong></figcaption></figure><p>The coefficients of the fourth down conversion predictors can be further explored in the summary shown in Figure 22. The negative coefficient for the offense formation predictors suggests that when these formations are used, fourth down conversions are less successful. A useful coefficient is Defenders In The Box, with a value of -0.908. The negative value suggests that conversion success increases when less defenders are in the box. This relationship makes sense because less pressure is applied to the offense. It is surprising that Distance is a positive coefficient. A unit increase in conversion relates to a 0.715 increase in Distance. Initially, it was expected that less distance would increase the likelihood of the fourth down conversion. Another significant predictor is Quarter, with a value of -0.4004. Quarter’s coefficient suggests that the fourth downs are more successful earlier in the game. The p-values are an important metric in Figure 22. The low p-values for many of the predictors indicate that a significant relationship exists and the null hypothesis can be rejected. The null hypothesis is the idea that the predictors are not related to the response variable. If the p-value is greater than 0.05 the null hypothesis remains true.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*MfP4k76tvqKQhdzfiMfeUA.png" /><figcaption><strong>Figure 22 — Yards Model Summary</strong></figcaption></figure><p>In conclusion, data analytics is a powerful tool with extensive applications to football. Teams can and have incorporated analytics into their decision making to get the upper hand in games. The models developed above can predict the yards gained from a play, the type of play, whether a risk of a big play is present, and the success of a fourth down. All of these models can be used by coaches before the play actually happens to supplement their rational in decisions. Table 10 lists the four models selected and their performance metric.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pz-y6F9SFCtn1urGwLE95A.png" /></figure><p><strong>References</strong></p><p>Awbrey, J. (June 9, 2020). <em>The Future of NFL Data Analytics</em>. Retrieved from <a href="https://www.samford.edu/sports-analytics/fans/2020/The-Future-of-NFL-Data-Analytics">https://www.samford.edu/sports-analytics/fans/2020/The-Future-of-NFL-Data-Analytics</a></p><p>Colangelo, M. (July 15, 2019). <em>The NFL made roughly $16 billion in revenue last year</em>. Retrieved from <a href="https://touchdownwire.usatoday.com/2019/07/15/nfl-revenue-owners-players-billions/">https://touchdownwire.usatoday.com/2019/07/15/nfl-revenue-owners-players-billions/</a></p><p>ESPN. (December 22, 2017). <em>NFL Bonuses: Gronk Closing In On $6.5M; Others Chasing Millions, Too. </em>Retrieved from <a href="https://www.espn.com/blog/nflnation/post/_/id/262951/nfl-player-bonuses-gronk-others-chasing-millions-of-dollars">https://www.espn.com/blog/nflnation/post/_/id/262951/nfl-player-bonuses-gronk-others-chasing-millions-of-dollars</a></p><p>Feng, E. (2018). <em>How Philadelphia Used Analytics To Win The Super Bowl</em>. Retrieved from <a href="https://thepowerrank.com/2018/02/13/philadelphia-used-analytics-win-super-bowl/">https://thepowerrank.com/2018/02/13/philadelphia-used-analytics-win-super-bowl/</a></p><p>Hastie, T., Tibshirani, R. (December 2, 2013). ISLR Chapter 5: Resampling Methods. [Video]. Retrieved from <a href="https://www.youtube.com/watch?v=nZAM5OXrktY&amp;list=PL5-da3qGB5IA6E6ZNXu7dp89_uv8yocmf">https://www.youtube.com/watch?v=nZAM5OXrktY&amp;list=PL5-da3qGB5IA6E6ZNXu7dp89_uv8yocmf</a></p><p>Newman, C. (May 30, 2020). <em>Examining Regression and Classification Models Using K-Fold Cross Validation. </em>Retrieved from <a href="https://medium.com/@connornew/examining-regression-and-classification-models-using-k-fold-cross-validation-8b4f588d182e">https://medium.com/@connornew/examining-regression-and-classification-models-using-k-fold-cross-validation-8b4f588d182e</a></p><p>Newman, C. (May 23, 2020). <em>COVID-19 Statistical Risk Classification. </em>Retrieved from <a href="https://medium.com/@connornew/covid-19-statistical-risk-classification-dbf99f58386f">https://medium.com/@connornew/covid-19-statistical-risk-classification-dbf99f58386f</a></p><p>Newman, C. (May 17, 2020). <em>Is Canada Ready to Reduce Restrictions? A COVID-19 Regression Analysis. </em>Retrieved from <a href="https://medium.com/analytics-vidhya/is-canada-ready-to-reduce-restrictions-a-covid-19-regression-analysis-6d16ae0cd71b">https://medium.com/analytics-vidhya/is-canada-ready-to-reduce-restrictions-a-covid-19-regression-analysis-6d16ae0cd71b</a></p><p>Meltzer, M. (January 28, 2020). <em>How Much Money Will Be Bet On The Super Bowl In 2020?. </em>Retrieved from <a href="https://www.thelines.com/super-bowl-how-much-money-bet/">https://www.thelines.com/super-bowl-how-much-money-bet/</a></p><p>Thanda, A. (April 14, 2020). <em>What is Logistic Regression</em>. Retrieved from <a href="https://careerfoundry.com/en/blog/data-analytics/what-is-logistic-regression/">https://careerfoundry.com/en/blog/data-analytics/what-is-logistic-regression/</a></p><p><strong>Datasets</strong></p><p>NFL Savant. (2020). <em>2019 Play By Play Data. </em>Retrieved from <a href="http://nflsavant.com/about.php.">http://nflsavant.com/about.php.</a> Retrieved on June 6, 2020.</p><p>The National Football League. (2020). <em>NFL Big Data Bowl</em>. Retrieved from <a href="https://www.kaggle.com/c/nfl-big-data-bowl-2020/data.">https://www.kaggle.com/c/nfl-big-data-bowl-2020/data.</a> Retrieved on June 6, 2020.</p><p><strong>Appendix A. Data Set Explanations</strong></p><p>The Play By Play Dataset is presented in Table 11. The dataset itself had additional variables to the ones listed in the Table 11. However, the variables not described did not contribute to the models. Table 12 communicates the NFL Big Data Bowl dataset which describes run play only. This specialization of the dataset is because the data competition where the data is from was a competition focused on predicting the yards of run plays. The Big Data Bowl dataset had to be reduced to only plays from the 2019 season with data points of running backs. Originally the dataset was every player on the field from 2017–2019. This created over 700,000 data points and the computer program could not function properly. The reductions brought it to just over 120,000 data points.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oYt8PtnbC43tb5x2XOjxCw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EvNbavcOdxhePCiWbxPwAA.png" /></figure><p>Screen shots of the datasets are shown in Figure 23 and Figure 24.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M6sDoadcgom8Of6kFZygiA.png" /><figcaption><strong>Figure 23 — Play By Play Dataset</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m0iH60873Y6HpfkOWHtmeg.png" /><figcaption><strong>Figure 24 — Runs Only Dataset</strong></figcaption></figure><p><strong>Appendix B. Posterior Adjustments</strong></p><p>The posterior adjustments were made using validation so that all of the errors could be taken into account when making changes. Table 6 communicates the model that was used to generate the predictions. The confusion matrix for original model is shown in Figure 25. Figure 25 has a success rate of 61.9%. predicting 85% of group 5, and 1.8% of group 1–4. Nearly all errors occur when incorrectly predicting the play will belong to yard group 0. Yard group 0 are plays where yards are either lost or do not move from the previous play. This group is more common, making up 77% of the data points, because when passing plays are unsuccessful they are classified as group 0.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/394/1*Vxgo9I-TC-JkYBaQ-gGGBA.png" /><figcaption><strong>Figure 25 — Big Play Model Without Posterior Adjustments Confusion Matrix</strong></figcaption></figure><p>After employing the big play model, the errors were plotted using Down, To Go, and Formation in Figure 26, Figure 28, and Figure 30 respectively. The graphs for these groupings without errors are presented in Figure 27, 29, and 31. The Y-axis represents the count of plays that belong to each region, and the X-axis divides the plot by Down, To Go, or Formation. The errors are shown by the black regions. Comparing the error plots to the correct visuals, it is noted that groups 1–4 make up nearly the entire error region. Group 5 is slightly effected by errors, but group 0 appears untouched. Group 0’s dominance on the data points likely causes its immunity to errors. However, the objective of this model is to conservatively predict when plays that give rise to high yardage are about to happen. Group zero is so regularly predicted because the probability of it happening is greater than the other groups. In order to tailor the model to its goal, the probabilities for the upper yard groups must be adjusted. Changing the posteriors of the predictions involved analyzing the errors in Figure 26, Figure 28, and Figure 30, as well as searching for the posterior of the correct group when an error occurred. Repeating this approach for several errors allowed trends in posterior values to be noticed. Using these tendencies, the model’s predictions were adjusted so that if group 5 met a threshold posterior, it was selected even if it was not the largest posterior in the prediction. Thresholds were given to groups 1–4 as well. The sequence of posterior inspection also was shifted to group 5, group 4, group 3, group 2, group 1, and then group 0. Transforming the order in which posteriors were checked, placed a greater precedence on forecasting the larger group values by granting them a greater precedence in the prediction. The posterior changes are presented in Table 13. Values listed in Table 13 were chosen somewhat arbitrarily and with trial and error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*I4cv-fImrqZ9zJGGBuVNBA.png" /><figcaption><strong>Figure 26 — Error Count By Down</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*1vi_QQbXCt-0Z-Gfe0Jfzg.png" /><figcaption><strong>Figure 27 — Group Count By Down</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/592/1*KbjFFzZlPEIKB_mPcfo9Jw.png" /><figcaption><strong>Figure 28 — Error Count By To Go</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/592/1*mWz9iDXEbAkiIsPwMJyoIw.png" /><figcaption><strong>Figure 29 — Group Count By To Go</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/592/1*LpDgFp94KaRMu_3UcHRdvw.png" /><figcaption><strong>Figure 30 — Error Count By Formation</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/592/1*8-d2bo-4QT4sGi63voj5HQ.png" /><figcaption><strong>Figure 31 — Group Count By Formation</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z9LxSCFlUA_XdIAqmwA3_w.png" /></figure><p>Figure 32 shows the CV results of the big play model without the changes to posteriors. Figure 32 shows model 4 has the lowest error rate, but model 2 is selected through the one standard error rule. The adjustments deteriorate model 4’s performance, making model 5 the best model in Figure 18. Model 2 is also no longer within model 5’s error bars in Figure 18 after the alterations were made. Comparing Figure 32 to Figure 18, shows that the adjustments eliminated model 2 from selection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*VAP6jcpFVkTgzdCpjIdOCg.png" /><figcaption><strong>Figure 32 — Big Play Model Error Rates and Error Bars Without Posterior Changes</strong></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7079f5f29b47" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Developing COVID-19 Classification Models Using Subset Selection]]></title>
            <link>https://medium.com/@connornew/developing-covid-19-classification-models-using-subset-selection-628b42bc315c?source=rss-8b675a6756a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/628b42bc315c</guid>
            <dc:creator><![CDATA[Connornew]]></dc:creator>
            <pubDate>Fri, 05 Jun 2020 17:56:50 GMT</pubDate>
            <atom:updated>2020-06-05T17:56:50.422Z</atom:updated>
            <content:encoded><![CDATA[<p>When creating classification and regression models it can be difficult selecting effective predictors. Some models include up to 100 predictors, which can consume a lot of time and work when deciding what predictors should be included. Subset selection is an approach that can be taken to efficiently choose predictors for a model. The three subset selection algorithms explored in this post are best, forward and backward. Best subset selection is the method that checks all possible predictor combinations and selects the best one. For example, if a model was to made with a maximum of 3 predictors, best subset selection would determine the greatest model that uses 1, 2, and 3 predictors. Forward selection differs from best selection because forward will always build upon the previous model by adding the predictor that will benefit the model the greatest. More specifically, the model built through forward selection with 3 predictors is simply the 2-predictor model with an additional variable. Whereas, best selection will replace any predictors if a better model is found. Best selection ensures the best model is found, however at the expense of computational complexity. Forward selection will generate models faster. Speed is an important factor when a large number of predictors are used. It is a general rule of thumb to only use best subset selection when the number of predictors is less than 20 or 40 depending on who is asked. Backwards subset selection is the same as forwards, except it starts with the model containing all of the predictors and iterates backwards. At each iteration the backwards model will remove the predictor that contributes to the model’s success the least. Once the models are derived, techniques such as cross validation and Cp estimates are applied to handpick the premier model. I argue that when creating classification models to predict a countries risk of new COVID-19 cases, best, forward, and backward subset selection will select the same model after cross validation is applied. As the number of predictors for these models is limited to 8, variance in the three types of subset selection will be minimal. The models created by best, forward, and backward subset selection are listed in Table 1, Table 2, and Table 3 respectively. Similar models have previously been created and tested through <a href="https://medium.com/@connornew/covid-19-statistical-risk-classification-dbf99f58386f">validation</a> and <a href="https://medium.com/@connornew/examining-regression-and-classification-models-using-k-fold-cross-validation-8b4f588d182e">cross validation</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*8FYq2gPyugCGB8kp2WLyBg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*C3wujmPc07siufWsbHi7Dw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*b6zZDZCpbROrrZR3DP9M2A.png" /></figure><p>The models in Table 1, Table 2, and Table 3 are quite similar. A deviance exists in model 7 for the best subset compared to the forward subset. In the best model, the date predictor is removed and replaced with median age and hospital beds per 100K people. Whereas the forward subset does not remove predictors and simply adds hospital beds per 100K. These discrepancies disappear in model 8 when all predictors are included. There is also a difference between backward subset selection and best subset when looking at model 6. Backward selection removes the predictor that has the lowest impact on the model. This predictor turns out to be date and then median age, shown in Table 3. Contrasting the backward models with the forward models it is interesting to note that forward selection adds the date predictor in model 6 but removes the date predictor immediately in backward selection. This effect is caused by the combination of hospital bed and median age. When hospital bed and median age are both in the model their performance is greater than the date predictor. Further evidence of this idea is seen in Table 1 when model 7 completely removes date as a predictor and replaces it with hospital beds and median age.</p><p>In order to assess the effectiveness of the models created, their adjusted R squared values are listed in Figure 1. The adjusted R squared value behaves similarly to the R-squared value as a measurement for the models ability to account for variability in the data. However, adjusted R-squared values will penalize the model for adding unnecessary predictors. Figure 1 communicates that the adjusted R squared values for all of models created with best, forward, and backward subset selection. The values in Figure 1 increased in relation to complexity, suggesting the idea that each of the predictors added is useful. It is expected that the only difference in adjusted R-squared between best and forward subset models is in model 7 because of the deviance previously mentioned. Although the backward subset numbers do not match the best and forward results exactly, their values respond at indistinguishable rates when predictors are changed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/396/1*3wcS5pmZfMXPPHhzMcBbkQ.png" /><figcaption><strong>Figure 1 — Adjusted R-Squared Values for Best, Forward, and Backward Subset Selection</strong></figcaption></figure><p>A tool that can be utilized when selecting which models to further explore is the Cp estimator. The estimator quantifies a models effectiveness while considering its complexity. Models that produce a lower Cp value are considered superior. Figure 2 displays a side by side comparison between the Cp estimate for each type of subset. The y axis represents the Cp value, while the x axis corresponds to model complexity. The outcome of this visual is expected because the Cp values between best, forward, and backward subset models are nearly identical. A single plot with all Cp values on the same axis is shown in Figure 3. This visual is difficult to read because a majority of the data overlaps. However, its purpose is to communicate the variation in Cp values that occurs at model 6 and model 7. The divergence aligns with the variation in the models predictors and the differences in their adjusted R squared values. As model 8 possesses the lowest Cp value, model 4 through 8 will be examined using cross validation to determine the simplest model with acceptable performance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*ULtTJHLf4-XCIMJC_hbkkA.png" /><figcaption><strong>Figure 2 — Cp Value Comparison Between Best, Forward, and Backward Models</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*a0U0ffVFM3CU16s5QKHF8g.png" /><figcaption><strong>Figure 3 — Cp Value Comparison Between Best, Forward, and Backward Models (Single Plot)</strong></figcaption></figure><p>The error rates and standard errors for model 4, 5, 6, 7 and 8 are plotted on Figure 4. Note that the x axis in Figure 4 is labeled where 1 is the lowest complexity (model 4) and 5 is the highest (model 8). Error rates are determined through 5 K-Fold Cross Validation, a technique for building and testing models to ensure realistic results. <a href="https://medium.com/@connornew/covid-19-statistical-risk-classification-dbf99f58386f">Cross validation has been examined extensively in a previous posting</a>. To determine the best model, the one standard error rule is applied. Standard error is a measure of the model’s variability and is represented by the horizontal lines. The one standard error rule is executed by identifying the model with the lowest error rate and then locating the simplest model that has an error rate within one standard error from the initial model. This technique cannot be applied to Figure 4 because the model with the lowest error rate is the simplest model. Model 5, 6, 7, and 8, likely have larger error rates due to overfitting the data. The error rates and error bars for forward subset selection and backward are shown in Figure 5 and 6 respectively. The results of Figure 5 and Figure 6 replicate Figure 4.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*JDeu5EYaWCv0zpqUVPutzg.png" /><figcaption><strong>Figure 4 — Error Rates and Error Bars for Best Subset Selection Models 4–8</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/655/1*_tUEbpCibJUtgnacfp1L5Q.png" /><figcaption><strong>Figure 5 — Error Rates and Error Bars for Forward Subset Selection Models 4–8</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/1*Q4Vga8QvlFCr87BGAkrALQ.png" /><figcaption><strong>Figure 6 — Error Rates and Error Bars for Backward Subset Selection Models 4–8</strong></figcaption></figure><p>Further exploration of model 1, 2, and 3 is required because model 4 in Figure 4, Figure 5, and Figure 6 had the lowest error rate. This result indicates the cross validation does not align with the Cp estimator values that indicated model 8 as the most effective. Cross validation is the preferred method because it gives actual testing errors. Whereas the Cp estimator yields approximate errors. Plotting the error rates of model 1 through 5 is presented in Figure 7. Best, forward, and backward subset selection all have identical models for models 1 through 5, as seen in Table 1, Table 2, and Table 3. For this reason Figure 7 represents the outcome of all three types of subset selection. Figure 7 is more useful than the previous error bar plots because the one standard error rule can be applied to find the simplest model that meets performance standards. Model 4 continues to be the model with the lowest error rate, however model 3 has an error rate within the error bars of model 4. Therefore, model 3 is the selected model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/1*_Ttcg17v9Hi7lvjXffHKVg.png" /><figcaption><strong>Figure 7 — Error Rates and Error Bars for Best, Forward, and Backward Subset Selection Models 1–5</strong></figcaption></figure><p>In conclusion, an effective model with the intention of classifying a countries risk of new daily cases of COVID-19 can be developed using the country’s; total case count, measure of restrictions, and gross domestic product. This model is unanimously confirmed through the application of 5 K-Fold Cross Validation on models created through best, forward, and backward subset selection.</p><p><strong>References:</strong></p><p>Newman, C. (May 23, 2020). <em>COVID-19 Statistical Risk Classification. </em>Retrieved from <a href="https://medium.com/@connornew/covid-19-statistical-risk-classification-dbf99f58386f">https://medium.com/@connornew/covid-19-statistical-risk-classification-dbf99f58386f</a></p><p>Newman, C. (May 30, 2020). <em>Examining Regression and Classification Models Using K-Fold Cross Validation. </em>Retrieved from<strong> </strong><a href="https://medium.com/@connornew/examining-regression-and-classification-models-using-k-fold-cross-validation-8b4f588d182e">https://medium.com/@connornew/examining-regression-and-classification-models-using-k-fold-cross-validation-8b4f588d182e</a></p><p><strong>Datasets Used:</strong></p><p>Our World in Data. (May, 2020). <em>COVID-19-Data</em>. Retrieved from <a href="https://github.com/owid/covid-19-data/tree/master/public/data.">https://github.com/owid/covid-19-data/tree/master/public/data.</a> Retrieved on May 22nd, 2020.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=628b42bc315c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Examining Regression and Classification Models Using K-Fold Cross Validation]]></title>
            <link>https://medium.com/@connornew/examining-regression-and-classification-models-using-k-fold-cross-validation-8b4f588d182e?source=rss-8b675a6756a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/8b4f588d182e</guid>
            <dc:creator><![CDATA[Connornew]]></dc:creator>
            <pubDate>Sat, 30 May 2020 20:35:28 GMT</pubDate>
            <atom:updated>2020-05-30T20:35:28.545Z</atom:updated>
            <content:encoded><![CDATA[<p>Previously, analytical models regarding COVID-19 data using <a href="https://medium.com/analytics-vidhya/is-canada-ready-to-reduce-restrictions-a-covid-19-regression-analysis-6d16ae0cd71b">regression</a> and <a href="https://medium.com/@connornew/covid-19-statistical-risk-classification-dbf99f58386f">classification</a> were created to make predictions. While these models displayed strength and capability, it is important to apply Cross Validation (CV) to ensure model integrity and selection. For example, classification models are created using training sets and test sets that are derived from the overall dataset. Both the test and training sets make up 50% of the data. The idea of this approach is to build the model using the training set and then test its capabilities on data the model has not seen before, the test set. When evaluating the results of the model on the test set versus the training set, it is typical to experience an increase in error rate because the model can become bias towards the training set. This technique of randomly dividing the data into equal halves is referred to as validation. A pitfall of validation is the amount of data used to develop the model is reduced. This issue is improved through the application of K-Fold Cross Validation (KFCV). The idea of KFCV is to randomly divide the data into K parts, build the model on K-1 parts, make predictions on the Kth portion, and then repeat K times so that each portion of the model is eventually the test set. A visual snapshot of this process with a K value of 5 is shown in Figure 1. The iteration presented in Figure 1 is the scenario where the first fraction of the data is the test set and the model is developed from the other parts. KFCV is the preferred method of calculating realistic test error because it exposes the model to a greater amount of the dataset and accurately evaluates error rates. Presented in Table 1 is the list of models that will be reassessed using KFCV. The predictors listed in Table 1 are the variables that were used as previously.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U3t7xsYy-BVMKtlQGYVUfQ.png" /><figcaption><strong>Figure 1 — KFCV Visual. Recreated from (Hastie &amp; Tibshirani, 2013)</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dn6JX1JcBgTL-gsyB4ATAg.png" /></figure><p>The total number of confirmed cases in Alberta is the first model explored. This model is important because Alberta is one of Canada’s COVID-19 hotspots and has begun reopening its economy. Reducing restrictions is a significant progression in returning to everyday life, however people question whether it is too soon. Figure 2 displays the number of cases in Alberta from March until mid-May, as well as includes significant decisions made by the province. These decisions are; declaring a state of emergency, reopening parks, and reopening restaurants. The regression model listed in Table 1 is plotted in red on Figure 3, in addition to the actual values shown in black.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PHvkqhNB4-jf7PeM7vJd3w.png" /><figcaption><strong>Figure 2 — Total Number of Cases in Alberta in Relation to Government Decisions (Newman, 2020)</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zkEFvFLHJ1hOa3C4WGcXEw.png" /><figcaption><strong>Figure 3 — Plot of the Number of Confirmed Cases in Alberta as a Function of Date and Number of Tests Conducted (Newman, 2020)</strong></figcaption></figure><p>A benefit of cross validation is it allows plots to easily be created so that models of increasing complexity can be compared to each other directly. Listed in Table 2 are 10 models that are created and tested using 10-KFCV. The error rates of each model is shown in Figure 4. Figure 4 presents the error rates using the black dots and the error bars using the horizontal line for each model. An error bar is an important tool that symbolizes one standard error from the mean to statistically communicate variability in the results. A common technique for selecting the best model is the one standard error rule. To execute the one standard error rule, locate the model with the lowest error rate. In our case, this rule selects model 9 with an average error rate of 176 cases. Once the model with the lowest error rate is found, determine the simplest model that falls within those error bars. The model with the lowest complexity within the error bars of model 9 is model 4. Therefore, the best regression model is model 4. The strength of model 4 is it puts an emphasis on the number of people tested when predicting the number of confirmed cases. As more people get tested, more cases are expected. This observation is logical, and as the models in Table 2 place a greater consideration on the number of people tested, the error rate and standard error decreases. Model 4 is the best model because it places more weight on number of tests conducted while avoiding getting too complex. Date is also a powerful predictor because it influences the model using time and can account for how the curve changes as time goes on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O-xs5HMUE7_W_FnK9QTyew.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1fHQoOWxzyLf5thAsBzUAQ.png" /><figcaption><strong>Figure 4 — Error Bars of Alberta’s Total COVID-19 Case Count Regression Models</strong></figcaption></figure><p>Several estimators exist that can be utilized to confirm results of CV. Estimators do not actually calculate test errors but instead reflected approximated tested errors based on the training error. One such estimator is Akaike Information Criterion (AIC) estimate which compares different models by giving them a value based on their predicted error and model complexity. The results of the AIC estimator on the 10 models listed in Table 2 are presented in Figure 5. Alignment exists between Figure 4 and Figure 5 because in both plots model 9 has the lowest value, and a gradual increase in AIC is seen as model complexity decreases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qnxrfxC-4aSgcNEiNYMjzA.png" /><figcaption><strong>Figure 5 — AIC Values of Alberta’s Total COVID-19 Case Count Regression Models</strong></figcaption></figure><p>The next model reviewed with CV is the regression model predicting hospitalizations as a function of age. This model’s regression line and the data it is built from is shown in Figure 6. The various age groups in Figure 6 are defined as follows; 1=0–19 years old, 2 = 20–29 years, 3 = 30–39 years, until 8=80–89 years. The initial model appears to be strong and accurate in predicting the number of hospitalizations based on age because the regression line mimics a line of best fit. Decision makers can use the insights of this model to determine what groups are at risk based on age and tailor their restrictions to better protect these groups. For example, Figure 6 denotes that the elderly are more prone to hospitalization due to the virus. When creating restrictions, places with a larger elderly population such as retirement homes require greater stringency.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rJmQQ_34JufzaXEafexRUA.png" /><figcaption><strong>Figure 6 — Plot of Amount of People Hospitalized as a Function of Age Regression Model (Newman, 2020)</strong></figcaption></figure><p>A similar process for exploring this model with KFCV is followed. The models assessed are communicated in Table 3. 4-KFCV is needed for this model opposed to the traditional 5 or 10 because the dataset is grouped into 8 groups. 5 and 10 KFCV is infeasible because K equal divisions of the data is impossible. The models listed in Table 3 are plotted with the actual data points in Figure 7. Each model is a different coloured line and the data points are represented by the black dots. It can be seen in Figure 7 as the model becomes more complex a greater amount of curvature is present where the model attempts to fit distant data points. This effect is why complex models can overfit to the data that created it and perform poorly on unseen data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nruGLGrq7dDiB0klgUfBmw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3zLbU0851D65OhVQCnLBng.png" /><figcaption><strong>Figure 7 — Regression Models of Various Complexities with Actual Data Points</strong></figcaption></figure><p>In order to determine which model is the best, the average error rates of each model are presented in Figure 8 with their respective error bars. Performing the one standard error rule results in model 2 having the lowest error rate, but model 1 being the best model because it is less complex and has an average error rate within the error bars of model 2. This verdict reinforces the strength of the initial model where hospitalizations are determined as a function of age. There is slight improvement when using the squared value of the age group. However, when the age group is raised to the third or fourth power, error rates and standard errors increase tremendously. Overfitting of the model is likely causing the greater error. Therefore, the strength of model 1 and model 2 is their simplicity because the relationship between age and hospitalization is nearly linear.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Snf2cvPIJfg-hQ6C8a7wGw.png" /><figcaption><strong>Figure 8 — Error Bars of Hospitalization Regression Models</strong></figcaption></figure><p>To confirm the results of Figure 8, the AIC estimator was used and plotted in Figure 9. Figure 9 indicates that model 1 is the best model when considering approximated error rates and complexity of the model. This verdict, in addition to model 4 being the worst model, aligns with the conclusions of Figure 8. The closeness in AIC values for model 1, 2, and 3 also supports the outcome of Figure 8. It is important to note that if Figure 8 and Figure 9 contradicted each other, it would be Figure 8 that takes precedence. Figure 8 is preferred because KFCV uses actual test errors, whereas AIC is an approximation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YW6_ifUkuhEW8r-TJMdWxQ.png" /><figcaption><strong>Figure 9 — AIC Values of Hospitalization Regression Models</strong></figcaption></figure><p>Lastly, the classification model that predicts a country’s risk value for new daily COVID-19 cases given location, date, total cases, and total deaths is analyzed using 10-KFCV. This classification is for countries around the world, however Figure 10 communicates the different risk groups for Canada. The three risk groups are; low (0–100 new cases), medium (100–500 new cases), and high (over 500 new cases). Table 4 presents the models being assessed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lpiOVAeMBW15UdlPLB4o2A.png" /><figcaption><strong>Figure 10 — Canadian Daily Cases With Risk Categories (Newman, 2020)</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qqktjInrGWNtks3G7CGSMg.png" /></figure><p>Performing the same assessment as the previous models results in the error bar plot shown in Figure 11. The model with the lowest average error rate is model 5. Although, when the one standard error rule is applied, no other model is within the error bars. Therefore, model 5 is the best model despite its complexity. If model 5 was rejected because of its high complexity, model 4 would have the lowest error rate and model 2 would become the best model when applying the one standard error rule. This observation is important because model 2 is a much less complex model with a slightly larger error rate when comparing it to model 5. The strength of model 5 comes from squaring the total cases predictor. Squaring the variable puts a larger weight on it when determining the response variable, indicating that the number of new cases daily cases is strongly impacted by the number of total cases in that country. Logically this observation makes sense because the more cases, the greater the likelihood of the virus spreading. Furthermore, the addition of the location predictor substantially drops the error rate seen in model 1. Location impacts the model because the model is able to focus on relevant data specific to the country it is attempting to categorize.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sjgnbiHIXMIe6Bvz_ofLeA.png" /><figcaption><strong>Figure 11 — Error Bars of Risk Group Classification Models</strong></figcaption></figure><p>In conclusion, KFCV is an essential tool when building models to predict response variables. KFCV allows stronger models to be developed by exposing the model to a greater amount of data points than validation would. KFCV also makes it easy to compare several models and select the best one based on average errors and complexity. Many estimators such as AIC prove to be supplementary in supporting the results of KFCV.</p><p><strong>References:</strong></p><p>Hastie, T., Tibshirani, R. (December 2, 2013). <em>ISLR Chapter 5: Resampling Methods. </em>[Video]. Retrieved from <a href="https://www.youtube.com/watch?v=nZAM5OXrktY&amp;list=PL5-da3qGB5IA6E6ZNXu7dp89_uv8yocmf">https://www.youtube.com/watch?v=nZAM5OXrktY&amp;list=PL5-da3qGB5IA6E6ZNXu7dp89_uv8yocmf</a></p><p>Newman, C. (May 17, 2020). <em>Is Canada Ready to Reduce Restrictions? A COVID-19 Regression Analysis. </em>Retrieved from <a href="https://medium.com/analytics-vidhya/is-canada-ready-to-reduce-restrictions-a-covid-19-regression-analysis-6d16ae0cd71b">https://medium.com/analytics-vidhya/is-canada-ready-to-reduce-restrictions-a-covid-19-regression-analysis-6d16ae0cd71b</a></p><p>Newman, C. (May 23, 2020). <em>COVID-19 Statistical Risk Classification. </em>Retrieved from <a href="https://medium.com/@connornew/covid-19-statistical-risk-classification-dbf99f58386f">https://medium.com/@connornew/covid-19-statistical-risk-classification-dbf99f58386f</a></p><p><strong>Datasets Used:</strong></p><p>Our World in Data. (May, 2020). <em>COVID-19-Data</em>. Retrieved from <a href="https://github.com/owid/covid-19-data/tree/master/public/data.">https://github.com/owid/covid-19-data/tree/master/public/data.</a> Retrieved on May 22nd, 2020.</p><p>Government of Canada. (2020). <em>Interactive Data Visualization of COVID-19 in Canada. </em>Retrieved from <a href="https://health-infobase.canada.ca/covid-19/">https://health-infobase.canada.ca/covid-19/.</a> Retrieved on May 14th, 2020.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8b4f588d182e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[COVID-19 Statistical Risk Classification]]></title>
            <link>https://medium.com/@connornew/covid-19-statistical-risk-classification-dbf99f58386f?source=rss-8b675a6756a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/dbf99f58386f</guid>
            <dc:creator><![CDATA[Connornew]]></dc:creator>
            <pubDate>Sun, 24 May 2020 01:02:14 GMT</pubDate>
            <atom:updated>2020-05-24T01:02:14.159Z</atom:updated>
            <content:encoded><![CDATA[<p>The first sign of COVID-19 occurred during late December of 2019 in Wuhan, China (World Health Organization, 2020). If the virus began making noise in December and January, why did it take countries until mid-March to start responding to the pandemic? I argue that the magnitude a country has been affected, both in total cases and total deaths, can be determined by the regulations they have put in place. Through organizing quantitative measurements into qualitative groups, statistical classification models can be created to categorized new data points. In order to effectively model the effects of policies and restrictions, the data for new daily cases as well as total case count and death count of various countries has been arranged into risk groups low, medium, and high based on their numerical values. These groupings are presented in Table 1, Table 2, and Table 3 respectively. Figure 1 presents a visual representation of Table 1 focusing on new cases in Canada, where the date is plotted on the x-axis and the number of cases each day is shown on the y-axis. The various colours within Figure 1 represents the risk groups defined in Table 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8qNrj_jO-wOfGpC7nWultQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ueaCjiGpAObQrtHG-Vc-_Q.png" /><figcaption><strong>Figure 1 — Canadian Daily Cases With Risk Categories</strong></figcaption></figure><p>Before classification models can be designed, potential correlations between variables should be explored. This approach allows data analysts to explore different relationships and predict what variables may be significant to the model. Some of the associations include the number of daily cases compared to population density, total cases per million versus the country’s Gross Domestic Product (GDP) and stringency index, as well as total deaths per million against the number of hospital beds. Plotting the population density on the x-axis against the number of daily cases on the y-axis for several countries is shown below in Figure 2. This visual is important because it indicates that the countries with lower population density (less people per square kilometer) tend to have more cases per day. The data point on the far right is Morocco, which has 19,200 people per square kilometer and only 97 total cases to date. However, because of the centralization of data on the left of the plot, it is unlikely that population density will be useful for predicting risk groups.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*45HeU-UDakF_bbEP3-Hmjg.png" /><figcaption><strong>Figure 2 — Population Density Compared to Number of Cases</strong></figcaption></figure><p>The next relationship explored is the number of total cases per million against the GDP per capita for various countries. This plot is displayed in Figure 3. Cases per million is used because it reduces the scale of data so that the y-axis, number of cases, is reduced and easier compare. GDP per capita represents the total value of all goods and services that a country provides, divided by the number of people in the country. This measurement is a good indication of the populations wealth and may be linked to how the country has been impacted by COVID-19. It appears that Figure 3 indicates countries with a larger GDP per capita have experienced more confirmed cases per million. One interpretation of this relationship would be imports and exports. Countries with a large GDP participate in several global markets, which may have led to breakouts of the virus. Citizens of countries with greater GDP’s may have more access to travel. A larger amount of traveling throughout the early stages of the virus may have put these countries at risk. Therefore, this plot suggests a link between monetary value and COVID-19.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TgontsEiTQXaf_3wQEGnyQ.png" /><figcaption><strong>Figure 3 — GPD Per Capital Compared to the Number of Cases Per Million</strong></figcaption></figure><p>Two plots representing cases per million against stringency indexes are displayed in Figure 4 and Figure 5. The stringency index is a measure of the restrictions and regulations a country has put in place, with a maximum score of 100 and minimum score of 0. The difference between Figure 4 and Figure 5 is whether the country’s mean index or maximum index is used. Figure 4 communicates a clear relation between a high stringency index and low number of cases per million. This pattern cannot be seen in Figure 5 where the stringency indexes reflect each countries maximum value. The importance of these two plots is to show that eventually almost all countries realized they needed to increase their stringencies, as seen in Figure 5. However, by plotting their average stringency in Figure 4, the countries that did not react fast enough can be identified. Most of these countries have indexes between 25 and 50. A mean index score in this range when considering the high values in Figure 5 denotes that these countries had very few restrictions early on in the pandemic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JbYnamH8kzd5fIo91HV0EQ.png" /><figcaption><strong>Figure 4 –Mean Stringency Index Compared to the Number of Cases Per Million</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AXDymbEPlWdSeC6kwQpDQA.png" /><figcaption><strong>Figure 5 –Maximum Stringency Index Compared to the Number of Cases Per Million</strong></figcaption></figure><p>The final pattern explored, shown in Figure 6, is the total deaths per million compared to the number of hospital beds per 100K people. Both of these variables are divided by population size which reduces the scale of the axes. The relationship present in Figure 6 is that countries with a greater amount of deaths per million have less than 7 hospital beds per 100K people. This measurement can have various factors such as population size, country wealth, and health care funding. It is difficult to conclude if a relationship is present because countries with many beds or few beds can have low deaths per million.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iSFptb1a8yh4Gl4-muRvSg.png" /><figcaption><strong>Figure 6 –Hospital Beds Per 100K Compared to Deaths Per Million</strong></figcaption></figure><p>Going back to the risk groups in Table 1, Table 2, and Table 3, classification models were built utilizing training and test sets. The purpose of these models is to identify the risk group of future data points using select predictors. Training and test sets are critical in the design process because the model is built around a subset of the data called the “training set”. The model is then tested against another subset referred to as the “test set”. This approach allows the model to be tested on data it has not been exposed to. The first model built determines the risk group associated with a countries total case count using a stringency index. The confusion matrix for training set and test set of this model is presented in Figure 7 and Figure 8 respectively. Correct predictions are the values on the diagonal of the matrix where the column number intersects with the row. The errors are all of the other values in the matrix. For example, the errors in Figure 7 are 14, 4, 8, 8, and 1. A perfect model would only have values on the diagonal. The error rate can be calculated by dividing the number of correct predictions by the number of total predictions. In this case the error rate for Figure 7 is 39.5% and 54.5% for Figure 8. The discrepancy in error rate between the training and testing sets can be an indication that the model is trying to overfit the data. Adding additional predictors is an approach that better fit the model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/134/1*OjBO4sOfrjdQaWCmec8Byw.png" /><figcaption><strong>Figure 7 — Total Cases as a Function of Stringency Index (Training Set)</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/148/1*vaCqwEM8WZP2vUN2YBA3eQ.png" /><figcaption><strong>Figure 8 — Total Cases as a Function of Stringency Index (Testing Set)</strong></figcaption></figure><p>Expanding on Figure 7 and Figure 8, the confusion matrix of total confirmed cases as a function of stringency and GDP per capita is presented in Figure 9 and Figure 10. The error rate of these models are 46.1% and 50.6%. As the model becomes more complex the error rate for the test set improves. This model uses a population based monetary variable along with a measure of the country’s restrictions to predict the categorization of total confirmed cases with an average success rate of 48.4%.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/154/1*9oZyrHR-n-OW3kkmE1eABw.png" /><figcaption><strong>Figure 9 — Total Cases as a Function of Stringency Index &amp; GDP Per Capita (Training Set)</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/146/1*LAdS0mhzINk5-OI4lcOgJA.png" /><figcaption><strong>Figure 10 — Total Cases as a Function of Stringency Index &amp; GDP Per Capita (Testing Set)</strong></figcaption></figure><p>The second classification model build for this dataset focuses on identifying the risk groups associated with new daily cases using the location and date. Figure 11 and Figure 12 displays the confusion matrix for the training and test results with error rates of 11.5% and 12.3% respectively. Both error rates are relatively low, indicating an effective model. This model is accurate because the inclusion of date as a predictor allows the results to be based on recent trends for specific countries. This model has more data points than previous models because it analyzes daily measurements opposed to total sums.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/178/1*iVdgtk_GPZQkAJtxsVb8EQ.png" /><figcaption><strong>Figure 11 — New Daily Cases as a Function of Location and Date (Training Set)</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/178/1*XIjeNQ2n2d6DaDod5NGjnw.png" /><figcaption><strong>Figure 12 — New Daily Cases as a Function of Location and Date (Testing Set)</strong></figcaption></figure><p>The final model created is the classification of risk groups for total death counts of countries as a function of hospital beds per 100K people and stringency index, as seen in Figure 13 and Figure 14. These predictors are useful for determining death count because the hospital beds accesses a countries health care capabilities and stringency determines which countries have been careless. The error rates of Figure 13 and Figure 14 are 36.9% and 40.5%. Despite the model performing better on the testing set, the model is ineffective at predicting values that correspond to the medium risk group. This poor performance can be linked to the value thresholds that define each risk group being placed at intervals where many data points exist. Figure 15 and Figure 16 attempts to improve the model through the addition of accessibility to hand washing facilities as a predictor. The hand washing values in the dataset represents the percentage of the population that has access to hand washing facilities. An error rate of 25.7% and 29.0% in Figure 15 and Figure 16 proves to be an improvement that sacrifices data points. The addition of the hand washing variable cut the amount of usable data in half because of missing values in the dataset. The model can only be built using measurements without missing values. Figure 15 and Figure 16 is less representative of the dataset because certain hand washing values were unknown. In this case the extra predictor is counterproductive.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/122/1*aKWY_I3tTlYUqC9fhWHU7g.png" /><figcaption><strong>Figure 13 — Total Deaths as a Function of Stringency Index &amp; Hospital Beds Per 100K (Training Set)</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/112/1*C7d8EIZNGEoeZk9FJi8-Eg.png" /><figcaption><strong>Figure 14 — Total Deaths as a Function of Stringency Index &amp; Hospital Beds Per 100K Date (Testing Set)</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/110/1*_7GcTbv6pqV-tx3Hd-K_NA.png" /><figcaption><strong>Figure 15 — Total Deaths as a Function of Stringency Index &amp; Hospital Beds Per 100K &amp; Hand wash Facilities (Training Set)</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/116/1*i8gQbkuUME23L5y7vKMFJw.png" /><figcaption><strong>Figure 16 — Total Deaths as a Function of Stringency Index &amp; Hospital Beds Per 100K Date &amp; Hand wash Facilities (Testing Set)</strong></figcaption></figure><p>A summary of the classification models and their error rates is presented in Table 4.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nhLkzo5qiXfvT8uvquInVQ.png" /></figure><p>In conclusion, the amount of regulations a country has put in place, measured by the stringency index, is critical in predicting the classification of a country’s risk group associated with their total cases and total deaths. Other predictors including GDP and hospital beds prove to be supplementary in the design of models that classify the risk groups.</p><p><strong>References</strong></p><p>World Health Organization. (April 27, 2020). <em>WHO Timeline — COVID-19. </em>Retrieved from <a href="https://www.who.int/news-room/detail/27-04-2020-who-timeline---covid-19">https://www.who.int/news-room/detail/27-04-2020-who-timeline---covid-19</a></p><p><strong>Dataset Used</strong></p><p>Our World in Data. (May, 2020). <em>COVID-19-Data</em>. Retrieved from <a href="https://github.com/owid/covid-19-data/tree/master/public/data.">https://github.com/owid/covid-19-data/tree/master/public/data.</a> Retrieved on May 22nd, 2020.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dbf99f58386f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Is Canada Ready to Reduce Restrictions? A COVID-19 Regression Analysis]]></title>
            <link>https://medium.com/analytics-vidhya/is-canada-ready-to-reduce-restrictions-a-covid-19-regression-analysis-6d16ae0cd71b?source=rss-8b675a6756a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d16ae0cd71b</guid>
            <category><![CDATA[canada]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[covid19]]></category>
            <category><![CDATA[regression]]></category>
            <category><![CDATA[alberta]]></category>
            <dc:creator><![CDATA[Connornew]]></dc:creator>
            <pubDate>Sun, 17 May 2020 14:22:54 GMT</pubDate>
            <atom:updated>2020-05-24T16:48:50.152Z</atom:updated>
            <content:encoded><![CDATA[<p>In the past weeks provincial governments have initiated the reduction of COVID-19 restrictions in Canada. By re-opening parks, public spaces, and non-essential businesses, society is beginning to interact again. These decisions have sparked a controversy about whether it is too early to make changes and if this could initiate another break out of the virus. Furthermore, people question why the government is lifting social distancing measures but not travel restrictions. The vast majority of new COVID-19 cases are spread through communities (Miller &amp; Zafar, 2020). I argue that despite magnitude of the new cases being transmitted through gatherings, Canada is ready to gradually remove restrictions. However, older individuals are more at risk of adverse effects of the virus and should continue to isolate. Figure 1, shown below, communicates the total number of positive COVID-19 cases each province has had. The y-axis represents the various provinces and orders them corresponding to the amount of positive COVID-19 cases. Whereas the x-axis indicates the number of cases each province has experienced to date. Figure 1 is an important visual because the provinces that have reported the largest amount COVID-19 cases are the ones reducing restrictions. Steve Lambert reports that Quebec, Ontario, Alberta, and Saskatchewan are the provinces loosening measures (2020). It comes as a surprise that the provinces who have been impacted the most are the ones opening up again. Political and economic factors are likely impacting the governments decisions to open Quebec, Ontario, and Alberta.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*iXjRLp-4DkfZ8erOORNKiA.png" /><figcaption><strong>Figure 1 — Breakdown of Total Cases In Canada by Province</strong></figcaption></figure><p>Being from Calgary I decided to take a closure look at how Alberta’s case count has reacted to the lifting of restrictions, as seen in Figure 2. The y-variable in Figure 2 is the total number of cases in Alberta to date, and the x-variable is a time series from March to May with labels every fifteen days. The x-axis begins in early March because this is when the first reported cases appeared in Alberta. Also plotted on Figure 2 are three coloured lines; blue, green, and red. The blue line marks March 17th, the day Alberta declared a state of emergency due, the green line represents May 4th, the date Alberta announced the reopening of its municipal parks, and the red line corresponds to May 8th, when the provincial government stated that restaurants, pubs, and cafes can open May 14th. Comparing the slope of the black dots before and after the green line a slight increase is seen, representing a larger rate of new cases being reported. It is speculated that the spike in new cases is a result of the relaxed social distancing measures. People have begun interacting with each other again, going on hikes, having backyard gatherings, and these meetings may impact the number of new cases transmitted through a community. Since the surge of new cases in Alberta, the provincial government has adjusted their decision so that restaurants in Calgary, and a small town called Brooks are not allowed to function until May 25th (Dormer, 2020). Calgary and Brooks were singled out of the early relaunch because both are considered COVID hotspots in Alberta.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/1*FC2Wwmxs0lyCB2dPAxLsvQ.png" /><figcaption><strong>Figure 2 — Total Number of Cases in Alberta in Relation to Government Decisions</strong></figcaption></figure><p>Focusing on the type of transmission for new COVID-19 cases, Figure 3 plots a comparison between community and travel induced cases in Canada. The x-variable represents the week of the year as an integer (i.e. 01 = January 1st, 2020, 52 = December 24th, 2020). While the y-variable indicates the number of new cases for that week, and the colours state whether the virus was transmitted through travel or community. Analyzing Figure 3 highlights travel as the main source of transmission early on in the viruses Canadian experience. The large amount of travel induced cases between Week 3 and 11 is expected because that is how the virus came to Canada and at the time international travel was prevalent. Additionally, Week 3 and 4 have no signs of community transmission because it and cases in Canada were yet to be reported. However, the extreme dominance of transmission through community following Week 11 (March 2) explains why social distancing measures were put in place. It is seen that the number of new cases on a weekly basis in Canada is consecutively going down after the peak during Week 16. It is important to state that the dataset used in accessing type of transmission contains approximately 34,000 data points, roughly half of the reported Canadian cases. This discrepancy in data points is because the dataset only uses data with detailed case reports.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wq8TlbgyPXYiGa95iaAO0A.png" /><figcaption><strong>Figure 3 — Weekly Comparison Between the Amount of COVID-19 Cases Caused by Travel and Community</strong></figcaption></figure><p>Further exploring the comparison between transmission type on a weekly basis in Canada, the percentage of new cases caused by community transmission is plotted alongside the percentage of travel transmission in Figure 4. The y-axis of Figure 4 communicates the weekly percentage of new cases that were transmitted by each form. While the x-axis is a weekly breakdown since April 5th, and the colours correspond to the transmission type. Almost all of the new cases are caused by community in the recent weeks. These overwhelming percentages raise the question whether it is still too soon to begin opening businesses up again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/825/1*6xmTnpuTzBM-vNZjgVzpww.png" /><figcaption><strong>Figure 4 — Comparison of the Percentage of Weekly Cases Transmitted Through Community Versus Travel After April 5th</strong></figcaption></figure><p>Different age groups behave differently. When I was younger I had no problem staying home all day and playing video games. So does the type of virus transmission vary by age? Are certain age groups more prone to catching the virus from the community? Figure 5 presents the total number of cases that have been transmitted by community for various age groups. On the x-axis the age groups are: 1 for 0–19 years old, 2 for people in their twenty’s, 3 represents thirty, and so on, all the way until the eighties. The y-axis is a count of the total number of cases that have been caught through community for each age group. A pattern is present in Figure 5 where individuals in their fifties, forties, thirties, and twenties have caught COVID-19 through community more times than other ages. This trend could be perceived as people with careers, groups that still went into work and were exposed to many other people. Another interpretation of this distribution could relate to family responsibilities. The people in these groups may have to provide for families, and this could involve going to high risk locations such as grocery stores. Lastly, an interesting observation from this plot is the spike of people in their eighties who have been exposed to COVID-19 from their community. This information can be linked to senior care facilities, where older people are grouped together and families are constantly visiting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*hkuRJVNqJEQt8XfYUou6vA.png" /><figcaption><strong>Figure 5 — Number of Cases Transmitted Through Community Transmission for Various Age Groups</strong></figcaption></figure><p>Considering the previous investigation focusing on various age groups transmitting the virus, are there age groups that experience more dire effects? Figure 6 presents a plot of the amount of people who have tested positive for COVID-19 and been hospitalized. The x-axis of Figure 6 are the same age groups mentioned previously for Figure 5, while the y-axis represents the total count of people who have been hospitalized in those age groups due to COVID-19. Figure 5’s distribution is linear, meaning an increase in age corresponds to an increase in hospitalizations. This observation aligns with various news articles that came out early on in the pandemic claiming the elderly were more at risk because of their aged immune systems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*6NCTz6bYIm0QoKrZACwOtg.png" /><figcaption><strong>Figure 6 — Number of People in Each Age Group Who Have Been Hospitalized By COVID-19</strong></figcaption></figure><p>Through the application of linear and multivariable regression, correlations in variables can be identified. Regression allows statistical models to quantitatively interpret patterns and determine if there is a likelihood that a relationship exists between variables. Figure 3, Figure 4, and Figure 5 all explore COVID-19 cases transmitted through community. Figure 3 and 4 highlight the increase in community transmission, and Figure 5 presents a pattern between age and community transmission. Presented in Figure 7 is a regression model where the type of Transmission (1 = travel, 2 = community) is a function of a person’s age. The findings of this model conclude that with an increase in age there is an increase in transmission type. With the larger transmission type value being community, a greater age relates to a community transmission. However, because of the model generating a p-value of 0.294 this relationship is not significant and therefore invalid. In addition, as small F-statistic of 1.1 suggests that no predictor variables, age in this case, relates to transmission type.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*KWlgouieojGBXSkih71kAQ.png" /><figcaption><strong>Figure 7 — Transmission Type and Age Regression Model</strong></figcaption></figure><p>To determine a significant correlation that was linked to transmission type various regression models were developed. The model with the greatest strength is Figure 8, linking transmission type to date and hospitalization. The values for hospitalization in the dataset are either a 1 if the person was hospitalized, or a 2 if they were not. This explains the negative coefficient associated with hospital. Every unit decrease in hospitalization relates to an 88.3 unit increase in transmission. It was not expected for hospital to be a likely factor contributing to the likelihood of community transmissions. One justification for this is that as the number of hospitalizations increases, the number of other patients, visitors and workers exposed to COVID-19 increases. Additionally, date’s positive coefficient shows that transmission type grows by 0.0041 units, per unit increase of date. An increase in transmission type represents a shift toward community transmission because community transmission is represented by the number 2 in the dataset. This observation indicates as time goes on the number of community transmission rises. Furthermore, the model displays a positive interaction between date and hospital. More specifically, as the date and number of people in the hospital decreases per unit, transmission type increases by 0.00481. One reason this interaction behaves this way is that as time goes on and the number of people being hospitalized decreases, causing people to stop seeing the pandemic as such an extreme issue and start relaxing social distancing measures. These actions leads to a greater amount of community report transmissions. All of the p-values in the model suggest that each predictor is significant and the large F-statistic indicates that at least one of the predictors is useful in predicting the response. A pitfall of this model is the low R-squared value. R-squared values are used to indicate how useful a model is and how well it explains the variance of the data. An R-squared of 0.18 is low in comparison to businesses standards of at least 0.60. An explanation for why the R-squared in this model is low relates to the irregular data points, also referred to as “noise”. Noise can affect the strength of a model because the model is unable to account for the discrepancy in data. It is likely that noise is impacting the relationships within the model. The plot of the model created in Figure 8 can be seen in Figure 9, as represented by the red dots. Also included in Figure 9 are black dots communicating the transmission type of new cases throughout the pandemic. The y-axis in this plot is the transmission type, with a value of 1 corresponding to travel and a value of 2 for community transmission. The x-axis is a time series from early February until mid-May. This plot visually confirms the low R-squared value because of the minimal amount of data points being accounted for by the model. Figure 9 communicates how the transmission type shifted from travel to community throughout March and April by the red dots shifting upwards as time goes on. The group of red dots that drop from 2 to approximately 1.5 on the right side of the plot can be linked to a decrease in hospitalizations. As people have begun to recover from the virus and health care professionals have provided improved treatment procedures hospitalizations have gone down. The transmission value obtained from our model decreases when the number of hospitalizations decreases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/433/1*DevWgz7cC5hkveYVKtgYEA.png" /><figcaption><strong>Figure 8 — Transmission Type, Date, and Hospitalization Regression Model</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/660/1*xewYuIiyn1CJoUXga8GgmQ.png" /><figcaption><strong>Figure 9 — Plot of Transmission Type, Date, and Hospitalization Regression Model</strong></figcaption></figure><p>The linear relationship between age and hospitalizations presented in Figure 6 requires more investigation before it can be said with confidence that a correlation exists. The regression model displayed in Figure 10 and plotted in Figure 11 does just this. The minuscule p-value for age group in Figure 10 indicates a significant correlation between age and hospitalization. This model states that for every increase in age group, a 146.4 unit growth in hospitalizations is expected. Other critical values to point out in this model is the large F-statistic and high R-squared value. The F-statistic reassures that age group is involved in predicting hospitalization, while the R-squared value confirms the model is useful. The plot seen in Figure 11 displays the model in red with the black data corresponding to the values previously seen in Figure 6. On the x-axis are the respective age groups that were defined earlier in this report, and the y-axis corresponds to the number of people hospitalized in that age group. The plot is linear and fits the data points as an accurate line of best fit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/457/1*a2YnGLKk138HLeAt6tCjOA.png" /><figcaption><strong>Figure 10 — Amount of People Hospitalized as a Function of Age Regression Model</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*MHgEHTMFErKPKXD0vK7yZQ.png" /><figcaption><strong>Figure 11 — Plot of Amount of People Hospitalized as a Function of Age Regression Model</strong></figcaption></figure><p>Lastly, Figure 12 models the number of confirmed cases in Alberta as a multivariable function of date and tests completed including an interaction between the two. The interaction is present because the number of tests that have been completed relates to how much time has gone by. Mathematically this model is obvious and its significance is proven in the small p-value of all of the predictors, large F-statistic, and high R-squared value. However, it is the plot of this model, displayed in Figure 13, that makes it useful. Figure 13 shows the model in red dots and the actual confirm cases in Alberta as black dots. The x variable in Figure 13 represents various dates and the y variable corresponds to the number of total confirmed cases at those dates. The trajectory of the model is based past events, using reported data to plot the curve. It can be seen that the actual reported cases in May have flattened compared to what was expected from the model, despite the reduction in restrictions shown in Figure 2. This observation means that provinces can successfully reopen areas of society at a gradual rate and experience a lower amount of new cases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/548/1*ZzooS3eYkt2hYeEWxplVJQ.png" /><figcaption><strong>Figure 12 — Number of Confirmed Cases in Alberta as a Function of Date and Number of Tests Conducted</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*5EaMNUdOH4Drjj3h_Wkhnw.png" /><figcaption><strong>Figure 13 — Plot of the Number of Confirmed Cases in Alberta as a Function of Date and Number of Tests Conducted</strong></figcaption></figure><p>In conclusion, Canada is ready to initiate the reopening of society despite the concern that new cases will rapidly spread through the community. It has been displayed that places such as Alberta have successfully began their relaunch while minimizing the numbers of new cases. However, in order to effectively mitigate community spread of the virus, it is important that the elderly remain distant as their chance at hospitalization due to the virus is greater. This hospitalization can lead to a greater amount of community transmission, as seen in Figure 8 and Figure 9.</p><p><strong>References</strong></p><p>Dormer, D. (May 13, 2020). <em>Restaurants and hair salons in Calgary and Brooks to reopen May 25: Premier Kenny.</em> Retrieved from <a href="https://calgary.ctvnews.ca/restaurants-and-hair-salons-in-calgary-and-brooks-to-reopen-may-25-premier-kenney-1.4938158">https://calgary.ctvnews.ca/restaurants-and-hair-salons-in-calgary-and-brooks-to-reopen-may-25-premier-kenney-1.4938158</a></p><p>Lambert, S. (May 3, 2020). <em>Some provinces to enjoy more freedom Monday as COVID-19 restrictions are loosened.</em> Retrieved from <a href="https://www.theglobeandmail.com/canada/article-some-provinces-to-enjoy-more-freedom-monday-as-covid-19-restrictions/">https://www.theglobeandmail.com/canada/article-some-provinces-to-enjoy-more-freedom-monday-as-covid-19-restrictions/</a></p><p>Miller, A. Zafar, A. (March, 24, 2020). <em>A fundamental shift: More than half of reported COVID-19 cases in Canada now from community spread. </em>Retrieved from <a href="https://www.cbc.ca/news/health/coronavirus-canada-community-spread-covid19-1.5508830">https://www.cbc.ca/news/health/coronavirus-canada-community-spread-covid19-1.5508830</a></p><p><strong>Datasets used:</strong></p><p>Government of Canada. (2020). <em>Detailed confirmed cases of coronavirus disease (COVID-19) (Preliminary data), Public Health Agency of Canada. </em>Retrieved from <a href="https://www150.statcan.gc.ca/t1/tbl1/en/tv.action?pid=1310076601.">https://www150.statcan.gc.ca/t1/tbl1/en/tv.action?pid=1310076601.</a> Retrieved on May 14th, 2020</p><p>Government of Canada. (2020). <em>Interactive Data Visualization of COVID-19 in Canada. </em>Retrieved from <a href="https://health-infobase.canada.ca/covid-19/">https://health-infobase.canada.ca/covid-19/.</a> Retrieved on May 14th, 2020</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d16ae0cd71b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/is-canada-ready-to-reduce-restrictions-a-covid-19-regression-analysis-6d16ae0cd71b">Is Canada Ready to Reduce Restrictions? A COVID-19 Regression Analysis</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Global Analysis Of COVID-19 Data With A Focus On Canadian Statistics]]></title>
            <link>https://medium.com/@connornew/a-global-analysis-of-covid-19-data-with-a-focus-on-canadian-statistics-f4abcb90e7f9?source=rss-8b675a6756a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/f4abcb90e7f9</guid>
            <category><![CDATA[data]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[covid19]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[canada]]></category>
            <dc:creator><![CDATA[Connornew]]></dc:creator>
            <pubDate>Sun, 10 May 2020 15:59:13 GMT</pubDate>
            <atom:updated>2020-05-10T15:59:13.502Z</atom:updated>
            <content:encoded><![CDATA[<p>Thousands of articles get posted everyday covering endless perspectives on the COVID-19 pandemic. I have decided to explore the global statistics of COVID-19 to gain a better grasp on the information included in these articles. I will examine the global distribution of positive cases, which countries have the greatest amount of deaths and cases, the various death rates, and the impact population size can have. I am interested in analyzing data from across the globe to broaden my view of the pandemic. However, the media I am immediately exposed to typically covers American and Canadian stories. I will also focus on information specific to Canada because I am interested in assessing and comprehending the data that most directly impacts the people around me. Some of the questions I ask regarding Canada cover the national distribution of the virus, changes in death rate, and monthly summaries.</p><p><strong>Global Statistics</strong></p><ol><li><strong>What does the number of cases in each continent look like?</strong></li></ol><p>The first question I asked myself when seeking to understand what the global data for COVID-19 was “What does it look like?”. In an attempt to answer this question, Figure 1 was created. Figure 1 communicates the number of cases for each continent, grouping South America and North America into a continent called “America”. I was surprised at the immense number of cases that America had received in late April compared to the other continents, as well as the minimal cases reported in Africa, Oceania, and Other. To investigate this distribution I plotted the same visual excluding America so that the scale of the graphs may be increased, as displayed in Figure 2. When America is left out from the chart, the presence of coronavirus is easily viewed in Asia and Europe. Asia and Europe’s increase was expected because of the damage that has been done to countries like Italy and China. Figure 2 also provides support towards Erin Schumaker’s ABC article stating the first reported case of COVID-19 came from China. It is easily seen that the first case on any of plots is located in Asia and occurs in January.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/739/1*a5QTJSHOQ3ChQ08U2bfdZA.png" /><figcaption><strong>Figure 1 — Number of Cases Per Continent</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*vh30D1F5p6YTGhOP4ESLbw.png" /><figcaption><strong>Figure 2 — Number of Cases Per Continent Excluding America</strong></figcaption></figure><p>When examining Figure 2 it is seen that Africa successfully completed February and March with next to no reported cases. However, that number appears to be rising in the recent past. A magnified view at the number of cases can be seen in Figure 3. Gerald Imray’s article for CTV claims that Africa registered a 43% increase in reported cases from April 16th- 23rd. Figure 3 supports the idea the number of cases in Africa is increasing at a rapid rate due to the large data values near the end of April and beginning of May. Imray also mentions that the number of cases in Africa has been under reported because of the extreme limitations in Africa’s capacity to perform testing. The lack of testing aligns with the absence of positive cases in February and early March; while during this time continents such as Asia, America, and Europe were experience thousands of cases every day. ABC News has also reported the same 43% increase in Africa’s cases and says that the World Health Organization has warned the public that Africa may become the next hot spot for the virus. Speculations around Africa’s risk of becoming the next epicenter have placed blame on the countries large population and poverty.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*2FjxbYxrDaW1gNLYWAEOjQ.png" /><figcaption><strong>Figure 3 — Number of Cases in Africa</strong></figcaption></figure><p><strong>2. What continents have the most confirmed cases?</strong></p><p>Figure 4 presents a pie chart communicating the proportion of the total number of confirmed cases each continent has. The size of a continents section within the pie chart corresponds to the amount of cases that continent contributes to the global count. For example, the America’s appear to make up approximately 40% of the worlds COVID-19 cases. Two things that I did not expect to see in this graph was the low percentage belonging to Asia, and the high percentage assigned to Europe. I excepted to see a larger value for Asia because the virus originated in China. One possible reason for Asia’s lower values is the accusations that China has been lying about its numbers. In a Time Magazine article, Donald Trump is quoted claiming that “their numbers seem to be a little bit on the light side, and I’m being nice when I say that,” when asked about China’s reported numbers. Konrad Yakabuski’s article “<em>Why would we trust China’s official COVID-19 numbers” </em>even goes as far as claiming any comparison with Chinese data cannot be considered reliable. If Yakabuski’s statement is true, Figure 4 does not represent accurate proportions. Doubts around China’s data accuracy can also explain the large outlier on Asia plot in Figure 1 and Figure 2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*UOy-qHYJ-Tgresl45UNfog.png" /><figcaption><strong>Figure 4 — Proportion of Confirmed Cases Between Continents</strong></figcaption></figure><p>Further examining why Europe and America have such similar proportions in Figure 4 despite Figure 1 suggesting America would be much larger, the monthly cases of both America and Europe were plotted on Figure 5. Figure 5 displays the number of cases that we reported each month in 2020 for America and Europe. After analyzing Figure 5 it is clear that Europe and America have similar proportions because of the large spike that occurred in Europe during March. It is important to mention that a majority of the America continent cases are from the United States of America. This note is important to add because of the rapid increase in America’s cases between March and April. Is sudden change has brought many questions asking if the United States is past its peak or if May will be just as bad.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*G1DV01E_ZPoLm_CcPGQA5Q.png" /><figcaption><strong>Figure 5 — Europe and America Monthly Comparison In Confirmed Cases</strong></figcaption></figure><p><strong>3. Is America past its peak?</strong></p><p>One of the greatest debate right now is “are we past the peak”. Figure 6 visualizes a plot of the number of cases reported in the United States and how it has changed over time. The number of new cases in Figure 6 has appeared to plateaued in April. This flattening can be interpreted as the rate of change decreasing and some may consider it the conclusion of the first peak. Adrianna Rodriguez in her article <em>The US is slightly past its first peak, but expert says the pandemic is far from over</em>, states that scientists are unsure whether the first peak is over and that the only way to really know is to wait for future data. Rodriguez goes onto say that despite numbers going down, nearly half of the country is still experiencing growth in daily cases. At this time some states have begun lifting restrictions, but it will be some time until life returns to normal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*V4BWAonJwjHqNy44G9n8LA.png" /><figcaption><strong>Figure 6 — Number of Cases Reported in the United States of America</strong></figcaption></figure><p><strong>4. If a person gets COVID-19 what is the likelihood of surviving?</strong></p><p>With people close to me testing positive for COVID-19, one of my immediate thoughts was around the likelihood of them surviving the virus. Several factors need to be considered when determining an individual’s chance of recovery such as age, health, and availability to treatment. Figure 7 takes a holistic view at the chance of recovering from the virus after testing positive for each continent. Bars in Figure 7 represents the likelihood an individual has of dying if testing positive for COVID-19. The two continents with the largest death rate are Europe and America. This result is likely related to the volume of cases both continents have as shown in Figure 4 and Figure 5. The relationship between number of cases and number of deaths will be explored later in this post. It is possible that America has a lower death rate than Europe because America’s surge of cases came after Europe’s, granting more time to development treatments. Africa coming in with the third highest chance of death is likely linked to poverty and availability to treatment. Chris Dwyer places Africa’s chance at death as a result of a lack of hospital supplies and informal employment. Dwyer goes on to explain that without options to work from home individuals become vulnerable and treatment resources become scarce.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/609/1*GFB9k6UMQl_3INEO64-VEQ.png" /><figcaption><strong>Figure 7 — Various Continents Likelihood of Dying from COVID-19 After Testing Positive</strong></figcaption></figure><p><strong>5. What are the countries with the most deaths and cases? How does population affect those numbers?</strong></p><p>The ten countries that have reported the most confirmed cases and deaths can be found in Figure 8 and Figure 9 respectively. Countries that appear in both figures include USA, United Kingdom, Italy, Spain, France, Brazil, Germany, and Iran. This observations suggests that the amount of deaths can be directly related to the number of cases because eight of the ten countries with the most reported deaths are also the list for the most reported cases. It is surprising that China is not on either top ten list considering its early exposure. However, this result can be linked back to the claims of China’s inaccurate data.</p><p>To further support the claim that deaths are related to cases, Figure 10 plots the number of deaths for the countries with the highest death toll against their population, with the size of the dots corresponding to the amount of cases for a country. Larger dots on Figure 10 positioned rightwards indicate a greater death toll for countries with more confirmed cases. The same can be said for the smaller dots being more leftward, suggesting countries with less cases have a lower death toll. Figure 10 also communicates that population does not appear to affect the death count or number of cases for a country. This observation is a result of no pattern being present that relates population size to the amount of cases or deaths. Figure 11 supports the claim that population size does not affect the number of confirmed cases a country has by visually comparing the number of cases to the population for the countries with the largest populations. Bigger dots on Figure 11 symbolize a larger population for that country. The biggest dots belonging to China and India those case counts are in the middle of the group with smaller dots surrounding them. Observing that countries with smaller populations can have more and less cases than larger countries supports claim that population size does not impact the magnitude of cases present. When comparing these values to the listings on Worldometers, the accuracy is consistent.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*mYH8Topx0VdcJHeSOarfSw.png" /><figcaption><strong>Figure 8 — Countries with the Most Confirmed COVID-19 Cases</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/769/1*6V16SzajQCZHqEBeYWlW6Q.png" /><figcaption><strong>Figure 9 — Countries with the Most COVID-19 Deaths</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*ldLbV56ANRFGpV8BGqK4ug.png" /><figcaption><strong>Figure 10 — Comparison Between Deaths, Cases, and Populations for Countries with the Highest Death Toll</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/1*AKEWfBBsUorxS6Glr3i-kQ.png" /><figcaption><strong>Figure 11 — Population Size Versus Number of Confirmed Cases for the Largest Countries</strong></figcaption></figure><p>The second portion of my data analysis shifts its focus closer to home and focuses on Canada.</p><p><strong>6. How many cases and deaths does Canada have?</strong></p><p>Figure 12 displays that as of May 7th Canada had reported just over 62,000 cases and 4,000 deaths. These values align with various online resources such as Worldometer, and Global News.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/757/1*HwUfU7Kv2nYAj8VUjixw1g.png" /><figcaption><strong>Figure 12 — Count of Cases and Deaths in Canada</strong></figcaption></figure><p><strong>7. How does Figure 12 count differ by month?</strong></p><p>The monthly counts for the America’s was shown previously in Figure 5. Despite the United States overwhelming influence on the appearance of the American continent distribution for new cases, the visual in Figure 5 is very similar to the Canadian distribution presented in Figure 13. It appears that the amount of reported deaths compared to the amount of cases in Canada is larger in May than it was in April. This observation would indicate that a greater percentage of new cases are unable to recover from the virus.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*BOI4V8VZ4Eexq5gCFzGYzA.png" /><figcaption><strong>Figure 13 — Count of Cases and Deaths in Canada Per Month</strong></figcaption></figure><p><strong>8. What is the death rate for people that have tested positive in Canada?</strong></p><p>Figure 14 breaks down the death rate of people who have tested positive in Canada. The graph indicates that for consecutive months the percentage of people who are recovering is decreasing. The death rate has increased from ~6% in April to just over 10% for May. These values correspond with Worldometer’s data stating that approximately 7% of people who have tested positive will die.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*JxbwNPeEaSHQOCxYwpjyAg.png" /><figcaption><strong>Figure 14 — Death Percentage by Month for People That Tested Positive in Canada</strong></figcaption></figure><p><strong>9. Has social distancing done its job?</strong></p><p>A scatterplot of the number of the cases reported each day with a curve communicating the trend of the data is presented in Figure 15. The curve and the plots suggest that Canadian cases have plateaued between 1000–2000 new cases a day which is a positive reduction in the rate of change experience during mid-March. However both the data points and curve do not show any sign of a decrease in new cases yet. In conclusion, social distancing has done its job in slowing down the increases in new cases but the end has not been observed yet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*QDOYc9qM23VrLc1q49NfWQ.png" /><figcaption><strong>Figure 15 — Number of Daily Cases In Canada with Curve</strong></figcaption></figure><p><strong>10. Fact checking — Are the numbers on this website correct?</strong></p><p>When researching Canadaian data regarding the number of confirmed cases in Canada I came across the visual in Figure 16.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*hTaHPesUVnsX9NCCgmluJg.png" /><figcaption><strong>Figure 16 — COVID-19 Cases (Government of Canada, 2020)</strong></figcaption></figure><p>After analyzing the information presented in Figure 16 the values seemed low to me, especially for May. All of the information I have seen does not show the magnitude of decrease being communicated from the end of April onwards. The website states that Figure 16 “is based on cases for which a case report form has been received by the Public Health Agency of Canada”. In attempts to check the accuracy of this visual I replicated it using the European Centre for Disease Prevention and Control Dataset. This visual is shown in Figure 17. Comparing Figure 16 with Figure 17 highlights a major discrepancy in the data trends. Figure 17 continuously grows, whereas Figure 16 communicates a downward trend and contains more prominent dips. For this reason the visual in Figure 16 is considered not representative of Canadian cases throughout January-May of 2020.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*HPYAxxLTmMWHTCxq5FuWIQ.png" /><figcaption><strong>Figure 17 — COVID-19 Cases</strong></figcaption></figure><p><strong>11. How are the confirmed cases in Canada split up by province?</strong></p><p>Figure 18 compares the number of cases in each Canadian province utilizing a bar chart. The results conclude that Quebec makes up a large number of Canada’s total cases with Ontario and Alberta following behind. Figure 19 displays the composition of Canadian cases by province to better indicate the percentage of cases each province contributes to Canada’s total count. Figure 19 supports the results of Figure 18 and communicates that Quebec makes up over half of Canada’s cases, Ontario roughly 30%, and Alberta approximately 10%.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*raf07y_Ml9tQBtjHl2c12w.png" /><figcaption><strong>Figure 18– Number of COVID-19 Cases By Province</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/1*kzlnLleTmmHBUvgD-SIW3w.png" /><figcaption><strong>Figure 19 — Composition of Canada’s COVID-19 By Province</strong></figcaption></figure><p><strong>References</strong></p><p>Links that were referred to in this entry are listed below. They are ordered in the sequence they appeared in.</p><p>Schumaker, E. (April, 2020). <em>Timeline: How coronavirus got started</em>. Retrieved from <a href="https://abcnews.go.com/Health/timeline-coronavirus-started/story?id=69435165">https://abcnews.go.com/Health/timeline-coronavirus-started/story?id=69435165</a></p><p>Imray, G. (April, 2020). <em>Africa’s 43 per cent jump in virus cases in 1 week worries experts”. </em>Retrieved from <a href="https://www.ctvnews.ca/health/coronavirus/africa-s-43-per-cent-jump-in-">https://www.ctvnews.ca/health/coronavirus/africa-s-43-per-cent-jump-in-</a> virus-cases-in-1-week-worries-experts-1.4908510</p><p>Winsor, M. (April, 2020). <em>World’s 2nd largest continent Africa sees steep rise in coronavirus cases</em> Retrieved from <a href="https://abcnews.go.com/International/africa-faces-uphill-battle-">https://abcnews.go.com/International/africa-faces-uphill-battle-</a> coronavirus-pandemic-fragile-health/story?id=70285430</p><p>Bloomberg. (April, 2020). <em>China Hits Back at Report That It Hid Coronavirus Numbers.</em> Retrieved from <a href="https://time.com/5814313/china-denies-hiding-coronavirus/">https://time.com/5814313/china-denies-hiding-coronavirus/</a></p><p>Yakabuski, K. (April, 2020). <em>Why would we trust China’s official COVID-19 numbers?. </em>Retrieved from <a href="https://www.theglobeandmail.com/opinion/article-why-would-we-trust-">https://www.theglobeandmail.com/opinion/article-why-would-we-trust-</a> chinas-official-covid-19-numbers/</p><p>Rodriguez, A. (April, 2020). <em>The US is ‘slightly’ past its first peak, but expert says the pandemic is far from over.</em> Retrieved from <a href="https://www.usatoday.com/story/news/health/">https://www.usatoday.com/story/news/health/</a> 2020/04/28/coronavirus-johns-hopkins-expert-says-covid-19-pandemic- farover/3038429001/</p><p>Dwyer, C. (April, 2020). <em>U.N. Agency Fears Vulnerable Africa May Suffer At Least 300,000 COVID 19 Deaths. </em>Retrieved from <a href="https://www.npr.org/sections/coronavirus-live-">https://www.npr.org/sections/coronavirus-live-</a> updates/2020/04/17/836896562/u-n-agency-fears-vulnerable-africa-may-suffer-at-least- 300–000-covid-19-deaths</p><p>Worldometer (May, 2020). <em>Canada Cases, Deaths, and Amount Recovered. </em>Retrieved from <a href="https://www.worldometers.info/coronavirus/country/canada/">https://www.worldometers.info/coronavirus/country/canada/</a></p><p>Government of Canada. (May, 2020). <em>Epidemiological summary of COVID-19 cases in Canada. </em>Retrieved from <a href="https://health-infobase.canada.ca/covid-19/epidemiological-">https://health-infobase.canada.ca/covid-19/epidemiological-</a> summary-covid-19-cases.html</p><p><strong>Datasets Used</strong></p><p>European Centre for Disease Prevention and Control. (May, 2020). <em>Geographic distribution of COVID-19 cases </em>worldwide. Retrieved from <a href="https://www.ecdc.europa.eu/en/publication">https://www.ecdc.europa.eu/en/publication</a> s-data/download-todays-data-geographic-distribution-covid-19-cases-worldwide. Retrieved on May 7th, 2020.</p><p>Government Of Canada. (May, 2020). <em>Coronavirus disease (COVID-19) Outbreak update</em> Retrieved from <a href="https://www.canada.ca/en/public-health/services/diseases/2019-novel-">https://www.canada.ca/en/public-health/services/diseases/2019-novel-</a> coronavirus-infection.html. Retrieved on May 9th, 2020</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4abcb90e7f9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>