Why Model Curvature?
Electricity demand may change with temperature in more than one direction. On cold days, demand can rise as heating systems are used; on hot days, it can rise again as air conditioning runs. Between those conditions, demand may be lower. A straight-line model can describe a steady increase or decrease, but cannot describe a curve that changes direction. A quadratic regression gives a simple way to represent that kind of curvature.
A quadratic is not automatically the right model just because a curved pattern seems plausible. Its shape should be compared with the observed data, and residual plots should be checked for structure left behind by the fitted curve. Even a curve that fits the observed pattern well describes an association, not necessarily a causal effect of temperature: other factors, such as day of week or season, may also relate to demand.
The Quadratic Temperature Model
Let \(T_i\) be the temperature in degrees Celsius and \(Y_i\) the electricity demand in megawatts (MW) for observation \(i\). To keep the coefficients interpretable and the arithmetic manageable, choose a reference temperature \(c\) and define centered temperature \(z_i=T_i-c\). The quadratic regression model is
Here, \(\beta_0\), \(\beta_1\), and \(\beta_2\) are model coefficients, and \(\varepsilon_i\) is the error for observation \(i\). The model states that the conditional mean demand at temperature \(T_i\) is \(\beta_0+\beta_1z_i+\beta_2z_i^2\). The fitted regression replaces the unknown coefficients with estimates \(b_0\), \(b_1\), and \(b_2\); its predicted demand is \(\hat{Y}_i=b_0+b_1z_i+b_2z_i^2\).
For regression-based inference, a standard model assumes the errors have mean zero conditional on the temperatures, are independent, and have constant variance. Normal errors are additionally assumed for exact small-sample \(t\)-based inference. These are assumptions about errors around the conditional mean, not claims that temperatures or demands themselves must be normally distributed. In an applied analysis, the adequacy of the mean curve and the error behavior should be assessed using the data and diagnostic plots.
Reading the Curve and Its Turning Point
The fitted mean curve, written as a function of temperature, is
The slope changes with temperature. Differentiating the fitted curve with respect to \(T\) gives
This slope is measured in MW per degree Celsius. A turning point occurs where the slope is zero, if that temperature is relevant to the data. When \(b_2\ne 0\), its temperature is \(T=c-b_1/(2b_2)\). A positive \(b_2\) gives a minimum; a negative \(b_2\) gives a maximum. This point is a feature of the fitted quadratic, not automatically a well-supported feature of demand in the real world. It deserves substantive interpretation only if it falls within, or near, the observed temperature range and the data support the curve there.
Worked Example: Finding the Minimum-Demand Temperature
Suppose a hypothetical dataset covers days with temperatures from 5°C to 35°C. A least-squares fit, using \(c=18\)°C, gives \(\hat{Y}(T)=520-8.0(T-18)+0.40(T-18)^2\), with demand measured in MW. Find and interpret the turning point.
Here \(b_0=520\), \(b_1=-8.0\), and \(b_2=0.40\). Since \(b_2>0\), the fitted curve opens upward, so its turning point is a minimum. Set its slope to zero:
Thus \(0.80(T-18)=8.0\), so \(T-18=10\), giving \(T=28\)°C. The fitted minimum demand is
The model therefore places its minimum at 28°C, within the observed range of 5°C to 35°C, and predicts 480 MW there. This supports describing 28°C as the fitted curve’s minimum in this example; it does not establish that demand is truly minimized at exactly that temperature.
Why the Turning-Point Formula Works
The turning point can also be seen by rewriting the fitted curve as a squared term plus a constant. This gives a direct justification for both the turning-point formula and whether the point is a minimum or maximum:
The squared term is smallest when \(z=-b_1/(2b_2)\), which gives \(T=c-b_1/(2b_2)\). If \(b_2>0\), multiplying the squared term by \(b_2\) gives a nonnegative contribution, so the curve reaches a minimum there. If \(b_2<0\), it gives a nonpositive contribution, so the curve reaches a maximum. This algebra establishes the turning point of the fitted function; it does not establish how precisely that point is estimated.
Worked Example: Interpreting Predictions and Local Slopes
Use the fitted curve from the previous example to find predicted demand at 18°C and 35°C, and compare the local slopes at those temperatures.
At 18°C, \(T-18=0\), so \(\hat{Y}(18)=520-8.0(0)+0.40(0)^2=520\) MW. Its local slope is
At 35°C, \(T-18=17\). The predicted demand is
The local slope at 35°C is \(-8.0+0.80(17)=5.6\) MW per °C. The fitted curve therefore predicts demand decreasing as temperature rises near 18°C, and increasing as temperature rises near 35°C. The slope describes the curve’s local rate of change; it is not the predicted difference for every one-degree increase across the entire range. These predictions are in-range, but they remain model-based estimates rather than exact demand values for particular days.
Checking Whether the Curvature Is Adequate
A fitted quadratic can bend, but it may still miss important structure in the data. A residual is the observed demand minus fitted demand: \(e_i=Y_i-\hat{Y}_i\). A residual plot displays these differences against a predictor such as temperature, or against fitted demand. If the quadratic mean curve is reasonably adequate, residuals should generally scatter around zero without a systematic trend or additional curved pattern. The plot does not prove that the model assumptions hold, but it can reveal ways in which the fitted curve fails to describe the observed mean pattern.
An upward or downward trend in residuals across temperature suggests that the fitted curve is systematically underpredicting or overpredicting in parts of the range. A remaining wave or S-shaped pattern suggests that the quadratic has not captured all of the mean curvature. A fan-shaped spread, by contrast, points to changing residual variability rather than necessarily to a wrong mean curve. Isolated large residuals also deserve attention, but they do not by themselves identify why a value differs from its prediction.
Worked Example: Reading a Residual Plot for Demand
In a hypothetical analysis, a residual plot for the quadratic demand model shows residuals mostly near zero at moderate temperatures, but a smoothed pattern that is positive at the coldest temperatures, negative through the middle, and positive again at the hottest temperatures. What does this suggest?
Residuals are observed minus predicted demand. Positive residuals mean the model underpredicts; negative residuals mean it overpredicts. The pattern described therefore indicates underprediction at both ends of the temperature range and overprediction through the middle. Because the residuals change systematically across temperature rather than scattering around zero without structure, the quadratic curve may not adequately capture the mean relationship.
This plot alone does not identify a better model or prove that a particular alternative is appropriate. The analyst should check that the pattern is not driven by a few observations, consider the range and coverage of temperatures, and report the limitation if the chosen curve leaves meaningful structure. A smooth residual trend is evidence against treating the quadratic as an adequate description of the observed pattern.
Common Pitfalls and Reporting
- Calling \(b_1\) the slope at every temperature. In a quadratic model the slope is \(b_1+2b_2(T-c)\); \(b_1\) is the slope only at \(T=c\).
- Reporting a turning point without checking its location. A calculated minimum far outside the observed temperature range is an extrapolation, not a directly supported feature of the observed data.
- Treating a plausible story as a model check. Heating and cooling may motivate a curved relationship, but residual plots are needed to see whether the fitted quadratic leaves a systematic pattern.
- Interpreting association as causation. An observational temperature–demand pattern can be affected by other variables; the fitted curve alone does not show that temperature caused the predicted differences.
A clear report should state the units and temperature range, the fitted quadratic, the turning point if it is meaningful within that range, and what the residual plots indicate. For instance, the hypothetical fit above has a minimum at 28°C and predicts 480 MW there; that statement should be accompanied by whether the residual pattern gives reasonable support to the quadratic over the observed temperatures.
Check Your Understanding
Use the model and ideas in this tutorial to answer the following questions.
- For \(\hat{Y}(T)=600+3(T-20)-0.25(T-20)^2\), does the fitted curve open upward or downward? Is its turning point a minimum or maximum?
- For that same model, calculate the turning-point temperature and explain what it represents.
- In a quadratic model centered at 20°C, what does the linear coefficient represent, and why is it not the slope at every temperature?
- A residual plot has a clear S-shaped pattern across temperature. What does this suggest about the adequacy of the fitted quadratic mean curve?
- Why should a turning point outside the observed temperature range be interpreted cautiously?