Skip to content
This repository was archived by the owner on Aug 1, 2022. It is now read-only.
This repository was archived by the owner on Aug 1, 2022. It is now read-only.

ValueError: The samples x and y must have the same length. Wilcoxon Test #83

@adavidBlancoUPF

Description

@adavidBlancoUPF

I find a ValueError when using the Wilcoxon Test like saying that the samples don't have the equal length.

add_stat_annotation(ax, data=df_plot, x='Features', y='Values', hue='Condition',  box_pairs=[(('Valence', 'Pre'), ('Valence', 'Post')), 
(('Arousal', 'Pre'), ('Arousal', 'Post'))], test='Wilcoxon', loc='inside', verbose=0)

Out: raise ValueError('The samples x and y must have the same length.')
ValueError: The samples x and y must have the same length.

However, when I check I can see that they should have the same equal length, actually I can do the comparisons using the wilcoxon test by myself:

x = df_plot.loc[(df_plot['Features']=='Arousal') & (df_plot['Condition'] == 'Pre'), 'Values']
y = df_plot.loc[(df_plot['Features']=='Arousal') & (df_plot['Condition'] == 'Post'), 'Values']
wilcoxon(x,y, nan_policy='omit')

Out: WilcoxonResult(statistic=107.0, pvalue=0.1353498838175801)

By the way, the wilcoxon test also work perfectly for the (('Valence', 'Pre'), ('Valence', 'Post')) comparison. Each with the same number of samples.

The code also works perfectly if the test is "Mann-Whitney"

Thank you very much in advance!

Ángel

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions