Tutorials › Regression Analysis (Undergraduate) › The Quadratic Regression Model

Polynomial Regression · Tutorial 420 of 991

The Quadratic Regression Model

See how adding a squared predictor term changes a regression model’s form, and calculate and interpret fitted values from a specified quadratic equation.

Intermediate 9 min read

What You'll Learn

  • Write the quadratic regression model using a predictor and its squared term.
  • Distinguish the conditional mean from an individual response and its error.
  • Identify the intercept, linear coefficient, and quadratic coefficient, including their units.
  • Calculate fitted values from a specified quadratic model.
  • Explain how a nonzero squared-term coefficient distinguishes the model from a straight line.
  • State the basic assumptions associated with the model.

Why Include a Squared Predictor?

A straight-line regression model represents the conditional mean response as a linear function of a predictor. That is useful when a line is an adequate description of the mean pattern, but some relationships change in a way that a single straight line cannot represent. A quadratic model adds the square of the predictor as a second basis term. The result is still a simple regression equation, but its predicted means need not lie on a straight line.

The word quadratic refers to the highest power of the predictor in the mean function: the model includes \(x^2\). The predictor and its square are two terms in the model, not two different measured predictors. As in polynomial mean functions more generally, the model uses the same observed predictor value in both terms.

Definition: For observation \(i\), a quadratic regression model is $$ Y_i = \beta_0 + \beta_1 x_i + \beta_2 x_i^2 + \varepsilon_i. $$ Here \(Y_i\) is the response, \(x_i\) is the predictor, \(\beta_0\), \(\beta_1\), and \(\beta_2\) are coefficients, and \(\varepsilon_i\) is the error. The model’s conditional mean is $$ E(Y_i \mid x_i) = \beta_0 + \beta_1 x_i + \beta_2 x_i^2. $$

The equation describes a mean response, not a guarantee that every observed response falls exactly on the curve. The error term accounts for the difference between an individual response and its conditional mean. If the coefficients are estimated from data, the corresponding fitted value at predictor value \(x_i\) is $$ \hat{y}_i = \hat{\beta}_0 + \hat{\beta}_1 x_i + \hat{\beta}_2 x_i^2. $$ The hats indicate estimated coefficients. Once those coefficients are given, calculating a fitted value means substituting the predictor value into the equation.

Coefficients and Their Units

The intercept \(\beta_0\) is the model’s conditional mean when \(x=0\), because both \(x\) and \(x^2\) are then zero. Whether this is practically meaningful depends on the situation: zero may be a plausible predictor value, or it may be outside the range being studied.

The other two coefficients belong to different terms in the same mean function. The coefficient \(\beta_1\) multiplies \(x\), while \(\beta_2\) multiplies \(x^2\). In general, \(\beta_1\) alone is not a complete description of how the mean response changes for each one-unit increase in \(x\), since the squared term also contributes to the fitted mean. The interpretation of changes along a quadratic curve requires care and is a separate question from identifying the model’s terms.

Units help keep the terms straight. If \(Y\) is measured in minutes and \(x\) in hours, then \(\beta_0\) is in minutes, \(\beta_1\) is in minutes per hour, and \(\beta_2\) is in minutes per squared hour. Each term in the conditional mean must have the units of the response: \(\beta_1x\) and \(\beta_2x^2\) are both measured in minutes.

Worked Example: Identifying Coefficients and Calculating Fitted Values

Suppose a hypothetical model relates a response measured in points to study time \(x\), measured in hours: $$ \hat{y} = 12 + 3x - 0.5x^2. $$ Identify its coefficients and calculate the fitted response at \(x=2\) hours and \(x=4\) hours.

The intercept is \(\hat{\beta}_0=12\) points. The linear-term coefficient is \(\hat{\beta}_1=3\) points per hour, and the squared-term coefficient is \(\hat{\beta}_2=-0.5\) points per squared hour. The equation gives fitted mean responses; it does not state that every individual who studies for a given time will earn exactly that number of points.

