2
$\begingroup$

I know this probably is a very newbie question, but I haven't been able to find anything about it elsewhere.

I'm running some OLS regressions on high frequency data of stocks in order to model some imbalances, all done in R and checked with Excel.

But, in my tests, I'm constantly seeing that the residuals of the regressions yield far better results than the regular dependent variable (Y) would when used in the OPOSITE of the original logic. $$ residue < lower threshold (negative int), then, BUY $$ regular meta code would be: $$ \hat y > upper threshold (positive int), then, BUY $$

I tried this because of a mistake in the beginning of my coding and later found out it was a far better predictor in the out of sample analysis I ran. So I kept up testing and this kept showing up in the results.

The possible explanation I thought about this is that, if the residue is large enough, I should expect that the contrary of it to happen next. Like a mean reversal logic of the error. If the error is large enough, it will probably return to the mean, so I use it as the "- (Y hat)"

Is there some kind of explanation to this, is this some kind of statistical technique that I just don't know? Or I'm am I just delusional and this makes no sense at all, using the residuals as a predictor for my model?

Thank in advance

scatter plot of RESIDUES against Y

EDIT : What is the expected correlation between residual and the dependent variable? talks about this kind of comparison between residuals and Y.. Not much value in it.

I'll post the other scatter plots of residuals against fitted values and Y against fitted values.

$\endgroup$
  • 1
    $\begingroup$ What do you mean by "constantly"? Are they better also when cross-validating..? $\endgroup$ – Tim Aug 15 '16 at 1:59
  • $\begingroup$ @Tim, by "constantly" I mean that this behaviour is appearing very often, more often than not, actually. About the residuals*(-1) being better predictors than the Y itself. $\endgroup$ – Eduardo Gonzatti Aug 15 '16 at 15:14
  • $\begingroup$ Check my answer. How do you assess that they are better? If it's something like MAE or RMSE then what you are doing is you take mean of your prediction and you do not measure any error... $\endgroup$ – Tim Aug 15 '16 at 15:23
  • 1
    $\begingroup$ Could you explain more precisely how you are using the residuals to predict "results"? It sounds like you're running a model, computing residuals, and then running a second model that includes the residuals. That, however, is predicting nothing, because the residuals (together with the other variables) provide full information about the response variable. In short, it sounds like you're trying to predict a variable by using the variable itself--but obviously there would be no use in that. $\endgroup$ – whuber Aug 15 '16 at 15:49
  • 1
    $\begingroup$ It sounds like you are moving in the direction of fitting an autoregressive time series model. If I'm right about that, your model could be improved by capitalizing on the theory and procedures that have been developed rather than inventing your own. $\endgroup$ – whuber Aug 15 '16 at 16:12
1
$\begingroup$

Error measures are based on residuals. If you denote $y$ as predicted variable and $\hat y$ as your estimate for it, then we define residuals as

$$ r = y - \hat y $$

Error measures such as MAE, or RMSE are defined as $1/n \sum |r|$ and $1/n \sum r^2$. If you take $-r$ as your prediction, then what you are doing is you take

$$ y - y - \hat y = -\hat y $$

as your "residuals". So MAE becomes $1/n \sum |-\hat y|$ and RMSE becomes $1/n \sum -\hat y^2$, this applies also to other error measures. This means that you are not measuring error at all.

So by predicting all zeros, you would conclude that they perfectly fit to any data (MAE = RMSE = 0). Small predictions would lead to small "errors" and vice versa. You can easily extrapolate this example to other cases.


If you say that this approach works for you in financial setting then this means that betting on random noise is better then being on predictions from your model. If regression assumptions are met then residuals are random around zero and there is no trend in them. So if this works then either you use regression for data that does not qualify for it, or your model is really poor.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ now i THINK I get it.. $$ r = y - \hat y $$, so $$ -r = -y + \hat y $$ that would give me $$ -y + \hat y = -y +\hat y$$ == $$\hat y = \hat y$$ .. I think I'm even further lost... damn.. when you say " So by predicting all zeros, you would conclude that they perfectly fit to any data " you mean by predicting that the $y$ are zeros ? $\endgroup$ – Eduardo Gonzatti Aug 15 '16 at 15:55
  • $\begingroup$ Yes, that all your predicted values are zeros. $\endgroup$ – Tim Aug 15 '16 at 16:05
  • $\begingroup$ please see the answer I gave to whuber, I had miswritten some details. $\endgroup$ – Eduardo Gonzatti Aug 15 '16 at 16:17
  • $\begingroup$ True.. The residuals are indeed randomly scattered, so that would show that my model is probably really poor in value. But here are the residuals scattered against the dependent variable. i.imgur.com/OJLEK9O.png $\endgroup$ – Eduardo Gonzatti Aug 15 '16 at 16:24
  • $\begingroup$ Updated topic and explanations $\endgroup$ – Eduardo Gonzatti Aug 15 '16 at 17:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.