data example : variable a{1, 0, 1, 0, 1, 0, 1, 0} variable b{0, 1, 0, 1, 0, 1, 0, 1}
can I use spearman method for this analysis?
data example : variable a{1, 0, 1, 0, 1, 0, 1, 0} variable b{0, 1, 0, 1, 0, 1, 0, 1}
can I use spearman method for this analysis?
Yes, you can apply both Spearman's and Pearson's correlations on the data. I went on and run both in Python using your data:
from scipy.stats.stats import pearsonr
from scipy.stats import spearmanr
a = [1, 0, 1, 0, 1, 0, 1, 0]
b = [0, 1, 0, 1, 0, 1, 0, 1]
print("PEARSON'S: ", pearsonr(a, b))
print("SPEARMAN'S: ", spearmanr(a, b))
The results were:
PEARSON'S: (-1.0, 0.0)
SPEARMAN'S: SpearmanrResult(correlation=-0.9999999999999998, pvalue=2.7369110631344156e-47)