At \(x=2\) hours, substitute \(2\) for \(x\), including in the squared term: $$ \hat{y} = 12 + 3(2) - 0.5(2^2) = 12 + 6 - 2 = 16 \text{ points}. $$ At \(x=4\) hours: $$ \hat{y} = 12 + 3(4) - 0.5(4^2) = 12 + 12 - 8 = 16 \text{ points}. $$ These are fitted values from the specified model. They are not observed scores, and the fact that these two fitted values match does not imply that the actual responses of two students must match.

What Makes It Different From a Straight Line?

A straight-line model has the form \(\beta_0+\beta_1x\). The quadratic model has one additional term, \(\beta_2x^2\). If \(\beta_2=0\), that term contributes nothing, and the quadratic equation reduces to a straight-line equation. If \(\beta_2\ne 0\), the mean function includes a squared term and is quadratic rather than linear in \(x\).

One way to see the distinction without drawing a graph is to compare fitted means at equally spaced predictor values. For a straight line, each equal increase in \(x\) adds the same amount to the fitted mean. In a quadratic model with nonzero \(\beta_2\), those successive differences are not constant. To show why, let the spacing between predictor values be \(h\). The difference in quadratic mean between \(x+h\) and \(x\) is

$$ \begin{aligned} m(x+h)-m(x) &= \left[\beta_0+\beta_1(x+h)+\beta_2(x+h)^2\right] - \left[\beta_0+\beta_1x+\beta_2x^2\right] \\ &= \beta_1h + \beta_2(2xh+h^2). \end{aligned} $$

This difference depends on \(x\) when \(\beta_2\ne 0\). In contrast, the difference for a straight line is just \(\beta_1h\), which does not depend on the starting value \(x\). This algebraic comparison explains why the squared term allows the mean pattern to depart from a straight line.

Worked Example: Comparing Equally Spaced Fitted Values

Consider the hypothetical quadratic mean function \(m(x)=5+2x+0.75x^2\), and compare it with the straight-line mean function \(l(x)=5+2x\). Calculate the fitted means at \(x=0,1,2,3\), then compare their successive differences.

For the quadratic model: $$ \begin{aligned} m(0)&=5+2(0)+0.75(0^2)=5,\\ m(1)&=5+2(1)+0.75(1^2)=7.75,\\ m(2)&=5+2(2)+0.75(2^2)=12,\\ m(3)&=5+2(3)+0.75(3^2)=17.75. \end{aligned} $$ The successive differences are \(7.75-5=2.75\), \(12-7.75=4.25\), and \(17.75-12=5.75\). They are not equal.

For the straight-line model: $$ \begin{aligned} l(0)&=5+2(0)=5,\\ l(1)&=5+2(1)=7,\\ l(2)&=5+2(2)=9,\\ l(3)&=5+2(3)=11. \end{aligned} $$ Its successive differences are \(7-5=2\), \(9-7=2\), and \(11-9=2\). They are equal because the predictor values are equally spaced and the model is a straight line.

The quadratic model’s successive differences increase by \(1.5\) each time. Here \(2\beta_2=2(0.75)=1.5\), matching the general second-difference result for equally spaced predictor values. The calculation demonstrates a difference in model form; it does not, by itself, establish which model is suitable for any real data.

Assumptions and the Role of the Error

The equation for the conditional mean specifies the quadratic form. A common regression error model also states assumptions about responses around that mean. Conditional on the predictor values, errors are assumed to have mean zero and common variance, and observations are assumed independent. In notation, these conditions are \(E(\varepsilon_i\mid x_i)=0\), \(\operatorname{Var}(\varepsilon_i\mid x_i)=\sigma^2\), and independence of errors across observations. Normal errors, \(\varepsilon_i\mid x_i\sim N(0,\sigma^2)\), are an additional assumption used for some forms of inference; normality is not required just to write or evaluate the quadratic mean function.

These assumptions concern the errors, not whether the predictor itself follows a particular distribution. They also do not mean that all observed responses must lie close to the curve. The error variance describes their spread around the conditional mean. A fitted value remains the model’s estimated mean at a predictor value, while an observed response includes its individual error.

