error term in linear regression

#1
Let's say I have a simple model like this:

yi ~ beta1*xi + errori

> dat <- data.frame(y=c(10,20,30,40),x=c(1,2,5,8))
> m <- lm(y~x,data=dat)

summary(m) gives me this information

Residuals:
1 2 3 4
-3 3 1 -1

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 9.0000 2.7988 3.216 0.0846 .
x 4.0000 0.5774 6.928 0.0202 *

If I plug in the values above to calculate y1
y1 = 9 + 4*1 - 3
y1 = 10

however, the predict function gives me a different value for y1:
> predict(m)
1 2 3 4
13 17 29 41

why do we ignore errori when predicting y values in regression?
 

obh

Active Member
#2
Hi S20,

The residual is what the model can't predict, that's why it called residual...(I will not talk about the difference between residual and error)

In your example, the model is Y=9+4X
When x=1, predict Y=9+4*1=13, Y= 9+4*1+ (-3)