0
$\begingroup$

Possible Duplicate:
Kruskal-Wallis or Fligner test to check homogeneity of variances?

Is there a test to check if the residuls of a linear regression are constant?

Thanks

$\endgroup$
4
  • 1
    $\begingroup$ Do you mean how to check if the residuals of a linear regression have a constant variance? The residuals from a regression will of course per definition be random... $\endgroup$
    – Dr. Mike
    Sep 23, 2011 at 15:30
  • $\begingroup$ The residuals can't be constant. The math of a linear regression is such that some must be positive and some negative. Perhaps you mean something else. $\endgroup$
    – John
    Sep 23, 2011 at 15:31
  • $\begingroup$ To learn about tests for constant variance, you can look up the terms homo- and hetero-skedasticity on this site. Maybe you had in mind a constant mean. As in, residuals should not be generally high for some values of predicted Y but generally low for others. You could test this by dividing your predicted Y into discrete groups and running an anova using the residuals as the dependent variable. $\endgroup$
    – rolando2
    Sep 23, 2011 at 16:07
  • $\begingroup$ Closing, because this question is either empty (interpreted as written) or it covers previous ground. $\endgroup$
    – whuber
    Sep 23, 2011 at 16:18

1 Answer 1

1
$\begingroup$

I'm going to assume you mean a test for constant variance for the residuals. The following R code illustrates the test.

library(lmtest)
# Create data set
y<-sin(1:100)
x<-y+rnorm(100, 0.2, 0.2)
# Build model
lmfit<-lm(y~x)
# Perform the Breusch-Pagan test against heteroskedasticity
res<-bptest(lmfit)

If the p-value returned from the bptest is > 0.2 you cannot reject the null hypothesis of constant variance.

$\endgroup$

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