rglmmtmb

Using glmmTMB getting warning message: dropping columns from rank-deficient conditional model but column is set up same as others


I'm running stats on my thesis and I'm running into dropping columns from rank-deficient conditional model when I try to run the model with one of my variables. I have 5 IV with 1 DV and 1 random. All 5 IV are categorical with either infection of a fish or familiarity. One IV is focal fish infection (infected and uninfected) and the focal fish is choosing between two social groups (2 way cross of familiarity and infection). I have a chosen and rejected social group column for familiarity (unfamiliar and familiar) and infection (infected and uninfected). The chosen and rejected social groups are opposite each other (chose left side so reject is right side). The rejected social group infection column is giving me "dropping columns from rank-deficient conditional model" when I run those models. This is the code I'm using:

mod.1 <- glmmTMB(Visits ~ FFInfect * ChosSGFam * 
           ChosSGInfect * RejSGFam * RejSGInfect + 
   (1|FFNumb), family = Gamma(link = "log"), data = For_R_CSV)

Then when I run the summary model for the interactions with rejected infection, I get NA.

I've double checked my data and there's no errors there. I'm new to R and have only taken a biostats class that gave examples that didn't run into problems.


Solution

  • We can't precisely debug this without access to a reproducible example, but here are some tips:

    Some diagnostics to see which variables are causing problems:

    with(For_R_CSV, 
      as.data.frame(table(FFInfect, ChosSGFam,
               ChosSGInfect, RejSGFam, RejSGInfect)))
    
    X <- model.matrix(~FFInfect * ChosSGFam * 
               ChosSGInfect * RejSGFam * RejSGInfect, data = For_R_CSV)
    caret::findLinearCombos(X)
    

    One way of solving this problem would be to drop interactions until the bits you want are identifiable, e.g. use fourth-order interactions but drop the five-way interaction:

    Visits ~ (FFInfect + ChosSGFam + ChosSGInfect + 
        RejSGFam + RejSGInfect)^4 + (1|FFNumb)