statdivlab / corncob

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

differentialTest Error (All models failed to converge) #143

Closed SevanEsaian closed 1 year ago

SevanEsaian commented 1 year ago

Hello, I am trying to use the differentialTest. I am receiving an error that others have outlined on github. The error I am receiving is Error in differentialTest(formula = ~age + depth, formula_null = ~depth, : 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 argumentslink,phi.link, andmethodto 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.

To trouble shoot this issue, what I did was uninstall and reinstall corncob. I also ran a single taxon example with bbdml; however, I received the following error: Error in bbdml(formula = ASV1 ~ depth, phi.formula = ~depth, data = corncob_trial) : Model could not be optimized! Try changing initializations or simplifying your model.

My phyloseq object is the following: phyloseq-class experiment-level object otu_table() OTU Table: [ 49 taxa and 86 samples ] sample_data() Sample Data: [ 86 samples by 2 sample variables ] tax_table() Taxonomy Table: [ 49 taxa by 6 taxonomic ranks ] I'm not sure how to resolve this issue. Any advice or suggestions would be greatly appreciated. Thank you.

adw96 commented 1 year ago

Hi @SevanEsaian - please provide details on which version of corncob you're using. The package got updated recently and we believe this bug to be fixed in the latest versions on both CRAN and github. Please let us know if that's not the case; otherwise please close this issue.

SevanEsaian commented 1 year ago

Hello @adw96 I am using corncob package version 0.3.0. I am also using R v4.1.2. I uninstalled corncob and resinstalled it using the following command devtools::install_github("bryandmartin/corncob")

Then I double checked that the package was installed correctly by running the differentialTest example provided by the corncob package. After confirming that the package was installed correctly and worked, I tried running it on my own data; however, it is not working. I am assuming that there is something wrong with my dataframe though I am not sure what. My phyloseq object has the following parameters: phyloseq-class experiment-level object otu_table() OTU Table: [ 49 taxa and 86 samples ] sample_data() Sample Data: [ 86 samples by 2 sample variables ] tax_table() Taxonomy Table: [ 49 taxa by 6 taxonomic ranks ]

Any suggestions on how to trouble shoot this issue would be greatly appreciated. Thank you.

SevanEsaian commented 1 year ago

Hello @bryandmartin & @adw96 , I'm just following up on this post from last week. I went through the corncob tutorial and tried to run bbdml on a single ASV. I wrote the following command and it worked successfully: corncob2 <- bbdml(formula = ASV9 ~ 1, phi.formula = ~ 1, data = TEST)

However, when I ran the same test on a different ASV (e.g., ASV1), I received the following error:

Error in validObject(.Object) : invalid class “otu_table” object: 
 OTU abundance data must have non-zero dimensions.

Any suggestions as to how I can resolve this issue would be immensely appreciated.

SevanEsaian commented 1 year ago

Hello @bryandmartin & @adw96 , Just wanted to let you know I have resolved the issue. Best, Sevan