Your predict.lmpredict.lm
code is calculating confidence intervalintervals for the fitted valuevalues. Your hand calculation is calculating prediction intervalintervals for new data. If Youyou want to haveget the same result from predict.lmpredict.lm
that Youyou got from the hand calculation then change interval="confidence" interval="confidence"
to interval="prediction" interval="prediction"