Daniel Preciado
2016-Feb-23 10:34 UTC
[R] lme() - MEEM error (singularity in Backsolve) due to user-specified contrasts amount
Hello all, I posted this question also in Stackoverflow, but in hindsight I realise it probably fits better here. 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]]
Bert Gunter
2016-Feb-23 16:10 UTC
[R] lme() - MEEM error (singularity in Backsolve) due to user-specified contrasts amount
You are probably overfitting. This *IS* a statistical and not an R issue, and so does not belong here. You MAY get useful help by posting on the R-SIG-mixed-models list, however. But PLEASE post in *plain text*, not HTML, as the posting guide asks. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Tue, Feb 23, 2016 at 2:34 AM, Daniel Preciado <danprec at hotmail.com> wrote:> Hello all, > > I posted this question also in Stackoverflow, but in hindsight I realise it probably fits better here. 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-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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.