0
$\begingroup$

This question already has an answer here:

In my current research project, I am looking at the impact of different within-subject experimental manipulations on distance perception. The experiment comprised 40 subjects each providing 144 observations.

I have a 2(Condition)x4(Groups)x3(Delay)design.

I have converted each factor into a complete set of orthogonal contrasts as following :

Condition <- cond(-1, 1)
Groups <- gr34(0,0,-1,1) ; gr12(-1,1,0,0) ; grsq(-1,1,1,-1)
Delay <- D1(-1,0.5,0.5) ; D23(0,-1,1)

Since removing outliers resulted in unbalanced data, I opted for a mixed-effect approach using lmer function :

    lmemesr <- lmer(CoefVeryClean~Cond+Gr34+Gr12+Grsq+D1+D23+Cond*Gr34+
    Cond*Gr12+Cond*Grsq+Cond*D1+Cond*D23+Gr34*D1+Gr34*D23+Gr12*D1+
    Gr12*D23+Grsq*D1+Grsq*D23+Cond*Gr34*D1+Cond*Gr34*D23+Cond*Gr12*D1+
    Cond*Gr12*D23+Cond*Grsq*D1+Cond*Grsq*D23 +  
       (Cond+Gr34+Gr12+Grsq+D1+D23+Cond*Gr34+Cond*Gr12+Cond*Grsq+
        Cond*D1+Cond*D23+Gr34*D1+Gr34*D23+Gr12*D1+Gr12*D23+
        Grsq*D1+Grsq*D23+Cond*Gr34*D1+Cond*Gr34*D23+
        Cond*Gr12*D1+Cond*Gr12*D23+Cond*Grsq*D1+
        Cond*Grsq*D23|Participant), data = DataMR, 
        na.action = na.exclude, 
          control = lmerControl(optimizer = "nloptwrap", calc.derivs = FALSE))

Calling the function returns

fixed-effect model matrix is rank deficient so dropping 6 columns / coefficients

And it appears that all predictors containing the Grsq variable were dropped.

Could somebody explain why this is the case and how I can fix this issue since this particular contrast is of great interest to me ?

Here is my data frame

    structure(list(Participant = c(1, 1, 1, 1), CoefVeryClean = 

c(-0.333333333333333, 
-0.4, -0.4, 0.142857142857143), Cond = structure(c(2L, 2L, 2L, 
2L), .Label = c("-1", "1"), class = "factor"), Gr34 = structure(c(2L, 
2L, 1L, 3L), .Label = c("-1", "0", "1"), class = "factor"), Gr12 = structure(c(3L, 
1L, 2L, 2L), .Label = c("-1", "0", "1"), class = "factor"), Grsq = structure(c(2L, 
1L, 2L, 1L), .Label = c("-1", "1"), class = "factor"), D1 = structure(c(1L, 
1L, 1L, 1L), .Label = c("-1", "0.5"), class = "factor"), D23 = structure(c(2L, 
2L, 2L, 2L), .Label = c("-1", "0", "1"), class = "factor"), ConGr34 = structure(c(2L, 
2L, 1L, 3L), .Label = c("-1", "0", "1"), class = "factor"), ConGr12 = structure(c(3L, 
1L, 2L, 2L), .Label = c("-1", "0", "1"), class = "factor"), ConGrsq = structure(c(2L, 
1L, 2L, 1L), .Label = c("-1", "1"), class = "factor"), ConD1 = structure(c(1L, 
1L, 1L, 1L), .Label = c("-1", "-0.5", "0.5", "1"), class = "factor"), 
    ConD23 = structure(c(2L, 2L, 2L, 2L), .Label = c("-1", "0", 
    "1"), class = "factor"), Gr34D1 = structure(c(3L, 3L, 5L, 
    1L), .Label = c("-1", "-0.5", "0", "0.5", "1"), class = "factor"), 
    Gr34D23 = structure(c(2L, 2L, 2L, 2L), .Label = c("-1", "0", 
    "1"), class = "factor"), Gr12D1 = structure(c(1L, 5L, 3L, 
    3L), .Label = c("-1", "-0.5", "0", "0.5", "1"), class = "factor"), 
    Gr12D23 = structure(c(2L, 2L, 2L, 2L), .Label = c("-1", "0", 
    "1"), class = "factor"), GrsqD1 = structure(c(1L, 4L, 1L, 
    4L), .Label = c("-1", "-0.5", "0.5", "1"), class = "factor"), 
    GrsqD23 = structure(c(2L, 2L, 2L, 2L), .Label = c("-1", "0", 
    "1"), class = "factor"), CondGr34D1 = structure(c(3L, 3L, 
    5L, 1L), .Label = c("-1", "-0.5", "0", "0.5", "1"), class = "factor"), 
    CondGr34D23 = structure(c(2L, 2L, 2L, 2L), .Label = c("-1", 
    "0", "1"), class = "factor"), CondGr12D1 = structure(c(1L, 
    5L, 3L, 3L), .Label = c("-1", "-0.5", "0", "0.5", "1"), class = "factor"), 
    CondGr12D23 = structure(c(2L, 2L, 2L, 2L), .Label = c("-1", 
    "0", "1"), class = "factor"), CondGrsqD1 = structure(c(1L, 
    4L, 1L, 4L), .Label = c("-1", "-0.5", "0.5", "1"), class = "factor"), 
    CondGrsqD23 = structure(c(2L, 2L, 2L, 2L), .Label = c("-1", 
    "0", "1"), class = "factor")), row.names = c(NA, 4L), class = "data.frame")
$\endgroup$

marked as duplicate by Mark White, kjetil b halvorsen, mdewey, Peter Flom - Reinstate Monica Dec 23 '18 at 10:52

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ It could be lots of things. Sometimes when you have so many predictors, the data are very sparse. For example, there could be no people in a specific combination of the interacting covariates. $\endgroup$ – Mark White Dec 22 '18 at 19:24
  • $\begingroup$ @Mark White Thank you your answer. It is weird however, that even the main effect of grsq is excluded from the output. After trying ou different approaches, I also found that when I set Gr12, Gr34 and Grsq ans factors in a aov model, the output only displays effects of Gr12. and Gr34. $\endgroup$ – ArthurP Dec 22 '18 at 20:14
  • $\begingroup$ I may be misreading what you're doing, but grsq = gr12 - gr34, which would certainly lead to rank deficiency. $\endgroup$ – jbowman Dec 23 '18 at 0:11
  • $\begingroup$ You are right, the codes for groups were not orthogonal, rewriting them has fixed the problem ! $\endgroup$ – ArthurP Dec 25 '18 at 13:14