Why doesn't predicted mean difference size of regression coefficient (when predictor is binary)?

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?

• 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)). – assumednormal Sep 26 '17 at 16:19
• 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? – user166625 Sep 26 '17 at 16:55
• Please edit the title. I think you're missing a verb before "size". – Kodiologist Sep 26 '17 at 19:06

$$\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$.