I have residuals for my model. They are simply measured-predicted. However, I notice that they do not follow a normal distribution. I want to make my residuals distribution normal so that I can obtain confidence intervals that are representative of the distribution. I have tried doing the following:

 Error: $ operator is invalid for atomic vectors

However, I get an error. After looking at the Box-Cox more closely I have to input a formula or fitted object. If I input the measured vs. predicted fit, will the Box-Cox transformation normalize the residuals? Is there another way to implement the Box-Cox transformation so that it only needs to look at the distribution of the data?

  • 1
    $\begingroup$ Re the error: typing residuals at a new command prompt will show you this refers to a function in R. It would be wise not to use it to name anything else (unless you wish to override the default implementation). $\endgroup$ – whuber Aug 13 '13 at 18:04
  • 2
    $\begingroup$ You don't transform residuals, but the variables (in this case, the response) - and the help on boxcox clearly says that what you need to pass to boxcox is a model, either as a fitted model object or a formula. But before you do that, tell us about what your variables are (especially what is your response measuring?), and what the problems are in your model diagnostics (what makes you say it's non-normal? what does it look like?). $\endgroup$ – Glen_b Aug 13 '13 at 20:51

I suggest that your focus is misplaced.

  • If normality of residuals is really important, you need to go back and fix the model so that you get approximately normal residuals. Tidying up (here transforming) the residuals from the wrong model won't make them right.

  • Conversely, if you are convinced that the model is right, or at least the model you have is the one that should be taken forward, then the residuals should still be taken seriously, meaning "as is", if you want a bridge back to the data.

  • As it is, depending on what your model is, you should be able with modern software to get confidence intervals [for what, by the way?] in some direct manner.

  • Also, normality of error terms is not that crucial even for classical linear regression.

I don't know how to answer the question on R syntax, but my stance is that the idea is misdirected.

Quite apart from all that, typically residuals are both positive and negative. Fitting them into Box-Cox will be a stretch.

| cite | improve this answer | |
  • 1
    $\begingroup$ Good advice. I just want to suggest that some of it is context-dependent; for instance, non-normality of residuals can have critical effects on prediction limits. Thus there can be merit in achieving residual distributions that are not wildly skewed, at least. $\endgroup$ – whuber Aug 13 '13 at 18:06
  • $\begingroup$ Thanks for that point. Normality of residuals is indeed not a problem, while severe non-normality may be. $\endgroup$ – Nick Cox Aug 13 '13 at 18:08
  • $\begingroup$ Unfortunately the model is something that I cannot change - so it is what it is. A 95% confidence interval from my understanding would by 1.96*standard deviation - using this wouldn't be entirely descriptive of the data. Thank you for the comment on positive/negative residuals, I didn't know Box-Cox had difficulty with that $\endgroup$ – GK89 Aug 13 '13 at 20:56
  • 1
    $\begingroup$ I don't know any confidence interval procedure defined that way; I think you are confusing standard deviations and standard errors. But if the residuals are not symmetric, it is likely that confidence intervals should not be either. See an extra bullet point just added to my answer. (Hint on last point: How do take logarithms or square roots of negative residuals?) $\endgroup$ – Nick Cox Aug 13 '13 at 21:03

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.