-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtsnestats.m
More file actions
51 lines (34 loc) · 1.22 KB
/
tsnestats.m
File metadata and controls
51 lines (34 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
%Process figures and descriptive stats for the nanocliip fictive singing TSNE plots
%Reset workspace
clear
%Load the raw data
load('/Users/Tim/Desktop/tsne_summary_data')
%Initialize output structure
stats = [];
numBirds = numel(tsne_summary);
within = getFieldVector(tsne_summary,'within');
across = getFieldVector(tsne_summary,'across');
data = [within', across'];
%Calculate descriptive stats
%Mean
stats.mean = mean(data,1);
%Median
stats.median = median(data,1);
%Std
stats.std = std(data,1);
%SEM
stats.sem = stats.std ./ sqrt(numBirds);
%Significance testing
[h_norm_within, p_norm_within] = kstest(data(:,1)); %[h_norm_within, p_norm_within] = [1, 0]
[h_norm_across, p_norm_across] = kstest(data(:,2)); %[h_norm_across, p_norm_across] = [1, 8e-16]
[h_signif, p_signif] = ttest(data(:,1), data(:,2)); %[h_signif, p_signif] = [1, 0.0022]
%Plot output
figure(69); clf
set(gcf,'Units', 'Inches', 'Position', [15, 4, 4, 5.75]);
b = bar([1,2], stats.mean); hold on
eb = errorbar([1,2], stats.mean, stats.sem, '.k');
xlim([0.5,2.5])
ylim([0, 40])
ylabel('Mean Distance (AU)')
set(gca, 'Box', 'off', 'TickDir', 'out', 'XTick', [1,2], 'XTickLabel', {'Within'; 'Across'})
set(gca, 'YTick', [0, 40], 'FontSize', 12, 'LineWidth', 1.5)