And then, the new value I'd like to predict at is my intercept,

okay, 90 and 2.2.

Okay, 90 for the horsepower and 2.2 for the weight, okay, there we go.

And then, my yhat at that new x value, is going to be, x knot times beta.

But let me get to that in a minute.

My yhat and my observed x values is x beta, okay?

And then, my residuals are going to be y- yhat.

And then, my residual variance is just my average squared residuals

divided by n- p rather than n, okay?

Now, my prediction, my yhat0 at this new value of x,

is just going to be x knot times beta.

And I just did sum,

just to avoid having to type out the matrix multiplication operator.

Okay, so, what's my confidence interval?

It's yhat then + the + or- the 0.975 fifth quantile.

So instead of + or -, I just say, + the 0.25 and 0.975 fifth quantile.

because notice, if you do that, it's going to return the negative and

the positive version, okay?

And times s, then times square root x knot transpose,

x transpose x inverse x knot transpose.

So there it is, you need 24 to 27.2, 24.26.

So if we go up to our confidence interval, it's 24 to 27.2.

Okay, so it's the same thing.

Now, let's do our prediction interval.

It's the same thing, only now, there's this 1+ right here, okay?

So let's do that again.

And we get 20.356, 31.31.

Okay, so 20.356, 31.31.

Okay, so that's what's going on under the scenes.

It's pretty straightforward logic on how it's doing this.

And just take into account if you want to estimate

the prediction surface at a particular point, you want a confidence interval.

And if you want to evaluate the prediction surface plus the natural variability

that exists around that prediction surface.

Make sure you do a prediction interval rather than a confidence interval.

And it's all pretty easy with the predict function, okay.

You should only do these kind of calculations just as part of something

like this class.

Where you're just verifying that you understand how it works.

And then, from then on you would use the more natural function to do this.