# Resistant Regression

It is a fact that on most days, not much is going on in the stock market. When we estimate the relation of a stock with the market, or the “beta” of a stock, we use all available daily returns. This might not be wise as some days are not really typical and contaminate our estimate. For example, Steve Jobs past away recently, AAPL moved quite a bit as a result. However, this is a distinct event that does not reflect on the relation with the market, but is company specific. Our aim is to exclude such observations, taking into consideration that we don’t want to lose too much information, not all large swings are irrelevant.

these kind of issues fall under the category of Robust Statistics. I already discussed how we can “robustify” our estimate for beta using Robust Regression. I recently read about a different approach bearing the fancy name Resistant Regression. The idea is to chop off the upper and lower 25% and to use only the inter-quartile range for estimation. For the financial markets, this approach produces results that are too robust, we don’t want to kick out so much information. I figure we can apply something in between. The following figure shows what happens when we chop off less than 25% (as in the original function: lqs in the package MASS). Take a look at the following picture, I use returns of AAPL (apple) and of SPY (S&P) for this example:

The more you trim, the lower the “beta”, which means that on quiet days the stock movement is more what we call idiosyncratic, or more independent from the market, relative to the whole sample. When we do not trim at all, the approach boils down to the standard OLS estimate, which is about one for Apple.

As I mentioned before, we don’t want to trim too much, not to lose too much information. Another idea is to kick out just those days, not when the stock moves too sharply, but when only the stock moves too sharply. We can scan the returns to find the days when the stock moved sharply while the market did not (which will indicate an idiosyncratic move). In my analysis I did not care what the market did those days, so I probably omitted observations that should have been  included, specifically where AAPL was swinging but also SPY was swinging, but that is an easy fix to those who wish to implement this idea.

As Always, code and references are below, thanks for reading.

References:

Robust Regression and Outlier Detection

Price: $105.26 (2 customer reviews) 44 used & new available from$82.79

Outliers in Statistical Data

Price: $228.20 (2 customer reviews) 42 used & new available from$139.99

Code:
The function for Resistant Regression takes as default the vectors that I used in the post, but you can change it to any other time series. The last argument is how much you wish to “chop off”.

### 2 comments on “Resistant Regression”

1. Arun says:

There’s a minor error in the code.

Change lines 2 and 3 to the following:

end= format(Sys.Date(),”%Y-%m-%d”)
start=format(as.Date(“2003-09-18″),”%Y-%m-%d”)

Thanks for all the awesome work, just stumbled upon your blog today and it is by far my favourite!

1. Eran says:

Always nice to hear.