Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible bug in .iter_remle function #294

Open
colinvwood opened this issue Nov 14, 2024 · 0 comments
Open

Possible bug in .iter_remle function #294

colinvwood opened this issue Nov 14, 2024 · 0 comments

Comments

@colinvwood
Copy link

I've run into an issue where I get the following error:

contrasts can be applied only to factors with 2 or more levels

from the lmerTest::lmer function, specifically the call here.

I called ancombc2 with the both a fixed effects formula and a random effects formula, specifically: body.site + (1 | subject). The body.site factor has two levels, and the subject factor has four levels. What happened is that the feature chosen by the expression y_crt = y[1, ] (see the link above) happened to only represent one level of the body.site factor, and thus the error above.

It seems like the first row of the feature table/OTU table is chosen as a matter of convenience, but by chance this feature may not represent multiple levels of the variables in the model. Choosing a different feature by changing the feature selection to y_crt = y[2, ] resolved the issue, and ancombc2 ran successfully. Note also that I did not encounter the issue with the same input data but no random effects formula.

Perhaps there is a way to make the call to lmerTest::lmer robust to such edge cases.

Possibly the cause of #271.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant