Back to Community
Quantopian Lecture Series: Spearman Rank Correlation

This notebook is a primer on Spearman Rank Correlation, a technique that is robust to differing scales in the underlying data and non-normal distributions. It is part of this umbrella lecture.

This is part of Quantopian’s Lecture Series. We are currently developing a quant finance curriculum and will be releasing clone-able notebooks and algorithms to teach key concepts. This notebook will be presented at this meetup. Stay tuned for more.

Credit for the notebooks goes to Evgenia 'Jenny' Nitishinskaya, and credit for the algorithms goes to David Edwards.

Loading notebook preview...
Notebook previews are currently unavailable.

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

8 responses

An updated version of this notebook has been shared here:

is there... a statistical significance for T-value ?

A t-test will produce a t-value (AKA a t-statistic). The t-value by itself is not very useful, and must be translated to a p-value to be interpreted. The reason for this is because the degrees of freedom, a statistical property I will not go into here, affect the significance cutoff. Higher degrees of freedom need lower and lower t-statistics to be significant.

Many python tests will output a p-value along with the test statistic (t-statistic, z-statistic, etc.). If the test doesn't output a p-value, then you must manually transform it using either another function or a table. There are definitely some subtleties to all this, so when in doubt I recommend turning to Wikipedia's articles on these tests.

SO.. if try to find the beta... or slope of the line...say.. in bloomberg.. terminal in a regression analysis... if p value is not less than .05 I should ignore... the regression.. and its interpreted as no better than random...? is that correct?

The first thing I would do is choose a p-value cutoff that's appropriate for you. .05 works for many applications, but still leaves a 5% chance that the analysis falsely reports a relationship in the data. Picking a lower p-value cutoff will make you more sure in your analysis, but the reality is that in the real world, very very rarely will a regression come up with a p-value of say 0.0001. Try to choose a cutoff that makes you relatively sure, but doesn't handicap your analysis too much. 0.05 or 0.01 are probably good choices.

It is very important that you choose this p-value cutoff once and then never alter it until you've moved onto a different project. If you allow yourself to alter the cutoff on the fly, you open yourself up to many biases.

Once you've chosen your cutoff for the entire project, yes you are correct. A p-value > cutoff should be interpreted as no better than random guesses and the analysis should not be trusted. Of course, there are exceptions to the rule as finance is a game of 51-49% advantages, but generally you should ignore results with p-value > cutoff unless you really know what you're doing.

thanks Delany Ive seen.. some equity research analyst take the beta at bloomberg... even thu... the p-value is say .5 or more.. and thats why Im asking for the t-value.. since t value falls on .005 or less than .05 but turns out not that important.

I see, yes it is definitely good practice to trust your p-values.

Also, just pinging here that this lecture, along with all the others, is available at