Removing the intercept is a different model, but there are plenty of examples where it is legitimate. Answers so far have already discussed in detail the example where the true intercept is 0. I will focus on a few examples where we may be interested in an atypical model parametrization.
Example 1: The ANOVA-style Model. For categorical variables, we typically create binary vectors encoding group membership. The standard regression model is parametrized as intercept + k - 1 dummy vectors. The intercept codes the expected value for the "reference" group, or the omitted vector, and the remaining vectors test the difference between each group and the reference. But in some cases, it may be useful to have each groups' expected value.
dat <- mtcars
dat$vs <- factor(dat$vs)
## intercept model: vs coefficient becomes difference
lm(mpg ~ vs + hp, data = dat)
Coefficients:
(Intercept) vs1 hp
26.96300 2.57622 -0.05453
## no intercept: two vs coefficients,
## conditional expectations for both groups
lm(mpg ~ 0 + vs + hp, data = dat)
Coefficients:
vs0 vs1 hp
26.96300 29.53922 -0.05453
Example 2: The case of standardized data. In some cases, one may be working with standardized data. In this case, the intercept is 0 by design. I think a classic example of this was old style structural equation models or factor, which operated just on the covariance matrices of data. In the case below, it is probably a good idea to estimate the intercept anyway, if only to drop the additional degree of freedom (which you really should have lost anyway because the mean was estimated), but there are a handful of situations where by construction, means may be 0 (e.g., certain experiments where participants assign ratings, but are constrained to give out equal positives and negatives).
dat <- as.data.frame(scale(mtcars))
## intercept is 0 by design
lm(mpg ~ hp + wt, data = dat)
Coefficients:
(Intercept) hp wt
3.813e-17 -3.615e-01 -6.296e-01
## leaving the intercept out
lm(mpg ~ 0 + hp + wt, data = dat)
Coefficients:
hp wt
-0.3615 -0.6296
Example 3: Multivariate Models and Hidden Intercepts. This example is similar to the first in many ways. In this case, the data has been stacked so that two different variables are now in one long vector. A second variable encodes information about whether the response vector, y
, belongs to mpg
or disp
. In this case, to get the separate intercepts for each outcome, you suppress the overall intercept and include both dummy vectors for measure. This is a sort of multivariate analysis. It is not typically done using lm()
because you have repeated measures and should probably allow for the nonindepence. However, there are some interesting cases where this is necessary. For example when trying to do a mediation analysis with random effects, to get the full variance covariance matrix, you need both models estimated simultaneously, which can be done by stacking the data and some clever use of dummy vectors.
## stack data for multivariate analysis
dat <- reshape(mtcars, varying = c(1, 3), v.names = "y",
timevar = "measure", times = c("mpg", "disp"),
direction = "long")
dat$measure <- factor(dat$measure)
## two regressions with intercepts only
lm(cbind(mpg, disp) ~ 1, data = mtcars)
Coefficients:
mpg disp
(Intercept) 20.09 230.72
## using the stacked data, measure is difference
## between outcome means
lm(y ~ measure, data = dat)
Coefficients:
(Intercept) measurempg
230.7 -210.6
## separate 'intercept' for each outcome
lm(y ~ 0 + measure, data = dat)
Coefficients:
measuredisp measurempg
230.72 20.09
I am not arguing that intercepts should generally be removed, but it is good to be flexible.