Wrote results for pipeline_full, pipeline_short, and feat_cross_species.
This commit is contained in:
@@ -2,7 +2,7 @@ import plotstyle_plt
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
from itertools import product
|
||||
from scipy.stats import ttest_ind
|
||||
from scipy.stats import ttest_ind, mannwhitneyu
|
||||
from thunderhopper.modeltools import load_data
|
||||
from thunderhopper.filetools import search_files
|
||||
from thunderhopper.filtertools import find_kern_specs
|
||||
@@ -15,7 +15,7 @@ from IPython import embed
|
||||
# GENERAL SETTINGS:
|
||||
cross_species = [
|
||||
'Chorthippus_biguttulus',
|
||||
# 'Chorthippus_mollis',
|
||||
'Chorthippus_mollis',
|
||||
'Chrysochraon_dispar',
|
||||
# 'Euchorthippus_declivus',
|
||||
'Gomphocerippus_rufus',
|
||||
@@ -410,11 +410,17 @@ for x, y in product(range(n_song), range(n_song)):
|
||||
# print('\nAxis position: ', (y, x))
|
||||
# print(f'Song {song_labels[x]} (x) vs. Song {song_labels[y]} (y)')
|
||||
|
||||
print('\nMedian correlation coefficients:')
|
||||
print(f'Intraspecies: {np.median(song_regs)}')
|
||||
print(f'Interspecies: {np.median(spec_regs)}')
|
||||
|
||||
if test_regression:
|
||||
song_regs, spec_regs = np.array(song_regs), np.array(spec_regs)
|
||||
|
||||
# Add test result subplot:
|
||||
test_ax = fig.add_subplot(test_ax_bounds)
|
||||
test_ax.set_xlim(-0.6, 1.6)
|
||||
test_ax.set_ylim(0, 1)
|
||||
test_ax.set_ylim(-0.15, 1)
|
||||
test_ax.yaxis.set_major_locator(plt.MultipleLocator(yloc_test))
|
||||
ylabel(test_ax, ylab_test, **ylab_test_kwargs)
|
||||
|
||||
@@ -425,15 +431,22 @@ if test_regression:
|
||||
test_ax.plot(np.zeros(len(spec_regs)), spec_regs, **boxplot_dot_kwargs)
|
||||
test_ax.plot(np.ones(len(song_regs)), song_regs, **boxplot_dot_kwargs)
|
||||
|
||||
# CAREFUL - PSEUDO-REPLICATION:
|
||||
|
||||
# Perform t-test:
|
||||
test = ttest_ind(spec_regs, song_regs, equal_var=False)
|
||||
t, p = test.pvalue, test.statistic
|
||||
p, t = test.pvalue, test.statistic
|
||||
print(f'\nT-test result: t={t}, p={p}')
|
||||
|
||||
# Perform Wilcoxon rank-sum test:
|
||||
test = mannwhitneyu(spec_regs, song_regs, alternative='two-sided')
|
||||
p, u = test.pvalue, test.statistic
|
||||
print(f'\nMWU rank test result: U={u}, p={p}')
|
||||
|
||||
if save_path is not None:
|
||||
fig.savefig(save_path)
|
||||
plt.show()
|
||||
|
||||
embed()
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user