# # 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. # #----- save_plots = F DF = read.csv( "../../Data/HOT.csv", header=TRUE, stringsAsFactors=FALSE ) rownames(DF) = DF$Name DF$Name = NULL DF$LogAltitude = log(DF$Altitude) if( save_plots ){ postscript("../../WriteUp/Graphics/Chapter6/ex_1_pairs_plot_log_altitude.eps", onefile=FALSE, horizontal=FALSE) } pairs( DF[,c(1:3,5)] ) if( save_plots ){ dev.off() } # Create some linear models: # m1 = lm( MaxJanTemp ~ Latitude + Longitude + Altitude, data=DF ) m2 = lm( MaxJanTemp ~ Latitude + Longitude + LogAltitude, data=DF ) library(car) if( save_plots ){ postscript("../../WriteUp/Graphics/Chapter6/ex_1_dfbeta_plot_altitude.eps", onefile=FALSE, horizontal=FALSE) } #dfbetaPlots(m1, terms=~Altitude, id.method="identify") dfbetaPlots( m1, terms=~Altitude, id.method="y", id.n=6 ) if( save_plots ){ dev.off() } # the argument "identify" in id.method means that you can click on points and get their index number DF[ c( 3, 8, 16, 56, 60 ), ] if( save_plots ){ postscript("../../WriteUp/Graphics/Chapter6/ex_1_dfbeta_plot_log_altitude.eps", onefile=FALSE, horizontal=FALSE) } #dfbetaPlots(m2, terms=~LogAltitude, id.method="identify") dfbetaPlots(m2, terms=~LogAltitude, id.method="y", id.n=3) if( save_plots ){ dev.off() } DF[ c( 3, 16, 56 ), ]