[R] problem with interaction in lmer even after creating an "interaction variable"
anna.lampei-bucharova at uni-tuebingen.de
Thu Nov 7 12:15:31 CET 2013
I have a problem with interactions in lmer. I have 2 factors (garden and
gebiet) which interact, plus one other variable (home), dataframe arr. When
lmer (biomass ~ home + garden:gebiet + ( 1|Block), data = arr)/
/Error in lme4::lFormula(formula = biomass ~ home + garden:gebiet + (1 | :
rank of X = 28 < ncol(X) = 30/
In the lmer help I found out that if not all combination of the interaction
are realized, lmer has problems and one should do new variable using
"interaction", which I did:
arr$agg <- interaction (arr$gebiet, arr$garden, drop = TRUE)/
when I fit the interaction term now:
lmer (biomass ~ home + agg+ ( 1|Block), data = arr)/
The error does not change:
Error in lme4::lFormula(formula = biomass ~ home + agg + (1 | Block), :
rank of X = 28 < ncol(X) = 29/
No NAs are in the given variables in the dataset.
Interestingly it works when I put only given interaction like
/lmer (biomass ~ agg + ( 1|Block), data = arr)/
Even following models work:
/lmer (biomass ~ gebiet*garden + ( 1|Block), data = arr)
lmer (biomass ~ garden + garden:gebiet +( 1|Block), data = arr)/
But if I add the interaction term in th enew formate of the new fariable, it
reports again the same error.
/lmer (biomass ~ garden + agg +( 1|Block), data = arr)/
If I put any other variable from the very same dataframe (not only variable
"home"), the error is reported again.
I do not understand it, the new variable is just another factor now, or? And
it is in the same dataframe, it has the same length.
Does anyone have any idea?
Thanks a lot, Anna
View this message in context: http://r.789695.n4.nabble.com/problem-with-interaction-in-lmer-even-after-creating-an-interaction-variable-tp4679951.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help