# Sharpe ratio inference - StudentT vs Normal Distribution

Let me try to explain the experiment which I’ve done here. Inspired by some code samples from pyfolio, I’m trying to fit a bayesian model to infer the sharpe ratio (and its credible interval) for a given series comprised of daily returns.

I’ve generated some synthetic data to represent a skewed and fat tailed distribution. So, in this experiment, I haven’t used any real data, but the return stream should be somewhat representative of a strategy or an asset with extreme skew and kurtosis. The median for the generated values is positive, but there’s strong negative skew and kurtosis.

Using a StudentT distribution to represent the returns, similar to how it is done in pyfolio, it seems that the posterior values for the sharpe ratio distribution are capped at around zero. So if I try to estimate the probability that the sharpe ratio is negative using this posterior, it actually gives me 0 probability, which is not intuitive at all. Since there’s extreme negative skew, I would expect a non negligible probability for the sharpe ratio being lesser than 0. The problem seems related to how the mean_returns have only positive values in the posterior, when the StudentT distribution is used.

Here is code that I’ve used to do the experiment:

with pm.Model() as model:
mu = pm.Normal('mean_returns', mu=0, sd=0.1)
sigma = pm.HalfCauchy('volatility', beta=1)
nu = pm.Exponential('nu_minus_two', 1 / 10)
returns = pm.StudentT(
'returns',
nu=nu + 2,
mu=mu,
sd=sigma,
observed=_rets
)

pm.Deterministic(
'annual_volatility',
returns.distribution.variance**0.5 *
np.sqrt(252)
)

pm.Deterministic(
'sharpe',
returns.distribution.mean /
returns.distribution.variance**0.5 *
np.sqrt(252)
)

trace = pm.sample(5000, tune=2000, target_accept=0.95)


and here’s the trace plot:

Doing the same experiment, but using a Normal prior for the daily return distribution, the results are much more intuitive. However, I’m confused about the fact that the StudentT distribution accounts for fait tails and so intuitively it should give more reliable results for these kind of fait tailed return streams. Any advice on what I am missing here?

Code for the experiment with the Normal prior:

with pm.Model() as model:
mu = pm.Normal('mean returns', mu=0, sd=0.1)
sigma = pm.HalfCauchy('volatility', beta=1)
rets = pm.Normal('returns', mu=mu, sd=sigma, observed=_rets)

pm.Deterministic(
'annual volatility',
rets.distribution.variance**0.5 *
np.sqrt(252)
)

pm.Deterministic(
'sharpe',
rets.distribution.mean /
rets.distribution.variance**0.5 *
np.sqrt(252)
)

trace = pm.sample(5000, tune=2000, target_accept=0.95)


Here’s the trace for the experiment using the Normal prior. Almost all the posterior values of the sharpe ratio are negative. This is much more intuitive, since the returns have extreme negative skew.

and this is the distribution of the synthetic returns data:

(Sorry for the triple post, only one image per post was allowed)

I know nothing about Sharpe ratios or finance, but here’s my 2 cents (get it?):

Since there’s extreme negative skew, I would expect a non negligible probability for the sharpe ratio being lesser than 0.

I would agree that there should be a non-negligible probability of returns being less than zero. You can check the StudentT model to confirm by conducting posterior predictive checks. Without being able to run your model, I can only recreate an approximation of what your model says about the estimated return distribution. But if we assume that the mean is .0006, the volatility is .0025, and nu is 2, then returns would be distributed like this:

Here, the probability of a negative return is approximately 0.41. So why is the model so confident that the mean return is positive when negative returns are so likely? Because the return distribution is very non-normal. It’s a pointy lump sitting very close to (but slightly above) zero with non-trivial tails heading off in both directions. The negative returns in the observed data are consistent with the positive mean because these are treated as outliers (i.e., captured by the fat tails).

In general, Student’s t distributions are used when you don’t want an estimate of a mean to be overly influenced by extreme values. This is what you are seeing. The estimated mean in the StudentT model is shifted away from the empirical mean in the direction of the empirical median. The estimated mean in the Normal model is much more influenced by these extreme negative values.

Unrelated to the +/- of the Sharpe ratio: note that the scale parameter in Student’s t distribution is generally not the standard deviation of the distribution. Indeed, the standard deviation of the t distribution is infinite when 1 \lt \nu \le2 and undefined when \nu \le 1 . Relatedly, I suspect that you are overestimating the normality of the return distribution by constraining \nu to be greater than 2.

1 Like

@cluhmann, this is a very good point. I think this rationale explains what is happening here. Since the median is positive for the synthetic returns I’ve generated, the mean inferred by the StudentT model is influenced by that.

My initial intuition was completely wrong, since my goal is to infer a broader credible interval for the sharpe ratio, when fat tails are observed in the returns. Using the StudentT model seems to do the opposite, given that the credible interval is actually narrower for this case.

In other words, if I have 2 different returns vectors, the credible interval for the sharpe ratio of the fat tailed one should be broader (to account for uncertainty related to extreme events) than the other inferred for a normal returns vector (without fat tails). Any advice on how to accomplish such a model? The normal model does not either seem to exhibit the behavior I would like, although better than the StudentT model.

I’ve uploaded to github (with some modifications) the notebook I used to do the experiment, if anyone wants to reproduce.

Sharpe Ratio Inference