Canadian Federal Election Predictions for 10/19/2015

Tomorrow is the date of the Canadian Federal Elections. Here are my predictions for the outcome:


That is, I predict the Liberals will win, with the NDP trailing very far behind either party. 

Do More Gun Laws Prevent Gun Violence?

Update: March 16, 2018: I have received quite a few comments about my critique of Volokh’s WaPo article, and just as a summary of my reply back to those comments:

The main point that I made and demonstrated below is that the concept of a correlation is only useful as a measure of linearity between the two variables you are comparing. ALL of Volokh’s correlations that he computes are close to zero: 0.032 for correlation between homicide rate, including gun accidents and the Brady score, 0.065 for correlation between intentional homicide rate and Brady score, 0.0178, correlation between the homicide rate including gun accidents and the National Journal score, and 0.0511, correlation between just the intentional homicide rate and National Journal score. All of these numbers are completely *useless*. You cannot conclude anything from these scores. All you can conclude is that the relationship between homicide rate (including or not including gun accidents) and the Brady score is highly nonlinear. Since they are nonlinear, I have investigated this nonlinear relationship using data science methodologies such as regression trees.

Article begins below:


  1. The number and quality of gun-control laws a state has drastically effects the number of gun-related deaths.
  2. Other factors like mean household income play a smaller role in the number of gun-related deaths.
  3. Factors like the amount of money a state spends on mental-health care has a negligible effect on the number of gun-related deaths. This point is quite important as there are a number of policy-makers that consistently argue that the focus needs to be on the mentally ill and that this will curb the number of gun-related deaths.


  1. Critique of Recent Gun-Control Opposition Studies
  2. A more correct way to look at the Gun Deaths data using data science methodologies.

A Critique of Recent Gun-Control Opposition Studies

In light of the recent tragedy in Oregon which is part of a disturbing trend in an increase in gun violence in The United States, we are once again in the aftermath where President Obama and most Democrats are advocating for more gun laws that they claim would aid in decreasing gun violence while their Republican counterparts are as usual arguing the precise opposite. Indeed, there have been two very simplified  “studies” presented in the media thus far that have been cited frequently by gun advocates:

  1. Glenn Kessler’s so-called Fact-Checker Article
  2. Eugene Volokh’s opinion article in The Washington Post

I have singled out these two examples, but most of the studies claiming to “do statistics” follow a similar suit and methodology, so I have listed them here. It should be noted that these studies are extremely simplified, as they compute correlations, while in reality they only look at two factors (the gun death rate and a state’s “Brady grade”). As we show below, the answer to the question of interest and one that allows us to determine causation and correlation must depend on several state-dependent factors and hence, requires deeper statistical learning methodologies, of which NONE of the second amendment advocates seem to be aware of.

The reason why one cannot deduce anything significant from correlations as is done in Volokh’s article is correlation coefficients are good “summary statistics” but they hardly tell you anything deep about the data you are working with. For example, in Volokh’s article, he uses MS Excel to compute the correlations between a pair of variables, but Excel itself uses the Pearson correlation coefficient, which essentially is a measure of the linearity between two variables. If the underlying data exhibits a nonlinear relationship, the correlation coefficient will return a small value, but this in no way means there is no relationship between the data, it just means it is not linear. Similarly, other correlation coefficient computations make other assumptions about the data such as coming from a normal distribution, which is strange to assume from the onset. (There is also the more technical issue that a state’s Brady grade is not exactly a random variable. So measuring the correlation between a supposed random variable (the number of homicides) and a non-random variable is not exactly a sound idea.)

A simple example of where the correlation calculation fails is to try to determine the relationship between the following set of data. Consider 2 variables, x and y. Let x have the data

x              y
-1.0000  0.2420
-0.9000  0.2661
-0.8000  0.2897
-0.7000  0.3123
-0.6000  0.3332
-0.5000  0.3521
-0.4000  0.3683
-0.3000  0.3814
-0.2000  0.3910
-0.1000  0.3970
0            0.3989
0.1000  0.3970
0.2000  0.3910
0.3000  0.3814
0.4000  0.3683
0.5000  0.3521
0.6000  0.3332
0.7000  0.3123
0.8000  0.2897
0.9000  0.2661
1.0000  0.2420

If one tries to compute the correlation between x and y, one will obtain that the correlation coefficient is zero! (Try it!) A simple conclusion would be that therefore there is no linear causation/dependence between x and y. But, if one now makes a scatter plot of x and y, one gets:


