-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathssaconvergence.m
79 lines (71 loc) · 2.15 KB
/
ssaconvergence.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
function[ax] = ssaconvergence(s)
%% Makes a figure to demonstrate MC-SSA convergence (or lack thereof)
%
% [ax] = ssaconvergence(s)
%
% ----- Inputs -----
%
% s: The output from SSA_Analysis
%
% ----- Outputs -----
%
% ax: A handle to axes for each of the plots
%
% ----- Written By -----
%
% Jonathan King, 2018, University of Arizona, [email protected]
if ~isfield(s,'MC_p') || ~isfield(s,'MCsigThresh') || ~isfield(s,'MCisSig')
warning('Insufficient data for ssaconvergence. Try running a convergence test...');
return;
end
% Significance level
figure();
plot( s.MC_p);
xlabel('Number of Monte Carlo Iterations');
ylabel('True signficance level of signifcance test.');
title('True Significance Level Tested at each Monte Carlo Iteration');
ax = gca;
% Singular values
figure()
plot( zscore( s.MCsigThresh(:,s.isSigVal) ) );
xlabel('Number of Monte Carlo Iterations');
ylabel('Normalized Significance Threshold of Significant Singular Values');
title('Significance Threshold of Significant Singular Values for Monte Carlo Iterations');
ax = [ax;gca];
% Significance Pass/Fail
figure()
imagesc( s.MCisSig );
cmap = [[1,1,1];[0,0,1]];
colormap(cmap);
pfalse = patch(0,0,[1,1,1]);
ptrue = patch(0,0,[0,0,1]);
legend([ptrue, pfalse], 'Significant', 'Not Significant');
xlabel('Singular Value');
ylabel('Monte Carlo Iteration');
title('Significant Singular Values at each Monte Carlo Iteration');
ax = [ax; gca];
end
% % Get the number of iterations
% nIters = size(s.iterSigVals,1);
%
% % Get the iteration data only for the significant singular values
% sigIters = s.iterSigVals(:, s.isSigVal);
%
% % Standardize to allow use of same axes
% sigIters = zscore(sigIters);
%
% % Plot
% figure(); hold on;
% plot(1:nIters, sigIters);
% title('Convergence of the upper tail of significant singular values.');
% xlabel('Number of Monte Carlo Iterations');
% ylabel('Standardized Significance');
%
% % Plot the true confidence level of each iteration
% figure(); hold on;
% plot(1:nIters, s.iterTrueConf);
% title('True confidence level for iterative upper tail significance threshold');
% xlabel('Number of Monte Carlo Iterations');
% ylabel('True confidence level');
%
% end