Estimating a Mean Response at a Chosen Predictor Value
A fitted regression line gives an estimated response for each predictor value. But the line is estimated from a sample, so its value at a chosen predictor value is uncertain. A confidence interval describes that uncertainty when the target is the population mean response at that predictor value.
For example, a researcher might want to estimate the average quiz score among students who study for five hours. That is not the same question as predicting the score of one particular five-hour student. The interval in this tutorial concerns the population average; it does not describe the spread of individual outcomes around that average.
The target \(x_0\) is selected before calculating the interval. Its units are the predictor’s units, while the fitted response and interval endpoints have the response’s units. The estimated mean response is located on the fitted line, but the confidence interval accounts for uncertainty in estimating that line.
Model, Conditions, and Interval Formula
Assume a simple linear regression model for the observed responses:
For the usual exact t-based interval, the errors are independent, normally distributed with mean zero and a common variance \(\sigma^2\), conditional on the predictor values. Thus, the mean response follows a straight line, observations have independent errors, the error variance is constant across predictor values, and the errors are normal. The predictor values may be treated as fixed, or the analysis may be understood conditional on their observed values. The earlier material on checking conditions before slope inference addresses how plots and study design help assess these requirements. An interval should not be trusted if the data provide serious evidence against them.
Define \(S_{xx}=\sum_{i=1}^n(x_i-\bar{x})^2\), where \(\bar{x}\) is the sample mean of the predictor values. Let \(s\) be the residual standard deviation from the fitted regression. Then the standard error of the fitted mean response at \(x_0\) is:
Because the regression estimates both an intercept and a slope, the residual degrees of freedom are \(df=n-2\). Let \(t^*\) be the positive critical value from the t distribution with \(n-2\) degrees of freedom that leaves a tail area of \(\alpha/2\) in each tail. A \(100(1-\alpha)\%\) confidence interval is:
The plus-or-minus expression gives a lower endpoint and an upper endpoint. The confidence level is the long-run coverage of the method: if this procedure were repeated on many samples under the model, about \(100(1-\alpha)\%\) of the resulting intervals would contain the true mean response at \(x_0\).
Why This Standard Error Has This Form
The fitted mean is a combination of the estimated intercept and slope, so its variance depends on the variances of both estimates and on their covariance. Conditional on the predictor values, the standard regression results are:
Apply the variance rule for a linear combination, \(\operatorname{Var}(A+cB)=\operatorname{Var}(A)+c^2\operatorname{Var}(B)+2c\operatorname{Cov}(A,B)\), with \(A=b_0\), \(B=b_1\), and \(c=x_0\):
The residual standard deviation \(s\) estimates \(\sigma\), giving the stated standard error. Under the normal-error model, the standardized difference between \(\hat{y}_0\) and the true mean response has a t distribution when divided by this estimated standard error: the residual sum of squares estimates \(\sigma^2\) using \(n-2\) degrees of freedom. This yields the t critical value and the interval above.
Worked Example: A Mean Quiz Score at Five Study Hours
Suppose a hypothetical sample of \(n=12\) students was used to relate study time \(x\), in hours, to quiz score \(Y\), in points. The fitted line is \(\hat{y}=12+1.5x\), with \(\bar{x}=4\) hours, \(S_{xx}=44\) hours squared, and residual standard deviation \(s=2.4\) points. Assume the design and diagnostic checks are reasonably consistent with a linear mean, independent normal errors, and constant error variance. Find a 95% confidence interval for the population mean score at \(x_0=5.5\) hours.
First calculate the fitted mean response:
The distance from the target predictor value to the sample mean predictor value is \(5.5-4=1.5\) hours. The standard error is:
There are \(12-2=10\) degrees of freedom. For 95% confidence, \(t^*\approx2.228\). The margin of error is \(2.228(0.8801)\approx1.961\) points, so:
We are 95% confident that the population mean quiz score for students who study 5.5 hours is between 18.29 and 22.21 points. This is an estimate of the mean score for that group, not a claim that 95% of individual students’ scores fall in that range.
Worked Example: Using a 90% Confidence Level
In a hypothetical calibration experiment, response \(Y\), measured in instrument units, is modeled linearly against temperature \(x\), measured in degrees. The fitted line is \(\hat{y}=40-0.8x\). Suppose \(n=16\), \(\bar{x}=20\) degrees, \(S_{xx}=500\) degrees squared, and \(s=4\) instrument units. The diagnostic checks are reasonably consistent with the regression assumptions stated above. Calculate a 90% interval for the population mean response at \(x_0=18\) degrees.
The fitted mean response is:
The standard error is:
The degrees of freedom are \(16-2=14\). For a 90% two-sided interval, \(t^*\approx1.761\). Therefore:
We are 90% confident that the population mean instrument response at 18 degrees is between 23.73 and 27.47 instrument units. The confidence level determines the critical value: a different confidence level would give a different margin of error, even with the same fitted model and target value.
Reading and Reporting the Interval
A clear report identifies the response being averaged, the predictor value, the interval, and the units. It also describes the confidence level as a property of the method rather than as a probability assigned to this particular fixed interval. For instance, the first example supports the statement: “The 95% confidence interval for the population mean quiz score at 5.5 hours of study is 18.29 to 22.21 points.”
The interval relies on the fitted linear model being appropriate for the predictor value of interest. In particular, a value far outside the observed predictor range may require extrapolating the line, and the assumed linear relationship may not hold there. A narrow calculated interval does not remove that concern. The interpretation should remain limited to the modeled population and predictor value.
The uncertainty in this interval comes from estimating the population mean response with a sample. Individual responses also vary around that mean. Because the target here is the mean, the interval does not include the full uncertainty associated with the outcome of one future individual. Keep the question being answered explicit: “What is the population mean?” differs from “What response will one individual have?”
Common Mistakes
- Using the fitted value alone. The fitted value is the center of the interval, not a measure of uncertainty. Calculate the standard error and multiply it by the appropriate t critical value.
- Using the wrong degrees of freedom. A simple linear regression estimates two coefficients, so use \(n-2\) degrees of freedom for this interval.
- Describing an individual response. The interval concerns the population mean response at \(x_0\). It does not say where a specified percentage of individual responses lie.
- Giving the wrong confidence interpretation. “There is a 95% probability that the fixed population mean is in this calculated interval” is not the standard frequentist interpretation. The method, across repeated samples, captures the fixed mean in 95% of intervals in the long run.
- Ignoring model conditions or context. The arithmetic does not establish that the model is suitable. Check the regression assumptions and state the predictor value and response units in the conclusion.
Check Your Understanding
Try these questions without looking back.
- In simple linear regression, what population quantity does a confidence interval for the mean response at \(x_0\) estimate?
- A fitted line is \(\hat{y}=7+2x\). What is the fitted mean response at \(x_0=3\)?
- Why does the standard error formula include the term \((x_0-\bar{x})^2/S_{xx}\)?
- A simple regression uses \(n=18\) observations. How many degrees of freedom are used for the t critical value?
- Explain why a confidence interval for the mean response should not be interpreted as an interval containing a specified percentage of individual responses.
- State the repeated-sampling interpretation of a 90% confidence interval for the population mean response at a fixed predictor value.