Despite having zero correlation, there is apparently a very strong relationship between x and y. In fact, after some analysis,  one can show that they obey the following relationship:

y = \frac{1}{\sqrt{2 \pi}} e^{-(x^2)/2},

that is, y is the normal distribution. So, in this example and similar examples where there is a strong nonlinear relationship between the two variables, the correlation, in particular, the Pearson correlation is meaningless. Strangely, despite this, Volokh uses a near-zero correlation of his data to demonstrate that there is no correlation between a state’s gun score and the number of gun-related deaths, but this is not what his results show! He is misinterpreting his calculations.

Indeed, looking at Volokh’s specific example of comparing the Brady score to the number of Homicides, one gets the following scatter plot:


Volokh that computes the Pearson correlation between the two variables and obtains a result of 0.0323, that is, quite close to zero, which leads him to conclude that there is no correlation between the two. But, this is not what this result means. What it is saying in this case, is that there is a strong nonlinear relationship between the two. Even a very rough analysis between the two variables, and as I’ve said above, and demonstrate below, looking at two variables for a state is hardly useful, but for argument sake, there is a rough sinusoidal relationship between the two variables:


In fact, the fit of this sum-of-sines curve is an 8-term sine function with a R^2 of 0.5322. So, it’s not great, but there is clearly at least some causal behaviour between the two variables. But, I will say again, that due to the clustering of points around zero on the x-axis above, there will be simply NO function that fits the points, because it will not be one-to-one and onto, that is, there are repeated x-points for the same y-value in the data, and this is problematic. So, looking at two variables is not useful at all, and what this calculation shows is that the relationship if there is one would be strongly nonlinear, so measuring the correlation doesn’t make any sense.

Therefore, one requires a much deeper analysis, which we attempt to provide below.

A more correct way to look at the Gun Homicide data using data science methodologies.

