Why Uncertainty Depends on Where You Measure the Slope
A quadratic regression curve does not have one slope: its slope changes with the predictor value. A fitted curve may rise at one value, flatten near a turning point, and fall at another. Consequently, an uncertainty statement about its slope must name the predictor value. The uncertainty in the estimated slope also depends on how precisely both polynomial coefficients have been estimated and on how those estimates vary together.
A related question concerns the estimated turning point, or vertex. The vertex is calculated from a ratio of two fitted coefficients. Uncertainty in either coefficient can therefore affect its estimated location, sometimes substantially. This tutorial develops confidence intervals for slopes and a first-order approximation for uncertainty in the vertex.
Model and Assumptions
For observations \((x_i,Y_i)\), consider the quadratic regression model
Here \(\beta_0,\beta_1,\beta_2\) are unknown coefficients, and \(\varepsilon_i\) is the error for observation \(i\). For the exact confidence interval for a slope developed below, assume the predictor values are fixed (or condition on their observed values), the quadratic mean model is appropriate, the errors are independent with mean zero and common variance \(\sigma^2\), and the errors are normally distributed. The three columns \(1,x,x^2\) must provide enough independent information to estimate all three coefficients. In practice, residual plots and knowledge of how the data were collected help assess whether these assumptions are reasonable.
Write the fitted coefficients as \(b_0,b_1,b_2\). The residual mean square is \(s^2\), and \(s\) estimates the error standard deviation. The coefficient estimates have estimated variances and covariances; these are often reported in a covariance matrix. The covariance matters because the estimates of \(b_1\) and \(b_2\) generally are not independent.
Uncertainty in the Slope at a Chosen Value
The fitted slope at \(x_0\) is a linear combination of coefficient estimates. Its estimated variance includes the variance of each coefficient and their covariance:
The standard error, denoted \(SE\), is the square root of this estimated variance. Omitting the covariance term is not generally justified: depending on its sign and size, it can increase or reduce the uncertainty in the slope.
The degrees of freedom are \(n-3\) because three regression coefficients are estimated. This interval describes uncertainty in the slope of the fitted mean curve; it is not an interval for an individual response, and it does not include the extra variation of a new observation around the mean.
Worked Example: A Slope Interval at a Chosen Predictor Value
Suppose a hypothetical analysis relates weekly energy use \(Y\), in kilowatt-hours, to outdoor temperature \(x\), in degrees Celsius. A quadratic fit uses \(n=20\) days and gives \(b_1=2.00\) and \(b_2=-0.400\). At \(x_0=3\), the estimated coefficient variances and covariance are \(\widehat{\operatorname{Var}}(b_1)=0.250\), \(\widehat{\operatorname{Var}}(b_2)=0.0100\), and \(\widehat{\operatorname{Cov}}(b_1,b_2)=-0.0300\). Assume the quadratic form is suitable over the measured temperature range, the design has full rank, and residual checks show no serious departure from independence, constant variance, or normality.
The estimated slope at \(3^\circ\)C is
Its estimated variance and standard error are
For a 95% interval, \(df=20-3=17\), and \(t_{0.975,17}\approx2.110\). Thus,
The data and model give a 95% confidence interval of approximately \(-1.455\) to \(0.655\) kilowatt-hours per degree Celsius for the mean-curve slope at \(3^\circ\)C. The interval includes zero, so the estimated slope at that value is not precise enough to establish its direction at this confidence level. This is an interval statement, not a claim that there is a 95% probability that the fixed slope lies in this particular interval.
Why the Covariance Term Appears
The variance formula follows from the standard variance rule for a linear combination. If \(A\) and \(B\) are estimates and \(c\) is a constant, then
Set \(A=b_1\), \(B=b_2\), and \(c=2x_0\). Substitution gives
Replacing the unknown variances and covariance by their estimates gives the standard error used in the interval. This calculation also shows why the uncertainty can differ across the predictor range: both the multiplier of \(b_2\) and the covariance contribution change with \(x_0\).
Uncertainty in the Estimated Vertex
When \(b_2\ne0\), the fitted quadratic has a vertex at
This estimate is a nonlinear function of \(b_1\) and \(b_2\). Its uncertainty can be approximated using the delta method: for a smooth function of estimated coefficients, approximate its variance by multiplying the coefficient covariance matrix on both sides by the gradient of that function, evaluated at the estimates. For \(g(b_1,b_2)=-b_1/(2b_2)\), the gradient is
Using the estimated variances and covariance gives the first-order approximation
The square root of this approximate variance is the estimated standard error of the vertex location. A simple approximate 95% interval is \(\hat{x}_v\mathbin{\pm}1.96SE\). Unlike the slope interval under the normal-error model, this is a first-order approximation, not an exact \(t\) interval. It works best when the denominator \(b_2\) is not close to zero and its uncertainty is not so large that the ratio becomes highly unstable.
Worked Example: An Approximate Interval for the Vertex
Use the hypothetical coefficient estimates and covariance values from the energy-use example. The fitted vertex is
The two gradient components, evaluated at the estimates, are
Substituting the coefficient uncertainty into the delta-method formula gives
Therefore, \(SE\approx\sqrt{0.312500}=0.5590^\circ\)C. The approximate 95% interval is
Under the first-order approximation, the estimated turning point is \(2.50^\circ\)C, with an approximate 95% interval from \(1.404^\circ\)C to \(3.596^\circ\)C. This interval concerns the predictor location of the vertex, not the response value at the vertex. Its reliability depends on the approximation and on the curvature coefficient being sufficiently well determined.
Centering and a Slope at a Practical Value
A centered predictor can make it easier to calculate a slope at a value of practical interest. If \(z=x-c\), the fitted quadratic can be written \(b_0^*+b_1^*z+b_2^*z^2\). At original predictor value \(x_0\), its slope is \(b_1^*+2b_2^*(x_0-c)\). The same variance rule applies, using the variances and covariance of the centered-model coefficients. The slope and its uncertainty do not depend on whether the predictor was centered, provided the model represents the same fitted curve.
Worked Example: A Slope from a Centered Quadratic
Suppose a hypothetical study models a response \(Y\), in milligrams per litre, using \(z=x-10\), where \(x\) is time in hours. The fitted centered model has \(b_1^*=1.50\) and \(b_2^*=-0.250\). At \(x_0=12\), \(z_0=2\). Assume \(n=30\), \(\widehat{\operatorname{Var}}(b_1^*)=0.160\), \(\widehat{\operatorname{Var}}(b_2^*)=0.00640\), and \(\widehat{\operatorname{Cov}}(b_1^*,b_2^*)=-0.0128\). Assume the mean curve and error conditions described earlier are reasonable over the observed time range, which includes 12 hours.
The slope estimate is
Its variance and standard error are
Here \(df=30-3=27\), and \(t_{0.975,27}\approx2.052\). The interval is
The 95% confidence interval for the mean-curve slope at 12 hours is approximately \(-0.321\) to \(1.321\) milligrams per litre per hour. Centering changes how the calculation is expressed, not what slope is being estimated.
When a Vertex Estimate Is Unstable
The vertex formula divides by \(b_2\). If the fitted curvature coefficient is small, even modest coefficient uncertainty can produce a large change in \(-b_1/(2b_2)\). In that situation the delta-method approximation may poorly describe the uncertainty: the ratio can be strongly skewed, and a symmetric interval may be misleading. A calculated vertex can also fall outside the observed predictor range, where the fitted shape is less supported by data.
A slope interval at a specified \(x_0\) and a vertex interval answer different questions. The slope interval uses a linear combination of coefficient estimates and, under the stated assumptions, has an exact \(t\) form. The vertex interval uses a nonlinear ratio and is only approximate by the delta method. Neither interval by itself establishes that a quadratic model is preferable to a simpler model.
Common Mistakes
- Dropping the covariance. Treating \(b_1\) and \(b_2\) as independent removes the \(4x_0\widehat{\operatorname{Cov}}(b_1,b_2)\) term without justification. Use the coefficient covariance reported for the fit.
- Using only the standard error of \(b_1\). The slope at \(x_0\) is \(b_1+2x_0b_2\), not \(b_1\) alone. Include uncertainty in both coefficients.
- Calling the vertex interval exact. The vertex is a ratio, so the delta-method interval is approximate. Be especially cautious when \(b_2\) is close to zero.
- Ignoring units or the chosen value. State the predictor value and report slope uncertainty in response units per predictor unit. Report vertex uncertainty in predictor units.
- Confusing mean-curve uncertainty with response variation. A confidence interval for a slope describes the mean curve’s slope, not the range of individual outcomes around the curve.
Check Your Understanding
Try these questions without looking back.
- For the fitted quadratic slope \(b_1+2x_0b_2\), write its estimated variance and identify the term that accounts for coefficient dependence.
- Why does the exact slope interval use \(n-3\) degrees of freedom?
- What does a confidence interval for the slope at \(x_0\) describe, and what does it not describe?
- Why can a small magnitude of \(b_2\) make the estimated vertex unstable?
- For a centered predictor \(z=x-c\), write the fitted slope at original predictor value \(x_0\).