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

MixedEffect doesn't work with numpy array - 'SVD did not converge' #352

Closed
mtsotras opened this issue Jun 26, 2024 · 1 comment
Closed

Comments

@mtsotras
Copy link

mtsotras commented Jun 26, 2024

  • What is the current behavior?
    If using a numpy array to initialize a MixedEffect variable, the corresponding SLM model has a 'SVD did not converge' error when fitting to the data.

  • Please provide the steps to reproduce and if possible a minimal demo of the problem.
    from brainstat.stats.terms import MixedEffect

term_subject = MixedEffect(demographics.SUB_ID.to_numpy(), 'SUB_ID')

model_mixed = term_age + term_sex + term_age * term_sex + term_subject

slm_mixed = SLM(
model_mixed,
-contrast_age,
surf=pial_combined,
mask=mask,
correction=["fdr", "rft"],
cluster_threshold=0.01,
two_tailed=False,
)
slm_mixed.fit(thickness)

  • What is the expected behavior?

This code works if you do not convert the series to numpy array.

  • Please tell us about your computing environment:
    Python 3.11.7

  • Other information

@zihuaihuai
Copy link
Collaborator

Please start by checking and preprocessing your data to ensure there are no np.nan values, incorrect data types, or other issues in your NumPy array. Without access to your data, it's difficult to replicate the bug on our end.

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