3
$\begingroup$

I am trying to understand the influence of several predictors (n=8) on the presence or absence of a species using generalized linear mixed models. Unfortunately, I do not have great data. I have 13000 points, of which 300 are 1 (presence) and the rest 0 (absence). After encountering problems of convergence and high eigenvalues, I now believe the problem lies in my data, specifically, there being too many 0s. I wonder if using a zero-inflated model would resolve these issues.

Post the GlmmTMB, I do model selection to choose the best model using delta AIC. Below is my code:

SP1 <- cbind(Data_scaled, 
               SP1 = Data$SP1,  
           Dist_ID = Data$Dist_ID) 

set.seed(123)

SP1_Final <- SP1 %>% dplyr::select(ProtectedAreas, TRI, 
   Water, Perc_NR, Perc_TB, Settlements, Precipitation, 
   HMI, SP1, Dist_ID)

SP1_ZIGLMM <- glmmTMB(SP1 ~ ProtectedAreas + TDF + Water + Perc_NR +
      Settlements + TRI+ Perc_TB + Precipitation + (1 | Dist_ID), 
                    data = SP1_Final, family = binomial, 
                    ziformula = ~ 1, 
                    na.action = na.fail,# Zero-inflation model (intercept-only model)
                    control = glmmTMBControl(optimizer = "nlminb",  # Changed optimizer
                                             optCtrl = list(iter.max = 100000)))
summary(SP1_ZIGLMM)
SP1model_set_sample <- dredge(SP1_ZIGLMM)
print(SP1model_set_sample)
$\endgroup$
1
  • $\begingroup$ As said by Dimitri, remove ziformula which doesn't make sense. If that doesn't help you can simplify the model or fit with a different package (brms is definitely also an option) $\endgroup$ Commented Oct 29 at 12:41

2 Answers 2

6
$\begingroup$

I would expect the mixed-effects logistic regression to handle settings with many zeros without requiring an extra zero-part (see also here).

Perhaps the problems you experience stem from the nature of the predictors and the selected optimization and integration algorithms. You could also try fitting the model with alternative implementations (e.g., in GLMMadaptive).

$\endgroup$
3
  • $\begingroup$ Sorry, I am very new to glmms. By your first point, fo you mean I should do a logistic regression using the data and then do glmer? $\endgroup$
    – Tammy
    Commented Sep 25 at 11:06
  • 1
    $\begingroup$ No, the point was that you shouldn't need to account for the extra zeros in your model. $\endgroup$ Commented Sep 25 at 11:29
  • 1
    $\begingroup$ Did you look at the thread which Dimitris linked with "here"? Particularly the two highest rated answers? Mu suspicion was that zero inflated logistic doesn't make much sense (if it even exists) and those answers confirm that). $\endgroup$
    – Peter Flom
    Commented Sep 25 at 11:32
6
$\begingroup$

Adding to Dimitris's excellent answer:

The issue of imbalanced data in logistic regression has been discussed here and elsewhere. In general, problems arise when there are too few cases in the smaller category, but here, you have 300 observations for only 8 predictors, and that should be fine.

I am very leery, in general, of using complex and unusual models to try to help when "the problem is in my data". Those problems are usually solved by getting better data (sorry, I know that's not what you want to hear).

Have you tried using fewer predictors?

Have you looked at collinearity? Just looking at the names of your predictors, I think that collinearity could be a problem, but I am doing a bit of guessing as to what the names mean.

Have you plotted each predictor against the dependent variable? Or looked at the mean of each predictor for each level?

Have you tried using splines of the predictors?

$\endgroup$
3
  • $\begingroup$ Hi Peter, Thanks for your response. When I use all 8 variables, the glmer seems to work for a few species, but for others it keeps giving me an error saying the model couldn't converge. Honestly, I don't understand why I get this error, because at the very start, I check for correlation and remove those correlated variables (or just use one of them). On the other hand, when I run the glmer with those species where it doesn't take 8 variables, it seems to work when there are less variables (mostly 3/4). I don't understand why this is so either, leading me to the zero inflation. $\endgroup$
    – Tammy
    Commented Sep 25 at 11:55
  • $\begingroup$ First, correlation is not always a good measure of collinearity. My favorite measure is condition indexes, but VIF is also good. Collinearity can exist among 3 or more variables without very high correlation among any 2. But if collinearity is there, it is there. It can't be there for some species and not others Second, fully diagnosing a problem like this probably requires an expert to have full access to your data. $\endgroup$
    – Peter Flom
    Commented Sep 25 at 12:00
  • $\begingroup$ I also did the VIF as an additional check. Thanks for the latter part about the collinearity. This gives me a few possible ideas about what could be going on. Will check again. True, it is a lot of data and hard to explain without being able to share it. so I appreciate any advice I get. $\endgroup$
    – Tammy
    Commented Sep 25 at 12:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.