[R-sig-ME] R lme() - MEEM error (singularity in Backsolve) due to user-specified contrasts amount (?)
Daniel Preciado
danprec at hotmail.com
Wed Mar 2 12:09:45 CET 2016
Hello Ben,
Thanks a lot for your feedback! I get it now, I think. My biggest concern was that the fitting itself, getting such an error made me a bit distrustful of the fitting result. But if I understand you correctly, I can leave the contrast out while fitting the model, and then just "manually" check the contrasts.
I can forward sample data and the code if you think it is helpful (thanks for making me realize about the typo in the contrasts, should be 0, 1, -1), but you have already solved the issue for me.
Thanks again,
On 29 Feb 2016 19:57, Ben Bolker <bbolker at gmail.com> wrote:
>
> >
> > PS if you have three levels of factor B, you can have at most two
> > contrasts associated with the factor *when you fit the model*. You
> > can use the effects or lsmeans or contrast packages (or probably
> > others) to compute the values and inferential statistics on the
> > contrasts after you've fitted the model.
> >
> > On Mon, Feb 29, 2016 at 1:54 PM, Ben Bolker <bbolker at gmail.com> wrote:
> > > Are your F_B_C2 and F_B_C3 contrasts really identical, or is that a typo?
> > >
> > > A reproducible example would be nice ...
> > >
> > > On Mon, Feb 29, 2016 at 5:22 AM, Daniel Preciado <danprec at hotmail.com> wrote:
> > >> Hello,
> > >>
> > >> I am trying to use lme() to fit and compare different models to data from an experiment in a repeated measures design. My dependent variable is response time (RT, in milliseconds); and I have 2 factors: F_A (2 levels) and F_B (3 Levels). For F_B, I have specified the following contrasts:
> > >> F_B_C1 <- c(1, -1, 0) # Contrast prize 1 and 2 levels
> > >> F_B_C2 <- c(1, 0, -1) # Contrast prize 1 with Neutral (no prize)
> > >> F_B_C3 <- c(1, 0, -1) # Contrast prize 2 with Neutral (no prize)
> > >> F_B_C4 <- c(1, 1, -2) # Contrast prize with Neutral
> > >> contrasts(Data$F_B, how.many=4) <- cbind(F_B_C1, F_B_C2, F_B_C3, F_B_C4)
> > >> Conditions 1 and 2 are 2 levels of the same manipulation, condition 3 is a neutral control. I am interested in the effect of each level (individually) on RT, and overall in the difference between the experimental manipulation (pooling the first 2 conditions of factor B) and the control condition (final condition of factor B).
> > >>
> > >> I defined the lme() models step-wise, starting with a Baseline model, and then updating that one to include each factor individually, and finally the interaction:
> > >> RT_Base <- lme(RT ~ 1, random = ~1|SubjID/F_A/F_B, data=Data, method="ML") #Baseline model
> > >> RT_F_A <- update(RT_Base, .~. + F_A) #Baseline + F_A
> > >> RT_F_B <- update(RT_F_A, .~. + F_B) #(Baseline+F_A) + F_B
> > >> RT_Full <- update(RT_F_B, .~. + F_A:F_B) #Full model (+ interaction)
> > >> However, when I execute the code involving F_B, I get an
> > >> "Error in MEEM (...): Singularity in Backsolve at level 0, block 1).
> > >> I can still inspect the results of the model, but I would like to understand where is this error coming from, what does it mean, and how to avoid it. Furthermore, I realized that if I reduce the amount of contrasts to the default 2, the code runs without any error, so I can only assume that it has something to do with the user-specified comparison pairs. Also, the specified contrasts are not displayed (only the default first 2).
> > >>
> > >> I also read in some answer that the intercept needed to be suppressed in order to prevent this error (by adding RT ~ 0+Factors to the model formulae). I tried that, but it produces the same error.
> > >>
> > >> I would appreciate any feedback regarding this, Thanks!
> > >>
> > >>
> > >> [[alternative HTML version deleted]]
> > >>
> > >> _______________________________________________
> > >> R-sig-mixed-models at r-project.org mailing list
> > >> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
More information about the R-sig-mixed-models
mailing list