corncob icon indicating copy to clipboard operation
corncob copied to clipboard

differentialTest failing on relatively simple model

Open mirpie opened this issue 2 years ago • 3 comments

Hello!

I'm trying to run a relatively simple model as follows: ex1 <- differentialTest(formula = ~ GENOTYPE + Stress, formula_null = ~ GENOTYPE, data = dat_pr_OBIT_f, test = "Wald", boot = T, fdr_cutoff = 0.05)

where Genotype and stress only have two conditions in each. After partitioning by both factors I still have 36, 21, 124 and 78 samples in each group. However, I get the following error:

Error in differentialTest(formula = ~GENOTYPE + Stress, formula_null = ~GENOTYPE, : 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

As per previous issues I've tried reinstalling trust and optimr to no avail. I reran the example in the documentation and it seems to work just fine, so I'm not sure what's going on.

FYI, my phyloseq object is prevalence filtered to exclude taxa with a mean read count below 10.

Thanks in advance!

mirpie avatar Jan 27 '22 17:01 mirpie

Hi @mirpie ,

Can you try fitting the same model to a single taxa with bbdml and let me know if the error persists? Based on #128 it seems as though something is going on with the bootstrap method right now. Does it work if you use boot = F? (Additionally, I don't think you need to use the bootstrap method with that many samples, so you might be able to avoid this issue altogether!)

Bryan

bryandmartin avatar Feb 03 '22 03:02 bryandmartin

Hi Brian!

So I ran things successfully using bbdml and a single taxon as follows:

## attempt with single taxon
corncob_da <- bbdml(formula = sp1 ~ GENOTYPE + DoubleHit,
                      phi.formula = ~1,
                      formula_null = ~ GENOTYPE,
                      data = dat_pr_OBIT_f)
corncob_da

with the following output:

bbdml(formula = sp1 ~ GENOTYPE + DoubleHit, phi.formula = ~1, 
    data = dat_pr_OBIT_f, ... = pairlist(formula_null = ~GENOTYPE))


Coefficients associated with abundance:
             Estimate Std. Error t value Pr(>|t|)    
(Intercept) -3.321953   0.139842 -23.755   <2e-16 ***
GENOTYPEB6   1.228981   0.114427  10.740   <2e-16 ***
DoubleHitSH  0.005116   0.123489   0.041    0.967    
DoubleHitDH  0.023854   0.142708   0.167    0.867    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1


Coefficients associated with dispersion:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept) -2.68796    0.09598     -28   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1


Log-likelihood: -2470.9```

I retired running the same model on my entire dataset but again received the same error, even when setting boot to FALSE. Any advice would be appreciated!

Thanks

mirpie avatar Feb 07 '22 15:02 mirpie

Hi, I want to know the problem whether be solved, I encountered the same problem. I can't get good method to figure it out. If the problem has been solved, could you give any suggestion for that? Thanks a lot.

Zhujun-zhujun avatar Apr 21 '22 06:04 Zhujun-zhujun