Thank you very much,
First, sorry for posting on wrong mailing list, I did not know that 
there exists a special one for lmer.
Yes, there are collinearities in the data.
Still, I would like to have the variables in one model to compare 
explained variability. Is there some option, or it is simply impossible?
Thank you, Anna

On 07.11.2013 16:03, bbolker [via R] wrote:
> a_lampei <anna.lampei-bucharova <at> uni-tuebingen.de> writes:
>
> >
> > Dear all,
> > 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
> > I put:
> > /
> > lmer (biomass ~ home + garden:gebiet +  ( 1|Block), data = arr)/
> >
> > it writes:
> > /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
> >
>
>   This probably belongs on r-sig-mixed-models.
>
>   Presumably 'home' is still correlated with one of the
> columns of 'garden:gebiet'.
>
>   Here's an example of how you can use svd() to find out which
> of your columns are collinear:
>
> set.seed(101)
> d <- data.frame(x=runif(100),y=1:100,z=2:101)
> m <- model.matrix(~x+y+z,data=d)
> s <- svd(m)
> zapsmall(s$d)
> ## [1] 828.8452   6.6989   2.6735   0.0000
> ## this tells us there is one collinear component
> zapsmall(s$v)
> ##            [,1]       [,2]       [,3]       [,4]
> ## [1,] -0.0105005 -0.7187260  0.3872847  0.5773503
> ## [2,] -0.0054954 -0.4742947 -0.8803490  0.0000000
> ## [3,] -0.7017874  0.3692117 -0.1945349  0.5773503
> ## [4,] -0.7122879 -0.3495142  0.1927498 -0.5773503
> ## this tells us that the first (intercept), third (y),
> ## and fourth (z) column of the model matrix are
> ## involved in the collinear term, i.e.
> ## 1+y-z is zero
>
> ______________________________________________
> [hidden email] </user/SendEmail.jtp?type=node&node=4679965&i=0> 
> mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
> ------------------------------------------------------------------------
> If you reply to this email, your message will be added to the 
> discussion below:
> http://r.789695.n4.nabble.com/problem-with-interaction-in-lmer-even-after-creating-an-interaction-variable-tp4679951p4679965.html 
>
> To unsubscribe from problem with interaction in lmer even after 
> creating an "interaction variable", click here 
> <http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4679951&code=YW5uYS5sYW1wZWktYnVjaGFyb3ZhQHVuaS10dWViaW5nZW4uZGV8NDY3OTk1MXwyMjkyNTIzNjM=>.
> NAML 
> <http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> 
>








--
View this message in context: http://r.789695.n4.nabble.com/problem-with-interaction-in-lmer-even-after-creating-an-interaction-variable-tp4679951p4680022.html
Sent from the R help mailing list archive at Nabble.com.
	[[alternative HTML version deleted]]

