-
Notifications
You must be signed in to change notification settings - Fork 0
/
ssasignificance.m
93 lines (73 loc) · 2.35 KB
/
ssasignificance.m
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
function[ax] = ssasignificance( s )
%% Makes a semilogy of data singular values vs Monte Carlo values and
% highlights significant values
%
% ----- Inputs -----
%
% s: The output of the SSA_Analysis function
%
% ----- Outputs -----
%
% ax: An axes handle for the semilogys
%
% ----- Written By -----
%
% Jonathan King, 2018, University of Arizona, [email protected]
nVals = numel(s.singVals);
figure;
subplot(2,1,1);
hold on;
% Get legend handles
xval = s.singPeriod(1);
b = semilogy([xval,xval], [s.sigThreshold(1), s.lowerTail(1)], 'k');
dblue = semilogy( xval, s.singVals(1), 'bd');
dred = semilogy( xval, s.singVals(1), 'rd');
% For each singular value
for k = 1:nVals
% Get the x value
xval = s.singPeriod(k);
% semilogy the 95% bar
semilogy( [xval, xval], [s.sigThreshold(k), s.lowerTail(k)], 'k');
% Get the color (significance) of each singular value.
if s.isSigVal(k)
semilogyStr = 'rd';
else
semilogyStr = 'bd';
end
% semilogy the data singular values
semilogy( xval, s.singVals(k), semilogyStr);
end
% Labels, legend etc.
xlabel('Singular Vector Period');
ylabel('Singular Value');
title('Comparison of data and Monte Carlo singular values');
legend([b,dblue,dred], sprintf('Monte Carlo %0.f Confidence Interval', 100*(1-s.sig_p)), 'Not Significant', 'Significant');
% REpeat fr frequency
subplot(2,1,2);
hold on;
% Get legend handles
xval = s.singFreq(1);
b = semilogy([xval,xval], [s.sigThreshold(1), s.lowerTail(1)], 'k');
dblue = semilogy( xval, s.singVals(1), 'bd');
dred = semilogy( xval, s.singVals(1), 'rd');
% For each singular value
for k = 1:nVals
% Get the x value
xval = s.singFreq(k);
% semilogy the 95% bar
semilogy( [xval, xval], [s.sigThreshold(k), s.lowerTail(k)], 'k');
% Get the color (significance) of each singular value.
if s.isSigVal(k)
semilogyStr = 'rd';
else
semilogyStr = 'bd';
end
% semilogy the data singular values
semilogy( xval, s.singVals(k), semilogyStr);
end
% Labels, legend etc.
xlabel( sprintf('Singular Vector Frequency (cycles / %0.f points)', s.metadata{1,2}) );
ylabel('Log10 Singular Value');
title('Comparison of data and Monte Carlo singular values');
legend([b,dblue,dred], sprintf('Monte Carlo %0.f Confidence Interval', 100*(1-s.sig_p)), 'Not Significant', 'Significant');
end