statdivlab / corncob

Count Regression for Correlated Observations with the Beta-binomial
102 stars 22 forks source link

Model does not converge #135

Closed kmdesorcy closed 10 months ago

kmdesorcy commented 2 years ago

Hello,

I'm trying to use corncob to test the differential abundance of all taxa in my samples across a categorical variable with 2 levels. I have ~70 samples. I'm getting an error message that the model is failing to converge. The error message states that the model is overspecified but I'm not sure I understand if I have only 1 categorical variable with 2 levels and a high # of samples. Any help would be very much appreciated.

cctest <- differentialTest(formula = ~ rn, phi.formula = ~ rn, formula_null = ~ 1, phi.formula_null = ~ rn, test = "Wald", boot = FALSE, data = gut.r.week1, fdr_cutoff = 0.05)

Error in differentialTest(formula = ~rn, phi.formula = ~rn, : All models failed to converge!

       If you are seeing this, it is likely that your model is overspecified. This occurs when your sample size is not large enough to estimate all the parameters of your model. This is most commonly due to categorical variables that include many categories. 

       Alternatively, double-check your values for the arguments `link`, `phi.link`, and `method` to makes sure that they follow the specified options. 

       To confirm you have fixed the issue, try running a model for a single taxon with bbdml.
adw96 commented 2 years ago

Hi @kmdesorcy -- can you show us the output of model.matrix(~rn, data = gut.r.week1)? That should be able to tell us how the mean and dispersion models are being specified and if overparametrization is your problem.

adw96 commented 10 months ago

Closing bc no follow-up received