How to perform a Levene's test using scipy
14:55 06 Mar 2017

I've been trying to use scipy.stats.levene with no success.

I have a numpy matrix with shape (2128, 45100). Each row is a sample and belongs to one of 3 clusters.

I want to test if there is homoscedasticity between clusters.

I've tried filtering my matrix by cluster and sending the params like so:

from scipy.stats import levene

levene(matrixAudioData[np.ix_((cutTree == 0).ravel()),:][0],
       matrixAudioData[np.ix_((cutTree == 1).ravel()),:][0],
       matrixAudioData[np.ix_((cutTree == 2).ravel()),:][0])

ValueError: setting an array element with a sequence.

or even

levene(matrixAudioData)

ValueError: Must enter at least two input sample vectors.

This works:

levene([1,2,3],[2,3,4])

But what if each sample is not just one number ?

Please note that each matrixAudioData[np.ix_((cutTree == 0).ravel()),:][0] that I'm using as parameter has shape (1048, 45100) so it should be fine.

Can you guys point me in any direction ?

Thanks !

python scipy statistics