library(MASS)
attach(hills)

# initial model
model.ls <- lm(time  ~ dist + climb, data=hills)

times <- data.frame(predictedTime = predict(model.ls), actualTime = time)
times$diff <- times$actualTime - times$predictedTime
times

# should be 0
sumDiffs <- sum(times$diff)   # [1] 1.723066e-13


## What test should/could be used to determine 
##  if sumDiffs is "close enough" to 0?


#########################

n <- nrow(times)
df <- n - 3

SSR <- sum(times$diff^2)
SSR

StdErr <- sqrt(SSR / (n - (df+1)))
StdErr

sum()
