RAR%

Discussions about the testing and simulation of mechanical trading systems using historical data and other methods. Trading Blox Customers should post Trading Blox specific questions in the Customer Support forum.
Post Reply
LeviF
Roundtable Knight
Roundtable Knight
Posts: 1436
Joined: Mon Dec 22, 2003 12:24 pm
Location: Des Moines, IA
Contact:

RAR%

Post by LeviF »

Since RAR% is the slope of the linear regression through an equity curve (typically an exponential curve), wouldn't using it as a measure of "goodness" unfairly weight good performance towards the end of the test period?
LeviF
Roundtable Knight
Roundtable Knight
Posts: 1436
Joined: Mon Dec 22, 2003 12:24 pm
Location: Des Moines, IA
Contact:

Post by LeviF »

Upon further investigation, it appears RAR is not the slope of the linear regression of y...
sluggo
Roundtable Knight
Roundtable Knight
Posts: 2987
Joined: Fri Jun 11, 2004 2:50 pm

Post by sluggo »

User damian asked the same question in 2005, about the coefficient of determination of a linear regression on the equity curve, namely, R squared.

The answer is disappointingly straightforward: viewtopic.php?p=16155&highlight=exponential#16155
LeviF
Roundtable Knight
Roundtable Knight
Posts: 1436
Joined: Mon Dec 22, 2003 12:24 pm
Location: Des Moines, IA
Contact:

Post by LeviF »

I have been messing with this in excel for a couple hours...

The equity curve of $1 compounded annually at 25% for 20 years has an equation of y = e^0.2231x.

What is the relationship between the exponent and the 25%?
sluggo
Roundtable Knight
Roundtable Knight
Posts: 2987
Joined: Fri Jun 11, 2004 2:50 pm

Post by sluggo »

A simpler problem:
  • $1 compounded at 100%/year, for 4 years, grows to 16.00000 dollars.

    Excel's fitted trendline is y = e^(0.69314718 x)

    What is the relationship between "0.69314718" and "100% CAGR" ?
LeviF
Roundtable Knight
Roundtable Knight
Posts: 1436
Joined: Mon Dec 22, 2003 12:24 pm
Location: Des Moines, IA
Contact:

Post by LeviF »

ln(1 + i)
sunyata
Roundtable Fellow
Roundtable Fellow
Posts: 94
Joined: Sat Jun 06, 2009 4:27 pm
Location: Charlottesville, VA

Post by sunyata »

Hi everyone,

As a compromise, in my calculation of RAR% I use the portfolio's starting equity as the start date value and the regressed end date equity value as the end date value. I did this because I found that the regressed start date value can be negative if the equity curve's slope is steep enough and therefore, I could not compute CAGR and/or ICAGR. However, according the image Faith provides in Way of the Turtle, it is technically correct to use the regressed start date value rather than the starting equity for the start date value in the RAR% calculation.

Also, does anyone happen to know which measure of compounded growth, CAGR or ICAGR (or any other), is used to compute RAR%?

Thanks! :)
AFJ Garner
Roundtable Knight
Roundtable Knight
Posts: 2071
Joined: Fri Apr 25, 2003 3:33 pm
Location: London
Contact:

Post by AFJ Garner »

I have often contemplated the void and was doing so only an hour ago when I drifted off in the middle of the Magnificat. I find the concept of an infinitely fertile emptiness much easier to swallow than that of an anthropomorphic creator. Much as I enjoy my native Anglo Catholicism and the rich liturgy of the Western Christian Church, in terms of metaphysics, if there are any answers at all (or even questions to be asked) I prefer the doctrines of our Eastern brethren.

Interestingly of course East and West meet in unison in the likes of Meister Eckhart on the one hand and the Eastern contemplatives on the other.

If I were Sunyata, I don’t think I would concern myself with RAR%. As it is however, like most of the rest of us, I have to keep the home fires burning.
sunyata
Roundtable Fellow
Roundtable Fellow
Posts: 94
Joined: Sat Jun 06, 2009 4:27 pm
Location: Charlottesville, VA

Post by sunyata »

AFJ Garner wrote:I have often contemplated the void and was doing so only an hour ago when I drifted off in the middle of the Magnificat. I find the concept of an infinitely fertile emptiness much easier to swallow than that of an anthropomorphic creator. Much as I enjoy my native Anglo Catholicism and the rich liturgy of the Western Christian Church, in terms of metaphysics, if there are any answers at all (or even questions to be asked) I prefer the doctrines of our Eastern brethren.

