Yes if Year and State are factors then by default the first level is "omitted" (treated as baseline). You can use relevel
to specify another baseline level.
See
?relevel
If your model gets more complicated you may need contrasts
.
Question
I attempt to estimate:
OLS <- lm(Income ~ Year + State + Year:State, data=MyData)
For issues related to collinearity, lm omits one of the years and one of the states. This is fine, accept ideally, I would like to omit say, the first year to use as a baseline.
Is there anyway to specify which year and which state get omitted?
Solution
Yes if Year and State are factors then by default the first level is "omitted" (treated as baseline). You can use relevel
to specify another baseline level.
See
?relevel
If your model gets more complicated you may need contrasts
.
OTHER TIPS
In addition to my comment , You can use subset
parameter of lm
:
subset an optional vector specifying a subset of observations to be used in the fitting process.
For example using mtcars
data set:
lm(mpg ~ wt, cyl!=6 & wt > 0, data=mtcars)