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

! task 1 failed - "number of levels of each grouping factor must be < number of observations (problems: ID)" #71

Open
carolyndoty opened this issue Nov 12, 2024 · 1 comment

Comments

@carolyndoty
Copy link

When I try to use the mStat_generate_report_long() or generate_taxa_per_time_test_long() I get the error, "! task 1 failed - "number of levels of each grouping factor must be < number of observations (problems: ID)"". For my analysis my grouping variable is called "group" and has two values, "disease" or "control" and my subject variable is "ID". I have no issue running, generate_taxa_indiv_boxplot_long(). Please let me know if there is anything I can do to get these functions to work.

@cafferychen777
Copy link
Owner

Hi @carolyndoty,

Thank you for reporting this issue. This error typically occurs in mixed-effects models when there are insufficient observations per subject relative to the model complexity. However, to properly diagnose and resolve the issue, I'll need some additional information:

  1. Could you please share:

    • The number of unique subjects (IDs) in your dataset
    • The number of time points per subject
    • Whether there are any missing time points for any subjects
    • A small sample of your data structure (e.g., first few rows of your meta.dat)
  2. You mentioned generate_taxa_indiv_boxplot_long() works fine - this suggests your data object is properly formatted. The difference is that mStat_generate_report_long() and generate_taxa_per_time_test_long() use mixed-effects models, which have stricter requirements for data structure.

As a temporary workaround, you could try:

mStat_generate_report_long(
  data.obj = your.data.obj,
  group.var = "group",
  subject.var = "ID",
  time.var = your.time.var,
  # Try adding these parameters
  feature.analysis.rarafy = FALSE,
  feature.mt.method = "none"
)

However, this is just a guess without seeing your actual data structure. With more details about your dataset, I can provide a more targeted solution.

Could you also share the complete code you're using to call these functions? This would help identify if there are any parameter settings that might be contributing to the issue.

Best regards,
Chen Yang

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

2 participants