Fitted Values
Study guides: Exam SRM, Exam MAS-I, Exam ACIA-CAPSTONE
Fitted Values are a model's estimates of the mean response at the predictor values of the observations it was fitted to. In a linear regression with estimated coefficients \hat\beta_0, \ldots, \hat\beta_p, the fitted value of observation i is
\hat{y}_i = \hat\beta_0 + \hat\beta_1 x_{i1} + \cdots + \hat\beta_p x_{ip}
x_{ij}is the value of predictorjfor observationi.
The difference between an observation and its fitted value is its residual, e_i = y_i - \hat{y}_i.
A simple regression gives the fitted line
\hat = 25.8 + 1.6x. An observation hasx = 15andy = 52. What are its fitted value and its residual?
- The fitted value is the line's value at
x = 15:\hat{y} = 25.8 + 1.6(15) = 49.8.- The residual is
52 - 49.8 = 2.2.
Fitted values in matrix form
For all n observations at once, the vector of fitted values is
\hat{\mathbf{y}} = \mathbf{X}\hat{\boldsymbol\beta}
\mathbf{X}is the design matrix and\hat{\boldsymbol\beta} = (\mathbf{X}^T\mathbf{X})^{-1}\mathbf{X}^T\mathbf{y}is the least squares estimate.
Equivalently, \hat{\mathbf{y}} = \mathbf{H}\mathbf{y}, where \mathbf{H} is the hat matrix, so each \hat{y}_i = \sum_j h_{ij}\, y_j is a weighted combination of all the responses.
The design matrix has rows
(1, 1),(1, 2)and(1, 3), and the estimates are\hat\beta_0 = 0.3333and\hat\beta_1 = 1.5. What are the fitted values?
- Each fitted value is a row of
\mathbf{X}times\hat{\boldsymbol\beta}.- The fitted values are
0.3333 + 1.5 = 1.8333,0.3333 + 3 = 3.3333and0.3333 + 4.5 = 4.8333.
Fitted values of a generalized linear model
In a generalized linear model with link function g, the fitted mean of observation i is
\hat\mu_i = g^{-1}(\hat\eta_i)
\hat\eta_i = \hat\beta_0 + \hat\beta_1 x_{i1} + \cdots + \hat\beta_p x_{ip}is the fitted linear predictor, including any offset.g^{-1}is the inverse of the link function.
\hat\eta_i is the fitted value on the link scale and \hat\mu_i is the fitted value on the response scale. With a log link, \hat\mu_i = e^{\hat\eta_i}, so the log of a fitted mean is the sum of the intercept and the coefficients that apply to the observation. Taking logs of fitted means and differencing them therefore recovers the coefficients.
A Poisson model with a log link has
\hat\eta = \ln(\text) - 2.0 + 0.4\,I_}. What is the fitted claim count of a rural policy with 0.5 years of exposure and of an urban policy with 1 year?
- For the rural policy,
\hat\eta = \ln 0.5 - 2.0 = -2.6931, so\hat\mu = e^{-2.6931} = 0.0677.- For the urban policy,
\hat\eta = \ln 1 - 2.0 + 0.4 = -1.6, so\hat\mu = e^{-1.6} = 0.2019.
A log-link model with two indicators,
RandF, and their interaction has fitted means 0.10 for the base cell, 0.15 when onlyR = 1, 0.12 when onlyF = 1and 0.24 when both are 1. What is the interaction coefficient?
- With a log link,
\ln \hat\muis the intercept plus the coefficients that apply to the cell.- The interaction coefficient is what the cell with both indicators adds beyond the two separate effects:
\hat\beta_{RF} = \ln \hat\mu_{RF} - \ln \hat\mu_R - \ln \hat\mu_F + \ln \hat\mu_{\text{base}}
- The coefficient is
\ln \frac{0.24 \times 0.10}{0.15 \times 0.12} = \ln 1.3333, which is0.2877.