Page 1 of 1
What is the use of the Semideviation ratio?
Posted: Fri Nov 13, 2009 5:45 pm
by bobsyd
[MOD]: In reaction to this piece of code in the Blox Marketplace : Semideviation Ratio performance statistic, bobsyd comments:
Not sure I understand the point of having the threshold. Notice you set the default at 15. But what if you set the parameter to 0 or to 30. The calculated numbers would obviously be different, but what is the use of the absolute semideviation ratio. Presumably the important thing is the relative value of the ratio in different tests?
Here is the source code of the Marketplace Blok:
Code: Select all
' Calculate the Semideviation Ratio using weekly equity readings (every 5 bars)
VARIABLES: sum_good, sum_bad, weekly_threshold, weekly_return TYPE: floating
VARIABLES: delta, avg_weekly_return, semideviation, apr, the_ratio TYPE: floating
VARIABLES: i, numdays, numweeks TYPE: integer
numdays = test.currentDay
numweeks = 0
weekly_threshold = (1.0 + annual_Thresh)^(1.0/52.0)
sum_good = 0.0
sum_bad = 0.0
' walk forward thru time == backward thru totalequity[] array
FOR i = numdays - 1 TO 6 STEP -5
numweeks = numweeks + 1
weekly_return = test.totalequity[(i-5)] / test.totalequity[i]
delta = weekly_return - weekly_threshold
IF(delta < 0.0) THEN
sum_bad = sum_bad + (delta * delta)
ENDIF
sum_good = sum_good + weekly_return
NEXT
avg_weekly_return = sum_good / AsFloating(numweeks)
semideviation = SquareRoot(sum_bad / AsFloating(numweeks))
apr = 1.0 + ((avg_weekly_return - 1.0) * 52.0)
the_ratio = (apr - (1.0 + annual_Thresh)) / semideviation
test.AddStatistic( "Semideviation", the_ratio )
Posted: Mon Nov 16, 2009 2:45 pm
by sluggo
Two pretty good discussions appear in the first ten Google hits. (You
did try Google, didn't you?)
One is a digital archive of Jack Schwager's book "Managed Trading" (Google found it
(here) ), and the other is the Trading Blox User's Guide, which Google found on the Blox sales site. I snipped out a part of it and pasted it below.
Posted: Mon Nov 16, 2009 2:59 pm
by bobsyd
Yes I did and yes I read both of those you identified and others. I get the overall concept. My question relates specifically to the setting of the Threshold parameter. Don't know how to make my question clearer.
Posted: Mon Nov 16, 2009 6:35 pm
by bobsyd
Sluggo, you may be wondering about the Subject of the post given the contents of my question. The answer is that I didn't choose the title, Tim did when he moved it from where it originally was, a followup to your post responding to my post in "System for Sale". Quite sensible for Tim to move it, but I suppose the Subject is a little misleading given the contents of the question.
It's really just a conceptual mathematics type question, perhaps kind of like the no risk free rate in the Modified Sharpe Ratio versus the Annual Sharpe Ratio which apparently makes the Modified Sharpe "less sensitive to changes in leverage" according to Trading Blox Help. My math skills aren't good enough to know why, but I probably don't need to know.
In relation to Semideviation, I was just wondering if there was also a non obvious implication to interpreting results after changing the Threshold parameter up or down.
Posted: Thu Nov 19, 2009 2:21 pm
by sluggo
Mathematically, the Sharpe Ratio and the Semideviation Ratio have the same algebraic formula: Ratio = ((CAGR - A) / B). But their creators chose different A's and different B's.
The two Ratios have the same formula because they seek the same goal: to express desirability or "goodness" as a ratio (Gain / Pain).
Both of them choose to define Gain as an excess return. (Gain = (CAGR - A))
In the case of the Sharpe Ratio, the excess return is the return exceeding the "Risk Free Rate of Interest", abbreviated RFR. (People often take RFR to be the 30-day or 90-day TBill interest rate). In the Sharpe Ratio, the numerator is (CAGR - RFR). In effect, "If you can't beat the Risk Free Rate, just go away. I'm not interested."
In the case of the Semideviation Ratio, the excess return is the return exceeding the "Minimum Acceptable Return". MinAcceptableReturn may or may not be the same as RFR; it's a user selectable parameter. In effect, "If you can't beat my chosen value of Min Acceptable Return, just go away. I'm not interested".
We're halfway home. We've got the numerators; now on to the denominators. Recall that denominator = B = "Pain" for both ratios; but the creators of these ratios defined "Pain" differently.
Both Ratios use "Variability of returns" as their way of measuring "Pain". The less variable the returns, the better, according to these ratios. And what is INFINITELY good is when all returns are exactly equal, meaning the variability of returns is zero.
The Sharpe Ratio uses the standard deviation of the returns as its estimate of variability. The denominator of the Sharpe Ratio is: Pain = StdDev(all returns).
As Schwager mentions in his book (link to Google's digital scan of the book, above), many people disagree with the idea that all variability is bad. Thus was born the Semi-Deviation, which measures the variability of only the bad weeks. And what is a "bad week"? Why, it is a week whose excess return (return minus one week's worth of the MinAcceptableReturn) is negative. A week in which you failed to meet the Min Acceptable Return.
Thus the Semideviation Ratio uses the standard deviation of the bad weeks' excess returns as its estimate of variability. Pain = StdDev(return - MinAcceptableWeeklyReturn) for the bad weeks.
If you scroll up to the first post of this thread, and then read through the Blox BASIC source code for this Blok, you can see these calculations laid out.
Posted: Thu Nov 19, 2009 3:16 pm
by bobsyd
Thanks Sluggo, funnily enough I was just rereading Google searches for "semideviation ratio formula". My problem is twofold.
1. I get the general concept of risk free rate and why one would, because of risk and personal objectives, want to set a higher than RFR target return, or minimum CAGR, for one's trading. However, I have trouble getting my mind around choosing a higher than zero CAGR in the calculation for deciding what is "bad" volatility for a semideviation calculation.
2. Be that as it may, I thought that perhaps in practical terms it doesn't really matter since one is unlikely to spend much time pondering the absolute value of the semideviation calculation. One is presumably primarily going to look at the relative value of the semideviation calculation in various system/parameter tests. Assuming this is the case, then the question becomes how often will the best (highest) value of semideviation be associated with different parameter sets if, for instance in one set of tests you use 15% for the threshold and in another you use 0%.
And then of course the bottom line, assuming semideviation forms part of the decision making in choosing parameter values to trade a system with - will you make more money if you've used 15% as the threshold or 0% (and what will be your max DD along the way)! (Which then gets to my favorite topic - walk forward testing!)
Posted: Fri Nov 20, 2009 4:54 pm
by bobsyd
Sluggo - anticipating a potential response, or a no answer therefore implied response, of "just test it", I did.
Based on a few tests, it seems that a 0% min CAGR semideviation threshold results in a lower CAGR, but broadly similar MAR, lower Max DD and shorter longest drawdown than a 15% min CAGR threshold on average for the top 10 optimization test results.
I can vaguely imagine a conceptual rationale for those results, but I could be just trying to fit a concept to a very limited sample of results.
Hope Sluggo or someone else has some comments, but if not I'm done on this.
Posted: Tue Nov 24, 2009 1:04 pm
by nodoodahs
bobsyd wrote:...I have trouble getting my mind around choosing a higher than zero CAGR in the calculation for deciding what is "bad" volatility for a semideviation calculation. ...
Assume: you have chosen a minimum compounding rate based on [whatever]. The only "risk" that matters to you; the only "variation" that counts; is NEGATIVE.
If you use the total variation in returns (as in the Sharpe ratio), you effectively "penalize" the system for having UPSIDE VOLATILITY. Hey, when you want a MINIMUM return, isn't getting wildly more than you asked for a GOOD THING?
That's the theoretical basis between using semideviation instead of total deviation.
Posted: Tue Nov 24, 2009 1:40 pm
by bobsyd
Hi Noododahs
Thanks for responding. I understand, and have for some time, understood the benefit of looking at trading statistics based on only upside or "good" volatility (eg semi deviation) versus those looking at all volatility (eg Sharpe ratio).
My lack of understanding is around, in your post "Assume: you have chosen a minimum compounding rate based on [whatever]." I'd appreciate it if you or someone would reread this topic from the start. Or perhaps I live in a parallel universe where I think I'm writing understandable English but to everyone else it is gibberish!
Cheers,
Bob
Posted: Tue Nov 24, 2009 2:28 pm
by nodoodahs
Actually, I just today read the entire thread, start to finish, for the first time, today, before responding. It's said communication has seven steps and some of them are in the sender's camp, some of them in the receiver's camp.
The relative ranking of different systems changes as the target increases. That's the use of the relative ratio for a given threshold. If the threshold is LOW, a relatively conservative system might grade higher than an aggressive one that compounds faster, but at more variability. If the threshold gets high enough, there's no substitute for a high compounding rate.
Take two systems, both with the same "grade" at a threshold of 6%. One has a compounding of 9% annually and one compounds at 14% annually, although with a higher downside volatility. If you increase the threshold to 8%, it will have a greater impact on the 9% compounding system than on the 14% compounding system, that is, it will capture proportionately more of the "conservative" system below the threshold, compared to the "aggressive" system. This will change your relative assessment of the systems, i.e., the relative value of the new ratio for different systems.
I might set that threshold based on a variety of things.
Perhaps I have a set amount of assets and retirement budget, and some assumptions about CPI in the future? That might lead me to set a particular minimum compounding rate.
Perhaps I have a retirement goal, i.e., I need $xx dollars by the end of yy years in order to retire. That might lead me to set a particular minimum compounding rate.
Perhaps I need to outperform some benchmark in order to attract investors to my fund. That might lead me to set a particular minimum compounding rate.
If you find WE (both sender and receiver) are still having difficulty communicating, use the "email" button at the bottom of my post. We'll iron it all out together and then post a final explanation to the thread for later readers.