Timedora

Estimating and Interpreting Regression Coefficients

How least squares estimates regression coefficients and how to interpret numerical and categorical predictors in fitted models.

How least squares fits a model

How least squares fits a model

For each observed pair (xi,yi)(x_i,y_i), a fitted line predicts y^i=b0+b1xi\hat y_i=b_0+b_1x_i. The is the difference between the observed and predicted responses:

ei=yi−y^i.e_i=y_i-\hat y_i.

A records how far the model’s prediction is from an observation. Least squares chooses the and to minimize the sum of the squared residuals:

SSE=∑i=1n(yi−b0−b1xi)2.SSE=\sum_{i=1}^{n}(y_i-b_0-b_1x_i)^2.

Squaring makes the objective depend on the size of each prediction error rather than allowing positive and negative residuals to cancel. In multiple regression, the same principle applies: choose coefficients that minimize the sum of squared residuals across observations.

For simple linear regression, the minimizing coefficients are

b1=∑i(xi−xˉ)(yi−yˉ)∑i(xi−xˉ)2,b0=yˉ−b1xˉ.b_1=\frac{\sum_i(x_i-\bar x)(y_i-\bar y)}{\sum_i(x_i-\bar x)^2}, \qquad b_0=\bar y-b_1\bar x.

The formula requires variation in the observed predictor values. If every xix_i is the same, then ∑i(xi−xˉ)2=0\sum_i(x_i-\bar x)^2=0, so the formula cannot be used. When it is defined, these estimates make the fitted line pass through (xˉ,yˉ)(\bar x,\bar y): at x=xˉx=\bar x, the fitted value is b0+b1xˉ=yˉb_0+b_1\bar x=\bar y.

Reading intercepts and slopes

Reading intercepts and slopes

In a fitted line y^=b0+b1x\hat y=b_0+b_1x, the b0b_0 is the model’s predicted response at x=0x=0. The b1b_1 is the predicted response change for a one-unit increase in xx. A positive indicates an increasing fitted relationship; a negative one indicates a decreasing fitted relationship. The ’s units are response units per predictor unit, while the has the response’s units.

Consider the model predicting weekly earnings in dollars from hours worked:

earnings^=120+18(hours).\widehat{\text{earnings}}=120+18(\text{hours}).

The means the model predicts $18 more in weekly earnings for each additional hour worked. The predicts $120 at zero hours. That prediction may or may not be practically meaningful: zero hours could be outside the observed data or not a useful reference point. The describes an estimated association; by itself, it does not establish that working an extra hour causes earnings to increase by $18.

In multiple regression, the is the predicted response when all included predictors are zero. A coefficient for one predictor describes the estimated response change for a one-unit increase in that predictor while holding the other included predictors constant. As with a simple-regression , the prediction at zero-valued predictors may have little practical meaning if those values are impossible, outside the data, or not meaningful in context.

Comparing categories with indicator variables

Comparing categories with indicator variables

A categorical predictor can be represented with indicator variables. For a two-category predictor, code the as D=0D=0 and the comparison group as D=1D=1. In the model

y^=b0+b1x+b2D,\hat y=b_0+b_1x+b_2D,

substituting each code shows what the coefficients mean:

  • : D=0D=0, so y^=b0+b1x\hat y=b_0+b_1x.

  • Comparison group: D=1D=1, so y^=(b0+b2)+b1x\hat y=(b_0+b_2)+b_1x.

At the same value of xx, the comparison group’s prediction is therefore b2b_2 higher or lower than the ’s prediction, depending on the sign of b2b_2. The ’s is b0b_0; the comparison group’s is b0+b2b_0+b_2. Both groups have the same b1b_1 for xx in this model.

If the relationship between xx and the response may differ by group, an xDxD can be added. In y^=b0+b1x+b2D+b3xD\hat y=b_0+b_1x+b_2D+b_3xD, for example, the has b1b_1, while the comparison group has b1+b3b_1+b_3. This gives the model a way to represent different slopes rather than requiring them to be equal.

For a categorical predictor with more than two categories, use one fewer indicator than the number of categories and leave one category as the reference. Each indicator coefficient represents a predicted difference from that reference, conditional on the other predictors in the model. Because the comparison is defined by the coding, changing the reference category changes how the coefficients are interpreted.

  • : The sum of squared residuals, which least squares seeks to minimize.

  • : A variable coded 0 or 1 to represent membership in a category.