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

pairwise_tests producing array of t values internally #298

Closed
George3d6 opened this issue Aug 26, 2022 · 4 comments · Fixed by #299
Closed

pairwise_tests producing array of t values internally #298

George3d6 opened this issue Aug 26, 2022 · 4 comments · Fixed by #299
Assignees
Labels
bug 💥 Something isn't working

Comments

@George3d6
Copy link
Contributor

I occasionally get mysterious crashes when using the pairwise t-test, e.g:

  .../pingouin/pairwise.py", line 397, in pairwise_tests
    df_ttest = ttest(
  .../pingouin/parametric.py", line 310, in ttest
    bf = bayesfactor_ttest(tval, nx, ny, paired=paired, alternative=alternative, r=r)
  .../pingouin/bayesian.py", line 128, in bayesfactor_ttest
    assert isinstance(t, (int, float)), "The T-value must be a int or a float."
AssertionError: The T-value must be a int or a float.

This happens when using a fairly innocuous dataframe:

                                between                                dv
0                              2.0                                         4.00
1                              1.0                                         7.00
2                              3.0                                        13.00
3                              2.0                                         8.00
4                              2.0                                         6.00
5                              2.0                                         5.50
6                              1.0                                        10.00
7                              1.0                                        10.00
8                              2.0                                        10.00
9                              1.0                                         6.00
10                             2.0                                         9.00
11                             1.0                                        13.00
12                             2.0                                        12.00
13                             2.0                                        12.00
14                             1.0                                         7.75
15                             1.0                                         5.50
16                             1.0                                         6.00
17                             2.0                                         9.00
18                             1.0                                         8.50

The issue seems to arise from the fact that the t variable being checked by the assert is actually a single-element array (e.g. [0.521])

I've been unable to figure out the exact cause of the bug or replicate it, any help with this would be appreciated.

@George3d6
Copy link
Contributor Author

I've implemented a potential fix here: #299

@raphaelvallat raphaelvallat added the invalid 🚩 This doesn't seem right label Aug 27, 2022
@raphaelvallat raphaelvallat self-assigned this Aug 27, 2022
@raphaelvallat raphaelvallat linked a pull request Aug 27, 2022 that will close this issue
@George3d6
Copy link
Contributor Author

@raphaelvallat can I ask why this is marked as invalid?
Looking at the code (see linked PR) there's a clear issue with how the scipy interface is used, and this is causing issues in certain cases, since a tuple is treated as if it were a float/int

@raphaelvallat
Copy link
Owner

@George3d6 --> Invalid does not mean that the issue is not valid, but rather that something doesn't look right in the Pingouin code. Apologies for the confusion. I'll update the label to "bug".

@raphaelvallat raphaelvallat added bug 💥 Something isn't working and removed invalid 🚩 This doesn't seem right labels Aug 30, 2022
@George3d6
Copy link
Contributor Author

@raphaelvallat as far as I can see this isn't a recent change in the scipy interface as I suspected, so I guess the bug was always there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 💥 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants