0
$\begingroup$

I’m trying to fit a model with 4 parameters by not including all the interactions, just including the interaction which got biological sense.

This is my data

> str(data) 
'data.frame':   168 obs. of  7 variables:
 $ session  : Factor w/ 7 levels "five","four",..: 5 1 5 2 2 2 1 4 5 1 ...
 $ indiv    : chr  "8" "21" "23" "26" ...
 $ age      : Factor w/ 2 levels "ad","juv": 1 1 1 1 1 1 1 1 1 1 ...
 $ treatment: Factor w/ 2 levels "control","fleas": 1 1 1 1 1 1 1 1 1 1 ...
 $ daytype  : Factor w/ 2 levels "after","before": 1 1 1 1 1 1 1 1 1 1 ...
 $ time     : Factor w/ 2 levels "dark","light": 2 2 2 2 2 2 2 2 2 2 ...
 $ dayba    : int  947 286 480 948 135 112 616 274 543 237 ...

where session is the number of experiment, indiv is each one of the 42 inviduals, daytype is day before treatment or after time is night or day and movs is my response variable and is the only numerical, a number of movements

I try to fit repeated measures model (time series analysis) being ‘indiv’ the random factor with 4 observations for each of the 42 individuals (=168 observations), using both, lme from package nlme and lmer from lme4 and this is what I obtained:

> lme.hp<-lmer(movs~age+treatment+daytype+time+
    treatment:daytype+ daytype:age + 
     treatment:daytype:time+ treatment:daytype:age +  
       treatment:daytype:time:age+(1|indiv))

fixed-effect model matrix is rank deficient so dropping 1 column / coefficient

> lme.hp<-lme(movs~age+treatment+daytype+
  time+treatment:daytype+ daytype:age + 
   treatment:daytype:time+ treatment:daytype:age +
   treatment:daytype:time:age,random=~1|factor(indiv))

Error in MEEM(object, conLin, control$niterEM) : 
  Singularity in backsolve at level 0, block 1

I read that two reasons for that:

  1. It means that the fixed effects are multicollinear, i.e. there is some linear combination of them that's constant (https://stackoverflow.com/questions/22788314/linear-mixed-model-matrix-is-rank-deficient)
  2. cause of this error is apparently rank deficiency (What is rank deficiency, and how to deal with it?)

However, this is no sense for me as I am able to fit a saturated model with all possible interactions, not just the ones I want it without receiving a warning message

 lme.hp <- lmer(movs~age*treatment*daytype*time+(1|indiv))
 lme.hp <- lme(dayba~age*treatment*daytype*time,random=~1|factor(indiv))

I think (not sure) that if I had any of the problems discussed above, I would not be able to fit a model saturated with all interactions.

Anybody knows?

Thanks in advance

$\endgroup$
  • 1
    $\begingroup$ Take a look at stackoverflow.com/questions/26449969/… and see if you can work out the answer to your problem this way. I'm pretty sure it's the same issue -- R's model.matrix doesn't automatically remove redundancies from the model frame if the interactions are specified as separate terms $\endgroup$ – Ben Bolker Feb 11 '15 at 21:09
  • $\begingroup$ Thanks, I finally found the solution. It was so obvious but I was stuck with the syntax. My erroe was the following. I included the 4-way interaction term (treatment:daytype:time:age) without including all 3- and 2-way interaction terms $\endgroup$ – MARIO GARRIDO ESCUDERO Apr 11 '15 at 11:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.