The R Project SVN R

Rev

Rev 61153 | Rev 74265 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 61153 Rev 61168
Line 47... Line 47...
47
## See how close they are (numerically!)
47
## See how close they are (numerically!)
48
sapply(mods, coef)
48
sapply(mods, coef)
49
lapply(mods, function(fm) coef(summary(fm)))
49
lapply(mods, function(fm) coef(summary(fm)))
50
 
50
 
51
## Now, do what you should have done in the first place: PLOTS
51
## Now, do what you should have done in the first place: PLOTS
52
op <- par(mfrow = c(2,2), mar = 0.1+c(4,4,1,1), oma =  c(0,0,2,0))
52
op <- par(mfrow = c(2, 2), mar = 0.1+c(4,4,1,1), oma =  c(0, 0, 2, 0))
53
for(i in 1:4) {
53
for(i in 1:4) {
54
  ff[2:3] <- lapply(paste0(c("y","x"), i), as.name)
54
  ff[2:3] <- lapply(paste0(c("y","x"), i), as.name)
55
  plot(ff, data = anscombe, col = "red", pch = 21, bg = "orange", cex = 1.2,
55
  plot(ff, data = anscombe, col = "red", pch = 21, bg = "orange", cex = 1.2,
56
       xlim = c(3,19), ylim = c(3,13))
56
       xlim = c(3, 19), ylim = c(3, 13))
57
  abline(mods[[i]], col = "blue")
57
  abline(mods[[i]], col = "blue")
58
}
58
}
59
mtext("Anscombe's 4 Regression data sets", outer = TRUE, cex = 1.5)
59
mtext("Anscombe's 4 Regression data sets", outer = TRUE, cex = 1.5)
60
par(op)
60
par(op)
61
}
61
}