In an application, the assumptions should make sense for how the data were collected and the intended analysis. For example, repeated measurements on the same person may not have independent errors. A systematic pattern in errors or substantially changing spread across predictor values may also indicate that the assumed error structure is questionable. The polynomial form and the error assumptions are related parts of a regression model, but one does not guarantee the other.

Worked Example: Fitted Values in Context

A hypothetical analyst has specified the model $$ \hat{y}=20+1.2x+0.08x^2, $$ where \(x\) is workload in tens of customers and \(y\) is mean waiting time in minutes. Calculate the fitted waiting times for workloads of 30 and 50 customers, and state what the model says about those predictions.

A workload of 30 customers corresponds to \(x=3\), because \(x\) is counted in tens of customers: $$ \hat{y}=20+1.2(3)+0.08(3^2) =20+3.6+0.72 =24.32 \text{ minutes}. $$ A workload of 50 customers corresponds to \(x=5\): $$ \hat{y}=20+1.2(5)+0.08(5^2) =20+6+2 =28 \text{ minutes}. $$ Thus the model gives fitted mean waiting times of 24.32 minutes at 30 customers and 28 minutes at 50 customers. These are model predictions for the conditional mean, not guaranteed waiting times for particular customers.

The units also follow from the predictor’s definition. Here \(\beta_1=1.2\) has units of minutes per ten customers, and \(\beta_2=0.08\) has units of minutes per squared ten-customer unit. The intercept is 20 minutes at \(x=0\), corresponding to zero customers. Whether that value is relevant to the application depends on the data and setting.

For this model to be appropriate, the conditional mean would need to be reasonably represented by this quadratic form over the predictor range being used, and the stated error assumptions would need to be plausible for the data. The equation alone cannot confirm those conditions. In particular, the numerical fitted values do not prove that the mean relationship is quadratic or that errors are independent and equally variable.

Common Mistakes and Practical Checks

A frequent mistake is to treat the quadratic coefficient as though it were the whole effect of a one-unit increase in the predictor. For instance, seeing \(\hat{\beta}_1=3\) and concluding that the fitted mean always rises by 3 response units for each added predictor unit ignores the \(\hat{\beta}_2x^2\) term. The correction is to evaluate the full fitted equation at the predictor values of interest; the linear coefficient is one component of the model, not the entire mean function.

Another common error is to forget that the squared term squares the predictor value as well as multiplying by its coefficient. When \(x=4\), the term is \(\beta_2(4^2)=16\beta_2\), not \(4\beta_2\). Keep parentheses around the predictor substitution and square it before multiplying by the coefficient.

  • Check the model form. A quadratic model includes both \(x\) and \(x^2\); a straight line includes only the constant and \(x\) terms.
  • Check the units. The coefficient of \(x^2\) must carry response units per squared predictor unit.
  • Check what a prediction represents. A fitted value estimates the conditional mean, not the exact response of an individual.
  • Check the range. A model’s equation can be evaluated at any numerical \(x\), but predictions far outside the observed predictor range may not be useful or credible.

The central idea is that the squared predictor term makes the mean function more flexible than a straight line while preserving a compact regression equation. To use the model correctly, identify each term, track its units, substitute the predictor carefully, and distinguish the predicted mean from an individual observation.

Check Your Understanding

Answer each question using the model definitions and calculations in this tutorial.

  1. In \(Y_i=\beta_0+\beta_1x_i+\beta_2x_i^2+\varepsilon_i\), what does \(\beta_2\) multiply, and what does \(\beta_0\) represent?
  2. For \(\hat{y}=8-2x+0.5x^2\), calculate the fitted value at \(x=3\), showing the squared-term substitution.
  3. If \(\beta_2=0\), how does the quadratic mean function relate to a straight-line model?
  4. Why is \(\beta_1\) alone generally not a complete description of the change in fitted mean for each one-unit increase in \(x\)?
  5. If the response is measured in kilograms and the predictor in meters, what are the units of the coefficient of \(x^2\)?
  6. State one error assumption and explain why a fitted value is not necessarily an individual’s observed response.