Let us now find out the various measures along with the formula of each for risk-adjusted return in Python. The following are the measures: Sharpe ratio Information ratio Modigliani ratio (M2 ratio) Treynor Ratio Jensen’s Alpha R-squared Sortino Ratio ...
In the code above, we are calculating R-squared value using the formula:1 - (sum of squared residuals / sum of squared total variation). The squared residuals are obtained by subtracting the predicted values (yhat) from the observed values (y), then we square the differences, and sum them...