From predictors to a checked regression prediction

A regression model is a specified rule for predicting a response from observed inputs. Building one requires choosing terms, interpreting their coding, and checking predictions on data kept separate from fitting. A fitted association describes the model's predictions; by itself, it does not establish a causal effect.

Specify the predictors

For a numeric predictor xx and a two-level category, an additive rule can be y^=β0+β1x+β2I(B)\hat y=\beta_0+\beta_1x+\beta_2 I(B). The indicator I(B)I(B) equals 1 for group B and 0 for group A, the reference group. Thus β0+β1x\beta_0+\beta_1x predicts A, while β2\beta_2 is the B-minus-A prediction at the same xx.


With an intercept in this two-group model, adding indicators for both A and B creates exact redundancy because they sum to 1.


If the relationship with xx may differ by group, an interaction xI(B)xI(B) allows different slopes; then the group contrast depends on xx. Choose such terms from the question and available evidence, rather than assuming that extra terms always improve future predictions.

Worked example

Suppose a hypothetical tutoring model predicts score as 41+5h+7I(remote)41+5h+7I(\mathrm{remote}), where hh is tutoring hours and in-person is the reference category. For a remote student with two hours, the prediction is 41+5(2)+7=5841+5(2)+7=58 points.


For an in-person student with two hours, it is 41+5(2)=5141+5(2)=51 points. The seven-point contrast compares the groups at the same hours; it is a model prediction, not proof that remote tutoring causes a seven-point gain.

Check predictions

Evaluate prediction errors on held-out data that were not used to fit coefficients, preprocess inputs, or choose settings. If three held-out score errors are −1-1, 22, and 44 points, mean absolute error is (1+2+4)/3=7/3(1+2+4)/3=7/3 points. Root mean squared error is (1+4+16)/3=7\sqrt{(1+4+16)/3}=\sqrt 7 points. Both retain response units, but squaring before averaging makes the larger miss count more in the latter measure.



A fitted model predicts delivery time (minutes) as 50 + 2x − 8I(express), where x is distance in kilometres and the indicator is 1 for express service. What is the prediction for a 10 km express delivery?

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

A regression gives held-out prediction errors of 2, −3, and 1 dollars. What is its mean squared error in squared dollars?

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

A fitted model is predicted y = 30 + 4x + 6I(B) − 2xI(B). What is predicted y for group B at x = 3?

Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors