Calculating Predicted Values and Residuals

Calculating Predicted Values

To calculate the prediction value, you plug in the observed values.

For example, if given an alpha of 2 and a beta of 3, you would calculate the predicted value for an observation whose X is equal to 4 as:

2+3(4)=14

Calculating residuals

The residual measures the difference between what we observed and what the regression predicted. 

We can move around the equations from above to calculate the residual. 

If we observed a value of 16, then: e = 16-2-3(4) = 2


Note: One common mistake is to subtract the observed from the expected. 

Remember: substantive direction is more important than math. For example:

The prediction is 2 points higher than we observed

=  is the same as =

We observed two points lower than we predict

EXAMPLE


Political Spending

Let's consider a study that examines the relationship between a candidate's spending on campaign advertising and their vote share in a political election.

In this study, we can fit a linear regression model that predicts a candidate's vote share in a primary election based on their spending on campaign advertising, measured as the percent of party members who report they would select the candidate over their opponent. 

The scatter plot and data table are shown below.

Predicted Equation

The regression equation for predicted values is below.

Note: the Regression output is provided for context. Remember that the (e-.05) is scientific notation for "move the decimal place over five spaces to the left."

Expected vote share = 64.07 + .00002047(campaign advertising spending)

Observed vote share for candidate 1

69%

Expected vote share for candidate 1

64.07+.00002047(100000) = 66.1%

Residual vote share  for candidate 1

66.1%-69%=-2.9%




Calculating predicted + residuals

To calculate the predicted value for an observation, we would plug in the value of X for said observation or, substantively, how many dollars their campaign spent

Let's say we wanted to look at our prediction for candidate one. We observed that candidate 1 received 69% support.

However, from the equation on the right, we expect that a candidate who spent 100,000 on their election would have the support (or vote) of 66.1% of their party members. 

Therefore, we observed that candidate 1 received 2.9 percent less vote share than we expected, given how much they spent on advertising.