Interestingly of course East and West meet in unison in the likes of Meister Eckhart on the one hand and the Eastern contemplatives on the other.

If I were Sunyata, I don’t think I would concern myself with RAR%. As it is however, like most of the rest of us, I have to keep the home fires burning.
When winter returns, I will need to light the coal stove as well. ;)

Which is why I concern myself with RAR%.
sluggo
Roundtable Knight
Roundtable Knight
Posts: 2987
Joined: Fri Jun 11, 2004 2:50 pm

Post by sluggo »

sunyata wrote:I found that the regressed start date value can be negative if the equity curve's slope is steep enough
Could you provide an example of this (ideally, with a plot or graph of some kind)?

I'm surprised and here's why. If the regression line equity on the ending date is a positive number "E", and if the regression line (on semilog axes of course) has a positive slope "S percent per year", then
  • The regression equity on the end date is E dollars
  • The regression equity one year before the end date is (E/(1+S)) dollars
  • The regression equity two years before the end date is (E/(1+S)^2) dollars
  • The regression equity three years before the end date is (E/(1+S)^3) dollars
  • The regression equity four years before the end date is (E/(1+S)^4) dollars
  • And in the general case, the regression equity "N" years before the end date is (E/(1+S)^N)
No matter what value of "N" you use, the regression equity is positive. Even the value of "N" that corresponds to the start date. If the slope is positive and the regression line equity is positive on the end date, then every point on the regression line equity curve is also positive. So I am confused. Could you provide an example?
Asamat
Roundtable Knight
Roundtable Knight
Posts: 175
Joined: Fri Jun 03, 2005 7:50 am
Location: Walldorf, Germany

Post by Asamat »

I can picture an equity curve for which a regression fit gives a negative start value. Imagine your trading started flat for a few years, and then your system took off and you get a killer curve for the next 50 years.

If you fit that the begin of the fit will be in negative territory, wouldn't it?
sluggo
Roundtable Knight
Roundtable Knight
Posts: 2987
Joined: Fri Jun 11, 2004 2:50 pm

Post by sluggo »

Asamat wrote:I can picture an equity curve for which a regression fit gives a negative start value.
Please show a graph of an example, including the calculated "RAR%" (linear regression slope); ideally, a Blox output.
sunyata
Roundtable Fellow
Roundtable Fellow
Posts: 94
Joined: Sat Jun 06, 2009 4:27 pm
Location: Charlottesville, VA

Post by sunyata »

Hi,

I've attached an example, the one actually that has caused me trouble. The details are:

System: EXPONENTIAL MA CROSSOVER
Side: BOTH
Markets: GOLD, S&P 500
Test Dates: 1975 - 2005
Heat: 10% portfolio risked each trade
Starting Equity: $1M
RAR% = .131 (Calculated using starting equity & regressed end date value)

Upon rereading Sluggo's initial post, I realize that I am using a Linear scale and not a Log scale. If I change the Y-axis to log scale, then the starting regressed equity is, in fact, positive. I will attach that graph as well. However, two things are intriguing about the log scale. First, visually it is not linear (which makes sense) and therefore, does not coincide with the very limited example provided in Way of the Turtle. Secondly, despite using the log scale, the underlying regression equation (y = mx + b) remains unchanged so that there is still a negative y-intercept (b). At least, this is according to Excel and since I am not too knowledgeable of the subtleties of this subject, I do not know whether to trust Excel or not.

Would appreciate your insights!
Attachments
Linear regression example
Linear regression example
Linear regression example.jpg (47.38 KiB) Viewed 10260 times
Linear regression Log Scale.jpg
Linear regression Log Scale.jpg (45.92 KiB) Viewed 10260 times
sluggo
Roundtable Knight
Roundtable Knight
Posts: 2987
Joined: Fri Jun 11, 2004 2:50 pm

Post by sluggo »

sunyata wrote:I realize that I am using a Linear scale and not a Log scale.
Good, you are one-third of the way to enlightenment; there are two more conceptual leaps to be made
  • You need to ask and answer the question "What function plots as a straight line on semilog axes?". Once you know this answer, you will realize - Eureka! - this is one of the functions that Excel will fit for you, as a regression trendline.
  • You need to figure out the transformation from native Excel scale, to "Percent Per Year" scale (which traders prefer for RAR). Brother levijean struggled with, and eventually solved, this exact problem, a few posts ago in this very discussion.
