# # Written by: # -- # John L. Weatherwax 2009-04-21 # # email: wax@alum.mit.edu # # Please send comments and especially bug reports to the # above email address. # #----- library(DAAG) cities$have = factor( ( cities$REGION == "ON" ) | ( cities$REGION == "WEST" ) ) #postscript("../../WriteUp/Graphics/Chapter6/prob_1_direct_plot.eps", onefile=FALSE, horizontal=FALSE) plot( POP1996 ~ POP1992, data=cities, col=as.integer(cities$have) ) #dev.off() #postscript("../../WriteUp/Graphics/Chapter6/prob_1_log_plot.eps", onefile=FALSE, horizontal=FALSE) plot( log(POP1996) ~ log(POP1992), data=cities, col=as.integer(cities$have) ) #dev.off() # View the summary plots for the two models: # cities.lm1 = lm( POP1996 ~ have + POP1992, data=cities ) oldpar = par(mfrow=c(1,4)) plot( cities.lm1 ) par(oldpar) cities.lm2 = lm( log(POP1996) ~ have + log(POP1992), data=cities ) oldpar = par(mfrow=c(1,4)) plot( cities.lm2 ) par(oldpar)