So we want to calculate the coefficients of the following prediction equation: .

So

Then . are the means/averages of the two sets of data.

Doing this we get and . So the estimated prediction equation is . Then plug in get a value and plot the points to make the line.

The residuals are basically estimates of unobservable error or (how far away values are from average). So for weeks 5 and 8 do the following: obtain and to get the predicted sales. Then subtract the actual values from the predicted values (i.e. and ).