Hi Ron, I came accross your message only yesterday so I don't know if you are still interested in this > If someone could tell me why the Sqrt > (SumOfSquaredDeviationsOfBarNumber) function is needed, I would > greatly appreciate it.
The answer is because StdErr of the regression and Sqrt(SumOfSquaredDeviationsOfBarNumber) are much easily available in most software built-in formula. Therefore once you know that StdErr of the regression divided by the Sqrt(SumOfSquaredDeviationsOfBarNumber) equal the StdErr of the slope - which is the required figure in the K-ratio formula - you understand why when it comes to implement the calculation the Sqrt(SumOfSquaredDeviationsOfBarNumber) is preferred. I hope it helps, paolo --- In [email protected], "Ron Rowland" <rowl...@...> wrote: > > Tomasz, this both helps clear things up and makes things more > confusing at the same time. > > First, it helps clear things up because now I understand why our two > formulas produce the same results (for values of n > 50). The > function Sqrt(SumOfSquaredDeviationsOfBarNumber) quickly reaches a > limit of Sqrt(n)*(n) / Sqrt(12). They are equal to within 2 > significant digits when n is 10 or greater, 3 significant digits once > n is about 20, and more than 5 significant digits for n > ~210. > > Therefore, my formula does match the AmiBroker K-Ratio results when n > is large enough: > > K-Ratio(AmiApprx) = LinRegSlope / StdErr * sqrt(n) / sqrt(12) > > This produces same K-Ratio as AmiBroker for values of n > 50. Maybe > some math wizard out there can explain to us why the sqrt(12) is a > magic number/factor when calculating Sqrt > (SumOfSquaredDeviationsOfLinearFunction). > > > Now for the more confusing part. Why is Sqrt > (SumOfSquaredDeviationsOfBarNumber) part of your K-Ratio numerator? > I have read the Lars Kestner S&C V 14:3 article many times (as well > as any other info I could find on this subject). No where could I > find any mention of the Sqrt(SumOfSquaredDeviationsOfBarNumber) > function, with the exception of the Excel example stated below. I do > not have a copy of his book, but the Kestner article clearly states > that: > > K-Ratio(1996) = LinRegSlope / (StdErr * Sqrt(n)) > which was later revised to > K-Ratio(2003) = LinRegSlope / (StdErr * n) > > In the article's example calculations, the numerator is shown as 0.58 > for System 1 and 0.55 for System 2. This is the LinRegSlope for > those two systems. It is not the LinRegSlope * Sqrt > (SumOfSquaredDeviationsOfBarNumber). > > To complicate things even more, the Excel example in the Kestner > article introduces the Sqrt(SumOfSquaredDeviationsOfBarNumber) > function in the denominator but provides no reason why. Perhaps this > is explained in his book or perhaps it has something to do with the > way that Excel calculates StdErr of LinRegLine versus the way that > TradeStation does. There also appears to be an error in the > description of the Excel formula as the sqrt(n) is shown as a > multiplier instead of a divisor. > > If someone could tell me why the Sqrt > (SumOfSquaredDeviationsOfBarNumber) function is needed, I would > greatly appreciate it. > > > > > --- In [email protected], "Tomasz Janeczko" <groups@> > wrote: > > > > > K-Ratio(Ami) = LinRegSlope / StdErr * sqrt(n) / sqrt(12) > > No it is NOT ! > > > > K-Ratio (AMI) is > > > > LinRegSlope * Sqrt( SumOfSquaredDeviationsOfBarNumber ) / (StdErr * > n); > > > > not the one you wrote. > > > > From the HELP FILE (again: read, read, read the help file). > > > > K-Ratio - Detects inconsistency in returns. Should be 1.0 or more. > The higher K ratio is the more consistent return you may expect > > from the system. Linear regression slope of equity line multiplied > by square root of sum of squared deviations of bar number divided > > by standard error of equity line multiplied by square root of > number of bars. More information: Stocks & Commodities V14:3 > > (115-118): Measuring System Performance by Lars N. Kestner > > > > Best regards, > > Tomasz Janeczko > > amibroker.com > > ----- Original Message ----- > > From: "Ron Rowland" <rowland@> > > To: <[email protected]> > > Sent: Friday, July 27, 2007 7:06 PM > > Subject: [amibroker] Re: K-Ratio Implementation (revisited) > > > > > > > Thanks Thomas, but no, I don't believe that post does not answer > my > > > question. The post below explains the the difference between K- > Ratio > > > (1996) and K-Ratio(2003). However, it does not explain the > > > Backtester results. > > > > > > K-Ratio(1996) = LinRegSlope / (StdErr * sqrt(n)) > > > K-Ratio(2003) = LinRegSlope / (StdErr * n) > > > K-Ratio(Ami) = LinRegSlope / StdErr * sqrt(n) / sqrt(12) > > > > > > The sqrt(12) function is typically used to convert a monthly > StdDev > > > (or StdErr) to an annualized one. I do not understand its purpose > > > here. > > > > > > Alternatively, there could be additional errors in mys > undertanding > > > of these functions: > > > > > > LinRegSlope returns the slope for 1 period. Since the slope is > > > linear, it can be annualized by multiplying a daily slope by 252 > > > market days in a year. Multiplying by n will provide total > increase > > > over the entire backtest. > > > > > > StdErr returns the standard error function (the 1-period average > of > > > the entire range). Since it is essentially a 1-period standard > > > deviation, to annualize this value you should multiply by sqrt > (252). > > > > > > It seems to me that LRS / StdErr = K-Ratio for one day. > > > > > > To annualize this, it should be multiplied by 252/ sqrt(252). > > > Of course, any number multiplied by its sqrt = its sqrt, to the > > > annualized version can be simplified to > > > > > > LRS/ StdErr * sqrt(252). > > > > > > If for some reason, you do not want an annualized version that > can be > > > compared for various time frames, you can create the cumulative > > > version by replacing 252 with n (the number of observations). > This > > > suggests that sqrt(252) should be in numerator instead of n being > in > > > the denominator. > > > > > > My thinking and/or assumptions must be off somewhere, but I cannot > > > determine where. > > > > > > > > > > > > --- In [email protected], Thomas Ludwig <Thomas.Ludwig@> > > > wrote: > > >> > > >> TJ once explained that in a posting in this list: > > >> > > >> > Hello, > > >> > > >> > By the way it is NOT surprising that you are getting lower > values > > >> >than before. > > >> > > >> > In his book Mr. Lars Kestner writes: > > >> > > >> > ' The K-ratio is a unitless measure of performance that can be > > >> >compared across markets and time periods. [ - - - ] Traders > should > > >> > search for strategies yielding K-ratios greater than +0.50. > > >> >Together, the Sharpe ratio and K-ratio are the most important > > >> > measures when evaluating trading strategy performance. Note: > When > > >> >I created the K-ratio in 1996, I thought I had created a > > >> > robust measure to evaluate performance. In mid-2000, trader Bob > > >> >Fuchs brought a small error to my attention regarding the > > >> > scaling of the K-ratio. He was correct in his critique and I > have > > >> >corrected the error in this text. Publications prior to 2002 > will > > >> > show a different formula for the K-ratio. The updated formula > in > > >> >this book is correct.' > > >> > > >> > Previous AB versions contained old K-ratio formulation [of > 1996] > > >> >and newest one contains > > >> > new formulation [from Kestners book of 2003]. > > >> > > >> > The difference between those two formulations [i.e. 'trader Bob > > >> >Fuchs brought a small error to my attention regarding the > > >> > scaling of the K-ratio. ' ] > > >> > is just the factor denominator that is now > [NumberOfObservations] > > >> >instead of SQRT[ NumberOfObservation] > > >> > > >> > Since [NumberOfObservations]/SQRT[NumberOfObservations] = SQRT > > >> >[NumberOfObservations] > > >> > it makes it obvious that new K-ratio figures will be SQRT > > >> >[NumberOfObservations] times smaller than previous. > > >> > > >> > The relationship between new and old version can be written as: > > >> > > > >> > KRatio[ NEW2003 ] = KRatio[ OLD1996 ]/SQRT > [NumberOfObservations] > > >> > > >> > You can correspond with Mr. Kestner why 'new' is better > than 'old' > > >> >but do not discuss this with me, because I did not invent it. > > >> > > >> I guess that answers your question. > > >> > > >> Greetings, Thomas > > >> > > >> > I made two posts on this subject a couple of weeks ago, but it > > > seems > > >> > those posts have disappeared. > > >> > > > >> > Anyway. I am now able to duplicate the AmiBroker 4.96 beta CBT > > > results > > >> > for K-Ratio. My implmentation follows and appears to match the > > >> > AmiBroker results for backtest periods lasting from 2 months to > > > 17+ > > >> > years. > > >> > > > >> > Eq = Foreign("~~~EQUITY", "C"); // Assign Close of Backtest > > > Equity = Eq > > >> > n = Barcount -1; // Number of periods > > >> > > > >> > // K-Ratio - only valid for non-compounding systems > > >> > EqLRS = LinRegSlope(Eq, n+1); // Linear Reg Slope of entire > (n+1) > > > range > > >> > EqSE = StdErr(Eq, n+1);// Std Err of entire (n+1) range > > >> > EqKR = EqLRS/EqSE; // K-Ratio (unitless measure) > > >> > EqKRAmi = EqKR*sqrt(n+1)/sqrt(12);// AmiBroker 4.96 > > > implementation > > >> > > > >> > My question is: Why does it require a divide by sqrt(12) to > work? > > >> > > > >> > > > >> > > > >> > > > >> > Please note that this group is for discussion between users > only. > > >> > > > >> > To get support from AmiBroker please send an e-mail directly to > > >> > SUPPORT {at} amibroker.com > > >> > > > >> > For NEW RELEASE ANNOUNCEMENTS and other news always check > DEVLOG: > > >> > http://www.amibroker.com/devlog/ > > >> > > > >> > For other support material please check also: > > >> > http://www.amibroker.com/support.html > > >> > > > >> > Yahoo! Groups Links > > >> > > > >> > > > >> > > > >> > > > > > > > > > > > > > > > Please note that this group is for discussion between users only. > > > > > > To get support from AmiBroker please send an e-mail directly to > > > SUPPORT {at} amibroker.com > > > > > > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: > > > http://www.amibroker.com/devlog/ > > > > > > For other support material please check also: > > > http://www.amibroker.com/support.html > > > > > > Yahoo! Groups Links > > > > > > > > > > > > > > > > > >
