# R-program for Supplementary Exercise 10.17 of IPS7e phys <- read.csv("r:/Chapter 10/ex10_017.csv") # scatterplot with fitted line plot(phys$HR, phys$VO2) abline( lsfit(phys$HR, phys$VO2)) # simple linear regression phys.reg <- lm(VO2 ~ HR, data=phys) summary(phys.reg) anova(phys.reg) # prediction new <- data.frame( HR=c(96,115)) phys.pred <- predict(phys.reg, new, interval="prediction"); phys.pred phys.ci <- predict(phys.reg, new, interval="confidence"); phys.ci