# # Epage # # 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(alr3) data(jevons) attach(jevons) # a scatterplot matrix # postscript("../../WriteUp/Graphics/Chapter5/prob_6.eps", onefile=FALSE, horizontal=FALSE) plot( Age, Weight ) dev.off() postscript("../../WriteUp/Graphics/Chapter5/prob_6_SD_vs_age.eps", onefile=FALSE, horizontal=FALSE) plot( Age, SD ) dev.off() # we will fit : # weight_vs_age2 <- lm( Weight ~ Age, weights = 1 / ( n / SD^2 ) ) s <- summary(weight_vs_age2) a <- anova(weight_vs_age2) sigma2 <- s$sigma^2 X2 = a$"Sum Sq"[2] / 1 p_prime = 2