Risk-Adjusted Return With Python

Partha Mishra
The Startup
Published in
5 min readSep 12, 2020

(Real-world Analysis of US Equity data between 1926 to 2018)

Return and Risk are like the two sides of a coin. A risk-free return is like a state of utopia and each and every return generated on an asset needs to be looked at with the load of the risk it brings in the fold. The saying goes - higher the return higher the risk which albeit theoretically true when compared to cross-asset classes may not always hold true practically. In fact, there are a plethora of cases where this saying has been defeated in straight sets sometimes adding to the misery or joy of investors.

In a previous article, we have looked at modelling returns using Python. You might want to look at the same which will act a precursor to this analysis.

“Click here for my article on calculating Returns using Python”

As a next read one can look at my article on modelling drawdowns with Python…

“Click here for my article on Modelling Drawdown with Python”

In the notebook attached at the end of the article, what we have done is that we have taken a sample of price points for two asset classes, compute the returns and then proceeded to compute the Standard deviation and mean using Python provided formulas before doing the computation ourselves and matching them up. The concept of variance is arrived at first by calculating the returns deviation from the mean, squaring the same, make a cumulative sum before dividing it by the number of observations to get the variance:

Standard Deviation next is just the Square root of the variance and is also termed as the volatility of the time series.

Real World Analysis

Now we will try to do the analysis on a real set of data. A data set that provides us grouped returns on US stocks based on market capitalisation between 1926 to 2018. In the snapshot below what you see is the monthly returns seen for portfolios of stocks. The portfolios are again based on the market capitalisation of the individual stocks and grouped together.

We take on two portfolios here for our analysis, Lo 10( Lowest 10% stocks based on Market capitalisation)and Hi 10 (Highest 10% stocks based on Market capitalisation) columns for doing our analysis.So we will trim our data set to only show this two columns. A few cleanings here and there and some labelling to reflect Lo 10 as Small Caps and Hi 10 as Large Caps and you have the following plot:

Evidently the Small Caps are showing more amount of deviations from the mean(volatility) as compared to the large caps in the life span.However, to conclude on the observation we go ahead and calculate the annualised volatility from the standard deviation which is a monthly data point.

That nails our observation in terms of the deviations exhibited in the plot above.However, the argument does not stop here on which stocks have performed better and to further drill down we would need the annualised return on both series. To achieve the annualised rate of return, first thing is to calculate the return per month for both the series which is then annualised.Details are in the notebook, what we will paste here is the output:

Higher the risks, higher the returns, suits the adage. Seems so.let's look further.

Return to Risk and Mr. Sharpe

Instead of making plain and simple statements by looking at the returns and risk figures generated what we can employ is the Return to Risk ratio which will provide you on the return an investment made per unit of risk taken. So here we have:

Large Caps the winner here with a slightly higher Return/Risk value. lets look at another parameter.

Mr. William Sharp developed a risk reward ratio taking into cognizance the risk free rate. Well we started off by saying that there is nothing like that but indeed there are some more safer avenues of investment and US T bills are generally referred to as the safest and we can hypothetically consider them to be representing the risk free rate.

The Numerator captures the excess return of the portfolio with respect to the risk free rate and the denominator captures the portfolio volatility.

I will leave it to you to check on the computation in the notebook(provided in link), but, we can see that the lower market cap stocks showed a higher Sharpe ratio compared to the Large caps. This would mean that in the period 1926 to 2018 the period for which the data set belongs, Small caps have exhibited better performance in returns when compared to the volatility it brings to the table.

Click here to look at the notebook uploaded in Github for code.

--

--

Partha Mishra
The Startup

An Ounce of Finance, a pinch of communication, one tablespoon of Business Analysis skills with a garnish of Technology makes me up. Feel free on the servings.