sunyata
Roundtable Fellow
Roundtable Fellow
Posts: 94
Joined: Sat Jun 06, 2009 4:27 pm
Location: Charlottesville, VA

Post by sunyata »

sluggo wrote:Good, you are one-third of the way to enlightenment; there are two more conceptual leaps to be made
  • You need to ask and answer the question "What function plots as a straight line on semilog axes?". Once you know this answer, you will realize - Eureka! - this is one of the functions that Excel will fit for you, as a regression trendline.
  • You need to figure out the transformation from native Excel scale, to "Percent Per Year" scale (which traders prefer for RAR). Brother levijean struggled with, and eventually solved, this exact problem, a few posts ago in this very discussion.
Hey sluggo,

Thanks for your help. Attached is the same equity curve on a semi-log scale with an exponential regression curve. The associated exponent is .00056. In trying to solve for the compounded annual return using ln(i + 1) however, I get .00056, that is, the same as the exponent simply because the sum 1 + .00056 lies so closely to 1. Seems I am still doing something incorrect via that avenue.

However, I can simply use the equation Excel provides to determine the end date value for the regression curve. I then plug that value into the CAGR equation and yield .1518. This is much closer to the normal CAGR for the equity curve.
Attachments
Exponential regression on log scale.jpg
Exponential regression on log scale.jpg (55.02 KiB) Viewed 10199 times
sluggo
Roundtable Knight
Roundtable Knight
Posts: 2987
Joined: Fri Jun 11, 2004 2:50 pm

Post by sluggo »

Yes you are using daily equity data, whereas Brother levijean was horsing around with some examples using annual equity data. In effect you have calculated "RDR" - the Robust Daily Return - which is the linear regression slope of the equity curve plotted on semilog axes - expressed in percent per day.

Now you need to figure out how to incorporate the fact that there are an average of 365.25 days per year (over a thirty year backtest which will include some leap-years), in order to calculate "RAR" - the Robust Annual Return.

Eyeballing your plot there, it appears the thin black line increased about 70X to 75X in approx 30 years, for a Robust Annual Return of approx 15.2 to 15.5 percent per year. (Doublecheck: 1.152^30 = 69.8x). So I suspect you will ultimately wind up with the result that your RAR is somewhere between 15% and 16% per year. There is a way to make Excel print its fitted equation with lots more digits of precision; maybe that would help you out.

AND, as if by magic, the left hand endpoint of the regression line -- the regressed Start Equity -- is not negative.
sunyata
Roundtable Fellow
Roundtable Fellow
Posts: 94
Joined: Sat Jun 06, 2009 4:27 pm
Location: Charlottesville, VA

Calculating RAR% using the exponential regression equation

Post by sunyata »

sluggo wrote: Now you need to figure out how to incorporate the fact that there are an average of 365.25 days per year (over a thirty year backtest which will include some leap-years), in order to calculate "RAR" - the Robust Annual Return.
First, you start with the coefficient of the exponent in the derived exponential regression equation, which for the example is

y = 1091970.513 * e^(0.000555451x)

The coefficient in question is .00055545. This is the "RDR" that sluggo speaks of. The first step in annualizing this number is to multiply it by the ratio

(# trading days in backtest / total # of days in timespan of backtest)

This allows for compounding on days when there is no trading. There were 7751 trading days in 30.7 years or roughly 11,213.175 days. So,

(7751 / 11213.175) * .00055545 = .00038395

So, on each day, including non-trading days, the system returned a steady .00038395 or .038%. This is overly hyphenated non-trading-day-adjusted regressed daily return.

But what would you return in a year at this daily rate? The equation to use is:

(1 + x)^365.25 - 1

which, upon plugging in .00038395 in for x, you get .15053 or 15.053%, the fabled RAR%.

I did a study in Excel starting with $1 and compounding .00038395 for 366 days, which returned .1504, likely a rounding anomaly.
sluggo
Roundtable Knight
Roundtable Knight
Posts: 2987
Joined: Fri Jun 11, 2004 2:50 pm

Post by sluggo »

Good. Beware that there are two ways to run the regression; some people will make choice (1) and others will make choice (2):
  • (1) using the actual (Julian) dates as the X-values for the regression fitted line;
    (2) using the integers 1 thru N as the X-values for the regression fitted line, where N is the number of trading days {N=7751}.
Choice (1) does not require a #-of-trading-days to #-of-calendar-days correction; choice (2) does. You appear to have made choice (2) and properly applied the correction.
Post Reply