I wanted to analyze using data science methodologies which side is correct. Due to limited time resources, I was only able to look at data from previous years (2010-2014) and looked at state-by-state data comparing:

  1. # of Firearm deaths per 100,000 people (Data from:
  2. Total State Population (Obtained from Wikipedia)
  3. Population Density / Square Mile (Obtained from Wikipedia)
  4. Median Household Income (Obtained from Wikipedia)
  5. Gun Law Grade: This data was obtained from, which is The Law Center to Prevent Gun Violence and grades each state based on the number and quality of their gun laws using letter grades, i.e., A,A+,B+,F, etc… To use this data in the data science algorithms, I converted each letter grade to a numerical grade based on the following scale: A+: 90, A-: 90, A: 85, B:73,B-:70,B+:77,C:63,C-:60,C+:67, D:53,D-:50,D+:57,F:0.
  6. State Mental Health Agency Per Capita Mental Health Services Expenditures (Obtained from:
  7. Some data was available for some years and not for others, so there are very slight percentage changes from year-to-year, but overall, this should have a negligible effect on the results.

This is what I found.

Using a boosted regression tree algorithm, I wanted to find which are the largest contributing factors to the number of firearm deaths per 100,000 people and found:


(The above numbers were calculated from a gradient boosted model with a gaussian loss function. 5000 iterations were performed.)

One sees right away that the quality and number of gun laws a state has is the overwhelming factor in the number of gun-related deaths, with the amount of money a state spends on mental health services having a negligible effect.

Next, I created a regression tree to analyze this problem further. I found the following:


The numbers in the very last level of each tree indicate the number of gun-related deaths. One sees that once again where the individual state’s gun law grade is above 73.5%, that is, higher than a “B”, the number of gun-related deaths is at its lowest at a predicted 5.7 / 100,000 people. (Note that: the sum of squares error for this regression was found to be 3.838). Interestingly, the regression tree also predicts that highest number of gun-related deaths all occur for states that score an “F”!

In fact, using a Principle Components Analysis (PCA), and plotting the first two principle components, we find that:


One sees from this PCA analysis, that states that have a high gun-law grade have a low death rate.

Finally, using K-means clustering, I found the following:


One sees from the above results, the states that have a very low “Gun Law grade” are clustered together in having the highest firearms death rate. (See the fourth column in this matrix). That is, zooming in:


What about Suicides? 

This question has been raised many times because the gun deaths number above includes the number of self-inflicted gun deaths. The argument has been that if we filter out this data from the gun deaths above, the arguments in this article fall apart. As I now show, this is in fact, not the case. Using the state-by-state firearm suicide rate from (, I performed this filtering to obtain the following principle components analysis biplot:


One sees that the PCA puts approximately equal weight (loadings) onto population density, gun-law grade, and median household income. It is quite clear that states that have a very high gun-law grade have a low amount of gun murders, and vice-versa.

One sees that the data shows that there is a very large anti-correlation between a state’s gun law grade and the death rate. There is also a very small anti-correlation between how much a state spends on mental health care and the death rate.

Therefore, the conclusions one can draw immediately are:

  1. The number and quality of gun-control laws a state has drastically effects the number of gun-related deaths.
  2. Other factors like mean household income play a smaller role in the number of gun-related deaths.
  3. Factors like the amount of money a state spends on mental-health care has a negligible effect on the number of gun-related deaths. This point is quite important as there are a number of policy-makers that consistently argue that the focus needs to be on the mentally ill and that this will curb the number of gun-related deaths.
  4. It would be interesting to apply these methodologies to data from other years. I will perhaps pursue this at a later time.

Let’s not go overboard with this Trump stuff! 

It has certainly become the talk of the town with some of the latest polls showing that Donald Trump is leading Hillary Clinton in a hypothetical 2016 matchup.

I decided to run my polling algorithm to simulate 100,000 election matchups between Clinton and Trump. I calibrated my model using a variety of data sources.

These were the results:

Based on these simulations, I conclude that:

I think in the era of the 24-hour news cycle, too much is made of one poll.

Misinformation on Sikhism

Even though this posting is a bit different than my usual ones and is outside the scope of this blog, I thought that as a Sikh myself, I have stayed too silent on several issues with regards to the Sikh community, and certain principles of the Sikh religion, that are seemingly unknown to those both inside and outside of the Sikh community. I will address here some common misconceptions and misinformation about Sikhs that are both being spread inside and outside of the Sikh community.

  1. Sikhism is NOT a hybrid of Islam and Hinduism: Sikhism is a unique religion with a unique origin beginning with the teachings of the first Sikh Guru, Guru Nanak Dev Ji. Guru Nanak formed the religion to be uniquely different from Hinduism and Islam, as he opposed many of the practises common in those religions.
  2. Sikhs are not to cut their hair or trim their beards. This is perhaps the most common fact that is blatantly missed by those members of the Sikh community that wish to cut their hair and propagate this misinformation to defend their actions as being accepted in Sikhism. This is a very wrong ideology for several reasons:      Guru Gobind Singh Jee, the 10th Guru of the Sikhs explicitly described the form of a Sikh in Persian:

Ik Onkaar Sri Waheguru Jee Kee Fateh || Sri Mukhvaak PaatShaahee Dasvee||

Nishaanay Sikhi Ee Haroof Panj Kaaf|| Hargiz Na Baashad Ee Panj Muaf ||

Karra Kaardo Kachh Kanghaa Bida || Bila Kesh Haych Asat Jumleh Nishaa ||

Haraf Haae Kaat Asat Ee Panjkaaf || Bi Daanand Baavar Na Goyam Khilaaf ||

HukaaJaamat Halaalo Haraam || Baachishay Hinaa Kardaroo Sayaam Faam||

Note that the usual argument that this is for the Khalsa, and not Sikhs, is patently false, as Guru Sahib explicitly says “Nishaanay Sikhi”, and not “Nishaanay Khalsa”. This point is therefore a moot point.

Guru Gobind Singh Sahib also in his Hukam to the Afghanistan Sikh sangat said:

Tusi Khande da Amrit Panja to lena

Kes rakhne…ih asadee mohur hai;

Kachh, Kirpan da visah nahee karna

Sarb Loh da kara hath rakhna

Dono vakat kesa dee palna karna

Sarbat sangat abhakhia da kutha

Khave naheen, Tamakoo na vartana

Bhadni tatha kanya-maran-vale so mel na rakhe

Meene, Massandei, Ramraiye ki sangat na baiso

Gurbani parhni…Waheguru, Waheguru japna

Guru kee rahat rakhnee

Sarbat sangat oopar meri khushi hai.
Patshahi Dasvi

Jeth 26, Samat 1756

These are not my opinions. This is explicitly the command of Guru Gobind Singh Jee. Further, the aforementioned passages also explicitly state that Sikhs are not to drink alcohol or smoke. It is truly puzzling and embarrassing why drinking alcohol has become somewhat synonymous with Sikhs, particularly, in the Punjab region.

Further, Bhai Desa Singh Jee explicitly writes the following on trimming beards:

dhaarrhaa mushh sir kaes banaaee || hai eih dhrirrh jih prabhoo razaaee || maett razaaee j sees mu(n)ddaavai || kahu thae jag kaisae har paavai

It could not be more clear, that Sikhs are to emphatically not cut their hair or trim their beards.

3. Sikhs do not celebrate Diwali. There are many Sikhs around the world that insist on celebrating Diwali, the Hindu festival of lamps. Some have even justified this action by conflating the Bandhi Chorr divas related to Sri Guru Hargobind Sahib with the Diwali day. This is also wrong for the following reasons:

For years now, I have heard this constant story of how it is acceptable for Sikhs to celebrate Diwali as per the Hindu traditions of lighting lamps, etc… Further, Raagis and Bhai Sahibs in Gurdwaras have conflated Bandhi Chorr Diwas with lighting lamps as per Hindu Diwali traditions. They further support these ideas with the supposed Vaar from Bhai Gurdas Jee, in which they ironically only mention and repeat the first line! : “deewaalee dee raath dheevae baaleean”. Of course, just by reading this line, it would suggest that the aforementioned actions are justified. But taking one line completely out of context leads one to these conclusions. A full reading of Bhai Gurdas Jee’s Vaar on the Diwali matter which given the timeframe is also a historical first-hand account suggests that Sikhs are to practice completely the opposite and in fact, lighting lamps is contrary to Gurmat. The full Vaar’s transliteration is below:
Vaars Bhai Gurdaas 19-6

diwali dee raath dheevae baaleeani

thaarae jaath sanaath a(n)bar bhaaleean

fulaa(n) dhee baagaath chun chun chaaleean

theerathh jaathee jaath nain nihaaleean

har cha(n)dhuree jhaath vasaae ouchaaleean

guramukh sukhafal dhaath shabadh samhaaleean

The essence of this Vaar is in every line after the first. Namely, in the third, fourth, and fifth lines, Bhai Gurdas Jee compares those that celebrate Diwali by lighting lamps akin to those who go on long pilgrimages to find God, and to those who search for God by worshipping the stars, or things in nature, etc… All contrary to Gurmat by a simple reading of Japjee Sahib! Indeed, Bhai Sahib Jee in the last line clearly states that a person of Gurmat does not practice any of these things, which he declares to be temporary and pointless.

So, there you have it. A simple reading of the full Vaar changes the entire context of the “importance” of Diwali in Sikhism. I doubt many Sikhs will read this posting with sincerity, but someone has to speak the truth.

4. Sikhs Do Not Eat Meat: Sikhs most certainly do not eat meat. Despite this, many Sikhs continue to insist that eating meat is permissible as long as it is not Halal, etc. This is also wrong for the following reasons:

The Sikh Gurus including the Guru Granth Sahib Jee (the present living Guru of the Sikhs) very explicitly discuss how eating meat is not for Sikhs, some examples below:

1. Guru Granth Sahib – Page 1374 – “Kabeer Khoob Khaanaa Keecharee Jaa Mai Amrit Lon, Heraa Roti Kaaranay Galaa Kataavai Kaun”.

2. Guru Granth Sahib – Page 140 – “Jay Rat Lagay Kaparay Jaamaa Hoay Paleet, Jo Ray Peeveh Maansaa Tin Kio Nirmal Cheet”.

3. The essence of why a Sikh cannot be satisfied with “Jhatka” and simply opposed to Halal is due to Guru Naanak Dev Ji, Page 468 on SGGSJ: “Daaiaa Jaanay Jee Kee Kichh Pun Daan Karay”

Several other key points are as follows:

4. “Jee Badhoh So Dharam Kar Thaapoh, Adharam Kaho Kat Bhai.

Anpas Ko Munwar Kar Thaapoh, Kaa Ko Kaho Kasaaee. (SGGS 1103)

5. “Bed Kateb Kaho Mat Jhoothhay, Jhoothhaa Jo Na Bichaarey.

Jo Sabh Meh Ek Khudai Kahat Ho,To Kio Murghi Maarey” (SGGS 1350)

6. “Rojaa Dharey, Manaavey Mlah, Svaadat Jee Sanghaarey.

Aapaa Deldi Avar Nahin Dekhey,Kaahey Kow Jhakh Maarey” (SGGS 1375)

7. “Kabir Jee Jo Maareh Jor Kar,Kaahtey Heh Ju Halaal.

Daftar Daee Jab Kaadh Hai, Hoegaa Kaun Havaal” (SGGS 1375)

8. “Kabir Bhaang, Machli, Surapaan Jo Jo Praanee Khahey.

Tirath, Barat, Nem Kiaye Te Sabhay Rasaatal Jahey” (SGGS 1376)

9. “Kabir Khoob Khaana Khichri, Ja Meh Amrit Lon

Heraa Rotee Kaarney Galaa Kataavey Kon” (SGGS 1374)

These are examples/Hukams explicitly from Sri Guru Granth Sahib Jee going back to the days of Bhagat Kabeer Jee, to Guru Naanak Sahib, all the way to Guru Gobind Singh Sahib. This is factual evidence that your claims are incorrect, and any such claims made by Sikhs that only “Halal” is forbidden, is simply wrong, as these Sikhs do not have an answer/simply ignored such aforementioned verses from Guru Granth Sahib Jee, because of a desire to not leave meat.

5. Women in Sikhism

In Sikhism, women are completely equal to men, there is zero tolerance for those men that would treat women poorly or lower than them. Indeed, according to Sri Guru Granth Sahib Jee, women are to be treated higher than men:

From woman, (man) is born; within woman, (man) is conceived; to woman he is engaged and married. With woman

(man) establishes friendship; through woman, the future generations come. When woman dies, (man) seeks another

woman; because of woman, (man) becomes related (to other people – ਲੈਣ-ਦੇਣ ਦੇ ਸਾਰੇ ਸੰਸਾਰਕ ਬੰਧਾਨੁ, etc.). From her,

(even) kings are born; so why call her bad? From woman, woman is born; without woman, there would be no one at all.  (sggs 473).

6. Sikhs and Rakhdi/Raksha Bandhan Ceremony

There are many Sikhs around the world that insist on Rakhdi/Raksha Bandhan ceremony. Sikhs absolutely are not supposed to participate in this festival. On Raksha Bandhan, sisters tie a rakhi (sacred thread) on her brother’s wrist. This symbolizes the sister’s love and prayers for her brother’s well-being, and the brother’s lifelong vow to protect her.

This very concept implies that women are weaker than men and therefore need their protection. This is in direct conflict with Guru Nanak Dev Ji’s philosophy regarding women as described above, and very much against the Khalsa Rehat, where women and men take amrit equally! Therefore, the idea that women should tie a thread to their brother’s wrist for “protection” is very much against the concept of equality, and ignores the roles played by Sikh women in history that didn’t need any man for protection. Some examples are:

  • Mata Gujri Jee
  • Mata Ganga Dev Jee
  • Mai Bhago
  • Rani Sada Kaur
  • Mata Jito Jee
  • Bibi Rajni
  • Mata Kishan Kaur

And many, many others!


The purpose of this piece was simply to stop the misconceptions related to the aforementioned points from spreading.

Further, the majority of us live in free societies, where freedom of religion is the expectation and the norm. I am a big believer in this concept, and fully appreciate having such a law in existence. This of course means that people are free to practice their religion as they see fit. However, while this principle must absolutely be firm, I question what it means for someone to call themself a Sikh on one hand and disagree with the tenets that the Sikh gurus established. This is more ironic because Sikh means “disciple”. So, you can call yourself a Sikh, but if you don’t follow the principles of the Sikh religion, what “religion” are you following?

Hillary Clinton Still Has the Best Chance of Being The Democratic Party Nominee in 2016

A great deal of noise has been made in the previous weeks about the surge in the polls of Donald Trump and Bernie Sanders. This has led some people to question whether Hillary Clinton will actually end up being the Democratic party nominee in 2016. This was further evidenced by the fact that Sanders is now leading Clinton in the latest New Hampshire polls.

However, running an analysis on current polling data, I still believe that even though it is very early, Hillary Clinton still has the best chance of being the Democratic party nominee. In fact, running some algorithms against the current data, I found that:

Hillary Clinton: \boxed{99.9 \%} chance of winning Democratic nomination.

Bernie Sanders: \boxed{0.01\%} chance of winning Democratic nomination.

These numbers were deduced from an algorithm that used non-parametric methods to obtain the following probability density functions. 


Thanks to Hargun Singh Kohli for data compilation and research.