# Confidence Interval Calculator for a Regression Prediction

Instructions: Use this confidence interval calculator for the mean response of a regression prediction. Please input the data for the independent variable $$(X)$$ and the dependent variable ($$Y$$), the confidence level and the X-value for the prediction, in the form below: Independent variable $$X$$ sample data (comma or space separated) = Dependent variable $$Y$$ sample data (comma or space separated) = Confidence Level (Ex: 0.95, 95, 99, 99%) = X value for prediction $$X_0$$ = Independent variable Name (optional) = Dependent variable Name (optional) =

#### Confidence Interval for the Mean Response

The Confidence Interval for the Mean Response corresponds to the calculated confidence interval for the mean predicted response $$\mu_{Y|X_0}$$ for a given value $$X = X_0$$. First, we need to know the mean squared error:

$\hat{\sigma}^2 = \displaystyle \frac{SSE}{n-2}$

Then, the $$1-\alpha)\times 100$$% confidence interval for the mean response $$\mu_{Y|X_0}$$ is

$CI = \displaystyle \left( \hat\mu_{Y|X_0} - t_{\alpha/2; n-2} \sqrt{ \hat{\sigma}^2 \left(\frac{1}{n} + \frac{\left(X_0 - \bar X\right)^2}{SS_{XX}}\right) }, \hat\mu_{Y|X_0} + t_{\alpha/2; n-2} \sqrt{ \hat{\sigma}^2 \left(\frac{1}{n} + \frac{\left(X_0 - \bar X\right)^2}{SS_{XX}}\right) } \right)$

If you are interested rather in a confidence interval for the prediction itself, please use instead this prediction interval calculator for regression predictions .