confidence and prediction intervals as in all supervised learning settingslinear regression is most useful when we wish to predict how new response variable will behave on the basis of new explanatory vector for exampleit may be difficult to measure the response variablebut by knowing the estimated regression line and the value for xwe will have reasonably good idea what or the expected value of is going to be thusconsider new and let (xbs )with and unknown first we are going to look at the expected value of ythat is ey xb since is unknownwe bwhere do not know ey either howeverwe can estimate it via the estimator > (bs ( )by theorem being linear in the components of by therefore has normal distribution with expectation xb and variance kxxk let ( be the standardized version of and ky xb bk / kh - then the random variable : confidence interval prediction interval xbkxxk ( > /( pky xb bk ( ( hasby corollary tn- distribution after rearranging the identity (| tn- ; - / awhere tn- ; - / is the ( / quantile of the tn- distributionwe arrive at the stochastic confidence interval > +tn- ; - / rse kxxk( where we have identified ky xb bk /( pwith rse this confidence interval quantifies the uncertainty in the learner (regression surfacea prediction interval for new response is different from confidence interval for ey here the idea is to construct an interval such that lies in this interval with certain guaranteed probability note that now we have two sources of variation (xbs itself is random variable estimating xb via brings another source of variation we can construct ( aprediction intervalby finding two random bounds such that the random variable lies between these bounds with probability we can reason as follows firstlynote that (xbs and (xbs kxxk are independent it follows that has normal distribution with expectation and variance ( kxxk ( secondlyletting ( be the standardized version of yand repeating the steps used for the construction of the confidence interval ( )we arrive at the prediction interval ( > +tn- ; - / rse kxxk this prediction interval captures the uncertainty from an as-yet-unobserved response as well as the uncertainty in the parameters of the regression model itself