-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcorrelations.m
380 lines (341 loc) · 12.6 KB
/
correlations.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
%% Calculating running correlations
%
% Data Matrix 1 contains: Cloumn
% 1 - Araucaria (normalised)
% 2 - Austrocedrus (normalised)
% 3 - Halocarpus (normalised)
% 4 - Ice dust (normalised)
% 5 - Nothofagus (normalised)
% 6 - Callitris (normalised)
% 7 - 20CR SAM index
% Data Matrix 2 contains: Column ...
% 1 - Law Dome CO2
% 2 - Araucaria (normalised)
% 3 - Austrocedrus (normalised)
% 4 - Halocarpus (normalised)
% 5 - Ice dust (normalised)
% 6 - Nothofagus (normalised)
% 7 - Callitris (normalised)
% 8 - EOF1 (note: EOF1 and 2 only span 1:397)
% 9 - EOF2
%correlation = zeros(5,6,398,5); %first is window, second is index column
%correlation2 = zeros(5,9,398,8);
%pval = zeros(2,7,398,6);
clear
load 'data_for_correlations.mat'
load 'All_proxies_commonT'
window = [31 61 91]; %window size
data = dataMatrix;
len = size(data,1);
numSites = size(data,2);
for i = 1:size(window,2)
i
for j = 1:numSites
indexColumn = j;
windowSize = window(i);
[correlationTS correlationTS2 PvalTS] = movingCorrelation(data, windowSize, indexColumn);
correlation(i,j,1:len,1:numSites-1) = correlationTS;
pval(i,j,1:len,1:numSites-1) = PvalTS;
correlation2(i,j,1:len,1:numSites-1) = correlationTS2;
end
end
%% Plotting results
% Plot running correlations for Law Dome CO2
% for k = 1:numSites-1
% for l = 1:size(window,2)
% figure(l)
% subplot(3,2,k)
% plot(NAustro(1:398,1),squeeze(correlation(l,1,1:398,k)))
% hold on
% plot(NAustro(1:398,1),squeeze(correlation2(l,1,1:398,k)),'color','red','marker','+')
% line([1750 1750],[-1 1],'LineStyle','--','color','black')
% line([1850 1850],[-1 1],'LineStyle','--','color','black')
% axis([1600 2000 -1 1])
% hold off
% end
% end
%
% for i=1:size(window,2)
% figure(i)
% subplot(3,2,1)
% title(['Law Dome CO_2 and Araucaria, ', num2str(window(i)), 'yr window (red + indicates significance at 95%)'])
% subplot(3,2,2)
% title(['Law Dome CO_2 and Austrocedrus, ', num2str(window(i)), 'yr window'])
% subplot(3,2,3)
% title(['Law Dome CO_2 and Halocarpus, ', num2str(window(i)), 'yr window'])
% subplot(3,2,4)
% title(['Law Dome CO_2 and Ice dust, ', num2str(window(i)), 'yr window'])
% subplot(3,2,5)
% title(['Law Dome CO_2 and Nothofagus, ', num2str(window(i)), 'yr window'])
% subplot(3,2,6)
% title(['Law Dome CO_2 and Callitris, ', num2str(window(i)), 'yr window'])
% end
% Plot running correlations for Araucaria
for k = 1:numSites-1
for l = 1:size(window,2)
figure(l)
subplot(3,2,k)
plot(NAustro(1:len,1),squeeze(correlation(l,1,1:len,k)))
hold on
plot(NAustro(1:len,1),squeeze(correlation2(l,1,1:len,k)),'color','red','marker','+')
line([1750 1750],[-1 1],'LineStyle','--','color','black')
line([1850 1850],[-1 1],'LineStyle','--','color','black')
axis([1600 2000 -1 1])
hold off
end
end
for i = 1:size(window,2)
figure(i)
subplot(3,2,1)
title(['Araucaria and Austrocedrus, ', num2str(window(i)), 'yr window (red + indicates significance at 95%)'])
subplot(3,2,2)
title(['Araucaria and Halocarpus, ', num2str(window(i)), 'yr window'])
subplot(3,2,3)
title(['Araucaria and Ice dust, ', num2str(window(i)), 'yr window'])
subplot(3,2,4)
title(['Araucaria and Nothofagus, ', num2str(window(i)), 'yr window'])
subplot(3,2,5)
title(['Araucaria and Callitris, ', num2str(window(i)), 'yr window'])
end
% Plot running correlations for Austrocedrus
for k = 1:numSites-1
for l = 1:size(window,2)
figure(l)
subplot(3,2,k)
plot(NAustro(1:len,1),squeeze(correlation(l,2,1:len,k)))
hold on
plot(NAustro(1:len,1),squeeze(correlation2(l,2,1:len,k)),'color','red','marker','+')
line([1750 1750],[-1 1],'LineStyle','--','color','black')
line([1850 1850],[-1 1],'LineStyle','--','color','black')
axis([1600 2000 -1 1])
hold off
end
end
for i = 1:size(window,2)
figure(i)
subplot(3,2,1)
title(['Austrocedrus and Araucaria, ', num2str(window(i)), 'yr window (red + indicates significance at 95%)'])
subplot(3,2,2)
title(['Austrocedrus and Halocarpus, ', num2str(window(i)), 'yr window'])
subplot(3,2,3)
title(['Austrocedrus and Ice dust, ', num2str(window(i)), 'yr window'])
subplot(3,2,4)
title(['Austrocedrus and Nothofagus, ', num2str(window(i)), 'yr window'])
subplot(3,2,5)
title(['Austrocedrus and Callitris, ', num2str(window(i)), 'yr window'])
end
% Plot running correlations for Halocarpus
for k = 1:numSites-1
for l = 1:size(window,2)
figure(l)
subplot(3,2,k)
plot(NAustro(1:len,1),squeeze(correlation(l,3,1:len,k)))
hold on
plot(NAustro(1:len,1),squeeze(correlation2(l,3,1:len,k)),'color','red','marker','+')
line([1750 1750],[-1 1],'LineStyle','--','color','black')
line([1850 1850],[-1 1],'LineStyle','--','color','black')
axis([1600 2000 -1 1])
hold off
end
end
for i = 1:size(window,2)
figure(i)
subplot(3,2,1)
title(['Halocarpus and Araucaria, ', num2str(window(i)), 'yr window (red + indicates significance at 95%)'])
subplot(3,2,2)
title(['Halocarpus and Austrocedrus, ', num2str(window(i)), 'yr window'])
subplot(3,2,3)
title(['Halocarpus and Ice dust, ', num2str(window(i)), 'yr window'])
subplot(3,2,4)
title(['Halocarpus and Nothofagus, ', num2str(window(i)), 'yr window'])
subplot(3,2,5)
title(['Halocarpus and Callitris, ', num2str(window(i)), 'yr window'])
end
% Plot running correlations for Ice dust
for k = 1:numSites-1
for l = 1:size(window,2)
figure(l)
subplot(3,2,k)
plot(NAustro(1:len,1),squeeze(correlation(l,4,1:len,k)))
hold on
plot(NAustro(1:len,1),squeeze(correlation2(l,4,1:len,k)),'color','red','marker','+')
line([1750 1750],[-1 1],'LineStyle','--','color','black')
line([1850 1850],[-1 1],'LineStyle','--','color','black')
axis([1600 2000 -1 1])
hold off
end
end
for i = 1:size(window,2)
figure(i)
subplot(3,2,1)
title(['Ice Dust and Araucaria, ', num2str(window(i)), 'yr window (red + indicates significance at 95%)'])
subplot(3,2,2)
title(['Ice Dust and Austrocedrus, ', num2str(window(i)), 'yr window'])
subplot(3,2,3)
title(['Ice Dust and Halocarpus, ', num2str(window(i)), 'yr window'])
subplot(3,2,4)
title(['Ice Dust and Nothofagus, ', num2str(window(i)), 'yr window'])
subplot(3,2,5)
title(['Ice Dust and Callitris, ', num2str(window(i)), 'yr window'])
end
% Plot running correlations for Nothofagus
for k = 1:numSites-1
for l = 1:size(window,2)
figure(l)
subplot(3,2,k)
plot(NAustro(1:len,1),squeeze(correlation(l,5,1:len,k)))
hold on
plot(NAustro(1:len,1),squeeze(correlation2(l,5,1:len,k)),'color','red','marker','+')
line([1750 1750],[-1 1],'LineStyle','--','color','black')
line([1850 1850],[-1 1],'LineStyle','--','color','black')
axis([1600 2000 -1 1])
hold off
end
end
for i = 1:size(window,2)
figure(i)
subplot(3,2,1)
title(['Nothofagus and Araucaria, ', num2str(window(i)), 'yr window (red + indicates significance at 95%)'])
subplot(3,2,2)
title(['Nothofagus and Austrocedrus, ', num2str(window(i)), 'yr window'])
subplot(3,2,3)
title(['Nothofagus and Halocarpus, ', num2str(window(i)), 'yr window'])
subplot(3,2,4)
title(['Nothofagus and Ice Dust, ', num2str(window(i)), 'yr window'])
subplot(3,2,5)
title(['Nothofagus and Callitris, ', num2str(window(i)), 'yr window'])
end
% Plot running correlations for Lake Tay record
for k = 1:numSites-1
for l = 1:size(window,2)
figure(l)
subplot(3,2,k)
plot(NTay(1:len,1),squeeze(correlation(l,6,1:len,k)))
hold on
plot(NTay(1:len,1),squeeze(correlation2(l,6,1:len,k)),'color','red','marker','+')
line([1750 1750],[-1 1],'LineStyle','--','color','black')
line([1850 1850],[-1 1],'LineStyle','--','color','black')
axis([1600 2000 -1 1])
hold off
end
end
for i = 1:size(window,2)
figure(i)
subplot(3,2,1)
title(['Callitris and Araucaria, ', num2str(window(i)), 'yr window (red + indicates significance at 95%)'])
subplot(3,2,2)
title(['Callitris and Austrocedrus, ', num2str(window(i)), 'yr window'])
subplot(3,2,3)
title(['Callitris and Halocarpus, ', num2str(window(i)), 'yr window'])
subplot(3,2,4)
title(['Callitris and Ice dust, ', num2str(window(i)), 'yr window'])
subplot(3,2,5)
title(['Callitris and Nothofagus, ', num2str(window(i)), 'yr window'])
end
% Plot running correlations for SAM index
for k = 1:numSites-1
for l = 1:size(window,2)
figure(l)
subplot(3,2,k)
plot(NTay(1:len,1),squeeze(correlation(l,7,1:len,k)))
hold on
plot(NTay(1:len,1),squeeze(correlation2(l,7,1:len,k)),'color','red','marker','+')
line([1600 2000],[0.3 0.3],'LineStyle','--','color','black')
line([1600 2000],[-0.3 -0.3],'LineStyle','--','color','black')
axis([1600 2000 -1 1])
hold off
end
end
for i = 1:size(window,2)
figure(i)
subplot(3,2,1)
title(['SAM and Araucaria, ', num2str(window(i)), 'yr window (red + indicates significance at 95%)'])
subplot(3,2,2)
title(['SAM and Austrocedrus, ', num2str(window(i)), 'yr window'])
subplot(3,2,3)
title(['SAM and Halocarpus, ', num2str(window(i)), 'yr window'])
subplot(3,2,4)
title(['SAM and Ice dust, ', num2str(window(i)), 'yr window'])
subplot(3,2,5)
title(['SAM and Nothofagus, ', num2str(window(i)), 'yr window'])
subplot(3,2,6)
title(['SAM and Callitris, ', num2str(window(i)), 'yr window'])
end
% % Plot running correlations for EOF1
%
% for k = 1:numSites-1
% for l = 1:size(window,2)
% figure(l)
% subplot(4,2,k)
% plot(EOF1(1:397,1),squeeze(correlation(l,8,1:397,k)))
% hold on
% plot(EOF1(1:397,1),squeeze(correlation2(l,8,1:397,k)),'color','red','marker','+')
% line([1750 1750],[-1 1],'LineStyle','--','color','black')
% line([1850 1850],[-1 1],'LineStyle','--','color','black')
% axis([1600 2000 -1 1])
% hold off
% end
% end
%
% for i = 1:size(window,2)
% figure(i)
% subplot(4,2,1)
% title(['EOF1 and Law Dome CO_2, ', num2str(window(i)), 'yr window (red + indicates significance at 95%)'])
% subplot(4,2,2)
% title(['EOF1 and Araucaria, ', num2str(window(i)), 'yr window'])
% subplot(4,2,3)
% title(['EOF1 and Austrocedrus, ', num2str(window(i)), 'yr window'])
% subplot(4,2,4)
% title(['EOF1 and Halocarpus, ', num2str(window(i)), 'yr window'])
% subplot(4,2,5)
% title(['EOF1 and Ice dust, ', num2str(window(i)), 'yr window'])
% subplot(4,2,6)
% title(['EOF1 and Nothofagus, ', num2str(window(i)), 'yr window'])
% subplot(4,2,7)
% title(['EOF1 and Callitris, ', num2str(window(i)), 'yr window'])
% subplot(4,2,8)
% title(['EOF1 and EOF2, ', num2str(window(i)), 'yr window'])
% end
%
% % Plot running correlations for EOF2
%
% for k = 1:numSites-1
% for l = 1:size(window,2)
% figure(l)
% subplot(4,2,k)
% plot(EOF1(1:397,1),squeeze(correlation(l,9,1:397,k)))
% hold on
% plot(EOF1(1:397,1),squeeze(correlation2(l,9,1:397,k)),'color','red','marker','+')
% line([1750 1750],[-1 1],'LineStyle','--','color','black')
% line([1850 1850],[-1 1],'LineStyle','--','color','black')
% axis([1600 2000 -1 1])
% hold off
% end
% end
%
% for i = 1:size(window,2)
% figure(i)
% subplot(4,2,1)
% title(['EOF2 and Law Dome CO_2, ', num2str(window(i)), 'yr window (red + indicates significance at 95%)'])
% subplot(4,2,2)
% title(['EOF2 and Araucaria, ', num2str(window(i)), 'yr window'])
% subplot(4,2,3)
% title(['EOF2 and Austrocedrus, ', num2str(window(i)), 'yr window'])
% subplot(4,2,4)
% title(['EOF2 and Halocarpus, ', num2str(window(i)), 'yr window'])
% subplot(4,2,5)
% title(['EOF2 and Ice dust, ', num2str(window(i)), 'yr window'])
% subplot(4,2,6)
% title(['EOF2 and Nothofagus, ', num2str(window(i)), 'yr window'])
% subplot(4,2,7)
% title(['EOF2 and Callitris, ', num2str(window(i)), 'yr window'])
% subplot(4,2,8)
% title(['EOF2 and EOF1, ', num2str(window(i)), 'yr window'])
% end
%% Get correlations with SAM over obs period
clear
load 'data_for_correlations.mat'
load 'marshall_SAM.mat'
for i = 1:6
[c(:,:,i) p(:,:,i)] = corrcoef(Marshall_SAM(1:43,2),dataMatrix(356:398,i));
end