# Semivariance calculation (downside deviation)

what is the accurate formula for semivariance? I see two versions up to now:

1. this version which considers as N (denominator) all the numbers over/under the mean-or any other number. This is the same of a version of CFA (book: Quantitative Methods for Investment Analysis - 2004 page 136). This is the formula:

1. Another version (stated in another CFA´s book) shows a different formula. This is the formula (taken for another source):

.

The first difference is in the numerator (which is Min between "a","b") and the second is in the denominator (where N is over the entire sample).

Which one is the correct one and why? I want to use this in the Sortino ratio

PD: In addition, I found this other comment which summarizes what I meant (link):

ShaktiRathore It was my understanding that the downside deviation (i.e., denominator in Sortino) does not include the zeros; i.e., when PMAR, these positive excess values are EXCLUDED, not treated as zero. Although I had understood this to be the GIPS-compliant method (at the time I sat for the CIPM but this was several years ago ....), it seems to be controversial...

Thank you very much!

I am interested in Semivariance because I want to use it to compute the Sortino Ratio. I found an article on Sortino which answers to my question. Here is the link "Sortino ratio: A better measure of risk, by Tom Rollinger and Scott Hoffman", Futures Magazine 2013.

In this article the Sortino Ratio is defined as $$SR=\frac{R-T}{TDD}$$ where R is the average period return, T is the target or required rate of return, and TDD is the Target Downside Deviation, which is found as $$TDD=\sqrt{\frac{1}{N}\sum_{i-1}^N[\min(0,X_i-T)]^2}$$

From a practical point of view, the calculation must take into account all the data (substituting a zero for those values above or equal to your target), not just the observations below the target. This is so the Sortino ratio will return a higher value that Sharpe ratio when there are many observations above the target. If you consider a reduced sample (excluding zeros in the denominator) the Sortino will be lower than Sharpe, which is not the idea of this ratio.

"The Sortino ratio takes into account both the frequency of below-target returns as well as the magnitude of them. Throwing away the zero underperformance data points removes the ratio’s sensitivity to frequency of underperformance."

"Consider the following underperformance return streams: [0, 0, 0, –10] and [–10, –10, –10, –10]. Throwing away the zero underperformance data points results in the same target downside deviation for both return streams, but clearly the first return stream has much less downside risk than the second."