A Simple Model on R.

Image for post
Image for post
Joe Biden and Donald Trump

The 2020 US Presidential Election is this week and having decided to throw my hat in the prediction game, I have come up with a very simple model that will allow me to raise the confidence I have in my prediction compared to a mere guess. Through Bayesian Statistics, I have used previous US presidential election results in order to estimate the 2020 election.

Developed by Thomas Bayes and later Pierre-Simon Laplace, Bayesian Statistics introduces the idea of posterior distribution. The posterior distribution consists of the posterior mean and standard error. This distribution is calculated using;
- The prior (historical) distribution p ∼ N(μ,τ)
- The current data Y|p ∼ N(p,σ)
This allows us to calculate;
- E(p ∣ y)=Bμ+(1−B)Y where B = σ^2 / (σ^2 + τ^2)
- SE(p ∣ Y)^2 = 1 / ((1/σ2)+(1/τ2))
To understand the notation, consider the US 2020 presidential election. Polling allows us to find the opinion of sample group. We can aggregate the individual polls in order to get a better idea about the true opinion; as an aggregate poll reduces the errors that occur in a single poll (biased polling group, biased pollster, recent drastic news, etc). However, we are still only considering the current polling data we have. This limits our view as we are not considering the historical ways a country has voted. The reason historical data in important is that it provides us with a perspective that is above the current wave of politics. With the US tense and divided it is hard to gauge a view simply through polling. Add to this COVID — 19 and now the group that is answering polls can be just a select group. Historical data also shows the average voting direction of states. …

Economic Conditions Have Transformed The Nature Of The Free Market

The Lockdown due to the pandemic has caused one of the biggest transfers of wealth around the world. In the United States for example, the unemployment rate is at 8% dropping from a peak of almost 15% in April. This would mean that currently, roughly 12.58 Million people are unemployed. The dramatic nature of this joblessness can be seen in almost every country. There is simply no demand for work. At the same time, Billionaires around the world have gain enormous amounts of wealth. This does makes sense, in a global lockdown, only large firms have the capital, supply chains and delivery methods in order sustain a dramatic change in demand; and meet the unique needs required in order to operate during a strict lockdown. …

Short Term Benefit — Long Term Costs

Image for post
Image for post
Justice Ginsburg Official Portrait 2016

On the 18th of September, Ruth Bader Ginsburg passed away at the age of 87. Having served 27 years in the her legacy, regardless of one’s politics, is sealed in history as a highly respectable, pioneering women who lived a brilliant life.

Her passing, leaves the supreme court with 8 justices, in an election year where there is bound to be involvement of the supreme court due to the complexities of voting (and counting votes) across the United States. An additional layer of complexity in this process is the question of who has the right to nominate the next supreme court justice. In the United States, this decision is highly political. …

Using Only A Couple Line Of Code

Graphing data allows one to analyse patterns, display findings and overall; create a more digestible way to swiftly convey information. Matplotlib, a package on Python makes this incredibly easy. With simple coding, the package allows individuals with even rudimentary understanding of Python to be able to create graphs which both convey the relevant information and do so in a simply and appealing manner.

Importing Matplotlib

To import matplotlib, open your jupyter notebook and type in:

import matplotlib as mpl 
import matplotlib.pyplot as plt

This imports the package required for graphing data. …

Using Brexit Poll Data To Predict The Referendum Result

Every election cycle the public is treated to a slew of election polling. Conducted by a myriad of organizations these polls attempt to represent public opinion regarding specific issues. Increasingly however, there has been a politicization of polls which have been placed in the same basket of “fake news”.

In fact, News agencies often cover how polls failed to predict the election result. With the Brexit referendum for example, the Washington Post, Guardian, Telegraph and CNBC have all covered how polls and pundits where wrong about the election results.

Image for post
Image for post
Show The Data-frame of Brexit Polls

This Article attempts to show how polling is simply a measure of a small part of the populations at one specific point in time at a specific position. It will also show why these ‘specific’ conditions are important. The analysis will be done on RStudio. For Reference the entire code used is up on my personal GitHub. …

Or Risk Being Taken Advantage Of and Alienated In Political Representation

Image for post
Image for post
Gallup Poll Results

On of the most culturally challenging topics globally and particularly in the United States, is the legality and morality of Abortion. In fact, the issue of Abortions is a matter that is debated in every election cycle by every major candidate in the US and the western world broadly. Polls conducted by Gallup since 1992 shows that a majority of the voters believe that either a candidate must share their views on Abortion in order to gain their vote or the issue of Abortion is “one of many important factors” in their voting choices.

The question of morality is one that depends on the self-imposed belief of an individual and hence is a challenging arrangement to make politically. Every election cycle candidates place themselves in two camps; “Pro-Life” and the “Pro-Choice”. These categories have increasingly required less explanations and even less debate, with the emotions that come with it taking control of the discussion and accusations of immorality thrown around. This has left much of the actually policy to be decided by the courts and which every political party happens to be in government, doing their best to impose the will of one side on the other. …

Make Your Basic (and later complex) Calculations Easy

The R Program allows one to create and use their own function in order to make data processing easy. Here, I will be taking the Quadratic Formula, creating it in R and will run the function with some example to show how R can make calculations easier regardless of whether one aims to use R for statistics for simply for the fun of it.

Image for post
Image for post

The Quadratic Formula allows one to find the solutions for a quadratic equation, typically: ax² + bx + c = 0, where one can solve for the value for ‘x’ given the value of ‘a’, ‘b’ and ‘c’. …

As Western Politicians Find Themselves Dealing With COVID — 19

Image for post
Image for post
Flag of Hong Kong (Left) Flag of China (Right)

Often referred to as “one country, two systems”, Hong Kong was officially returned to China by the United Kingdom in 1997 (after the expiration of a 99 year lease signed in 1898). Since then, Hong Kong has been in a constant state of long term political uncertainty with ebbs and flows in the level of news coverage it receives vis-à-vis the People’s Republic of China. …

Image for post
Image for post
Unemployment Rate Canada Since 1995

The lockdown due to the virus has caused a slump in demand and a shrinking in the national income. The economic damage caused to the economy is staggering. For context, at the height of the 2008 recession, the unemployment rate peaked just above 8%. Now the unemployment rate is at 13%, with a 11% drop in the number of employed month on month. This number however, does very little to represent the true nature of the crisis that is bound to reach a crescendo if it is not addressed as a whole.

First the unemployment number does not truly reflect the true number of the individuals unemployed. As defined by the Canadian government, to be considered as unemployed, one has to satisfy three conditions other than being over the age of…

A Basic Introduction

The Normal Distribution, like any Distribution is the probability function that shows how the variables of a population (or sample) are distributed. The distribution of variables is important as it allows us to better understand and make inferences about the data. The unique thing about the Normal Distribution is that is symmetrical to the mean. This mean that once one identifies the mean (the mathematical average) the distribution is even on both sides of the mean — meaning, the probability of a observing a variable decreases evenly as the variable being considered is further away from the mean.

Image for post
Image for post
A Example of a Normal Distribution

As one can see, the image on the left shows an example of a Normal Distribution. Lets consider that 50 (the mean) is the average liters of water a person uses when they shower. If the probability distribution of the data we collect appears to be a Normal Distribution, then that would mean that the probability of finding an individual who uses less than 35 (15 units below the mean) liters of water is as rare, on average, as finding an individual who uses more than 65 liters (15 units above the mean). …


Abhinav Dholepat

Undergrad Student at the University of Waterloo (intensive specialisation in Economics with a minor in history) I write politics, economics and history.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store