The answer to one specific question is here:
mean(resid(trees.lm))
You should not delve into model objects such as this and cut out arbitrary components. Doing this on something more complicated, like GLM, will bite off your hand when you realize that you just pulled work leftovers through:
glm.mod.obj$residuals
which are unlikely to be useful to you.
Even for simple things like lm() objects, using resid() or accessing $residuals can be different depending on how the model was installed (what was the setting for the na.action argument, for example?).
In addition, the linear model assumes that iid residues are Gaussian (or normal) random variables with an average value of 0 and a variance of $ \ hat {\ sigma} ^ 2} $, so the average should be very close to 0 (i.e., very, very, very close to 0, but not exactly, because it is a computer and floating point arithmetic).
Gavin simpson
source share