I'm fitting a linear regression model in R. Initially, I included only a dummy coded dichotomous variable as a predictor. Thus, the values of the predictor are X0 (set to 0) and X1 (set to 1). Thus, I know the regression coefficient indicates the expected mean difference between X0 and X1.

However, I then used the predict function to get the estimated values for my participants. I then calculated the estimated values across X0 and X1 and surprisingly found that the mean is different that what was indicated by the regression coefficient. Why? Moreover, I'm now wondering what the predict function is useful for?

  • $\begingroup$ With a single factor as a predictor, you can remove the intercept from the model and get the mean for each factor level as its coefficient. Something like summary(lm(y~-1 + x)). $\endgroup$ Commented Sep 26, 2017 at 16:19
  • $\begingroup$ Related to the question of what the predict function is useful for, what would be the advantage of getting predicted values and confidence intervals when that information is already provided in the regression summary? $\endgroup$
    – user166625
    Commented Sep 26, 2017 at 16:55
  • $\begingroup$ Please edit the title. I think you're missing a verb before "size". $\endgroup$ Commented Sep 26, 2017 at 19:06

1 Answer 1


If your regression equation is:

$$\hat{y} = \hat{\beta}_0 + \hat{\beta}_1x$$

The predict function will give you $\hat{y}$ given the $x$ you input.

The $\hat{y}$ will include information from the intercept $\hat{\beta}_0$ and from the coefficient, $\hat{\beta}_1$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.