I run lm to fit an OLS model where one of the covariates is a factor with 30 levels. I use contr.treatment() to set the base level of the factor, so when I run lm() no coefficients are estimated for that level. But in addition (and regardless of which level I choose to be the base), lm also gives a vector of NA coefficients for another level of my factor.

The output says that these coefficients were "not defined because of singularities", suggesting maybe that the 28 estimated coefficients are sufficient to pin down the 29th... but why is this the case? Why am I going from 30 levels to 28 coefficients? Am I misunderstanding the way factors/levels are supposed to work?

Thanks for any suggestions.



      
	[[alternative HTML version deleted]]


