Showing posts with label errors. Show all posts
Showing posts with label errors. Show all posts

Monday, June 4, 2012

Diagnostic Plot no1: Random Example: non constant variances

diagnostic plot 1: non constant variance

  • example how a the diagnostic plot no 1 looks if the error variance is not constant (strong non-constant variance)
par(mfrow=c(3,3)) ## 9 plots on one page
x <- runif(100,0,20)
for(i in 1:9){
  y <- x + x * rnorm(100)
  m <- lm(y ~ x)
  plot(m,which=1)
}

Diagnost Plot No. One, Random Examples

diagnostic plot no1: normal distributed errors

  • example how a the diagnostic plot 1 (residuals vs. fitted) should look like: 9 random number examples
par(mfrow=c(3,3),mar=c(3,2,2,1)) ## 9 plots on one page
x <- runif(100,0,20)
for(i in 1:9){
  y <- x + rnorm(100)
  m <- lm(y ~ x)
  plot(m,which=1)
}