Error running qiime longitudinal linear-mixed-effects

Hi there!

I see many people have asked about this before and that getting errors on this step is fairly common. I've combed through what was already available on the forum and don't think it's one of those issues (or I just don't understand it). Here is my current code:

qiime longitudinal linear-mixed-effects \
  --m-metadata-file CREID-sample-metadata.tsv \
  --m-metadata-file shannon_vector.qza \
  --p-metric shannon_entropy \
  --p-group-columns Group \
  --p-state-column DPI \
  --p-individual-id-column BatNumber \
  --o-visualization silva-shannon-dpi-group.qzv

I've checked my shannon_vector.qza file and did fix the metric, originally I had shannon and apparently it's shannon_entropy. So that solved one error but it still isn't working. I'll paste my specific error below:

Traceback (most recent call last):
File "/curc/sw/install/bio/qiime2/2024.2/2024.2_amplicon_env/lib/python3.8/site-packages/q2cli/commands.py", line 520, in call
results = self._execute_action(
File "/curc/sw/install/bio/qiime2/2024.2/2024.2_amplicon_env/lib/python3.8/site-packages/q2cli/commands.py", line 581, in _execute_action
results = action(**arguments)
File "", line 2, in linear_mixed_effects
File "/curc/sw/install/bio/qiime2/2024.2/2024.2_amplicon_env/lib/python3.8/site-packages/qiime2/sdk/action.py", line 342, in bound_callable
outputs = self.callable_executor(
File "/curc/sw/install/bio/qiime2/2024.2/2024.2_amplicon_env/lib/python3.8/site-packages/qiime2/sdk/action.py", line 615, in callable_executor
ret_val = self._callable(output_dir=temp_dir, **view_args)
File "/curc/sw/install/bio/qiime2/2024.2/2024.2_amplicon_env/lib/python3.8/site-packages/q2_longitudinal/_longitudinal.py", line 203, in linear_mixed_effects
model_summary, model_results, model_fit, formula = _linear_effects(
File "/curc/sw/install/bio/qiime2/2024.2/2024.2_amplicon_env/lib/python3.8/site-packages/q2_longitudinal/_utilities.py", line 353, in _linear_effects
mlm = mixedlm(
File "/curc/sw/install/bio/qiime2/2024.2/2024.2_amplicon_env/lib/python3.8/site-packages/statsmodels/regression/mixed_linear_model.py", line 1046, in from_formula
mod = super(MixedLM, cls).from_formula(
File "/curc/sw/install/bio/qiime2/2024.2/2024.2_amplicon_env/lib/python3.8/site-packages/statsmodels/base/model.py", line 229, in from_formula
mod = cls(endog, exog, *args, **kwargs)
File "/curc/sw/install/bio/qiime2/2024.2/2024.2_amplicon_env/lib/python3.8/site-packages/statsmodels/regression/mixed_linear_model.py", line 797, in init
row_indices[g].append(i)
KeyError: nan

Any idea what's going on here? Happy to provide any other information or files if it helps.

Thanks!

Hi @Kalani ,
Welcome to the forum! Thanks for the full command and error message. Here is the key line in your error message:

This is indicating that there is some missing data somewhere. Chances are you have missing data in one of these columns in your metadata:

Check your metadata — and also your Shannon values — to make sure you are not missing any values. You may need to filter out samples from one file or the other if you have missing data for a sample.

Good luck!

1 Like

Oh I completely didn't realize that this analysis wouldn't ignore samples that had missing values- that fixed it! Thank you so much for your help!

1 Like