Documentation of lagged_correlation


Global Index (short | long) | Local contents | Local Index (short | long)


Help text

  Load PCS:

Cross-Reference Information

This script calls

Listing of script lagged_correlation


clear

%cd /home/disk/hayes2/dvimont/csiro/matlab_data/Heat_Content
%load LP10_detrend_L1-7_yr101-1000.mat
%pcs = -1*pcs;

tim = 101:550;
lags = -20:20; nlag = length(lags);

lims = [170 240 -6 6];
pcs = getheat(lims, 1:3, tim);
pcs = squeeze(mean(mean(pcs, 2), 3));

lims1 = [160 180 30 37.5];
lims2 = [170 190 45 52.5];

tx1 = getnc('taux', lims1, 1, tim);
tx2 = getnc('taux', lims2, 1, tim);

%tx = getheat([125 150 7.5 17.5], 4:7, tim);
%tx = squeeze(mean(mean(tx, 2), 3));

tx = squeeze(mean(mean((tx1 - tx2), 2), 3));

[b, a] = butter(6, 2/10);
tx = filtfilt(b, a, detrend(tx));
pcs = filtfilt(b, a, detrend(pcs));

clear ac r;
for i = 1:nlag;
  ac(i) = corr(pcs(:,1), pcs(:,1), lags(i));
  r(i) = corr(pcs(:,1), tx, lags(i));
end

figure(1); figure_orient;
subplot(3,1,1);
  bar(lags, ac);
  xlabel('Lag in Years');
  title('Autocorrelation Function for 0-80m Heat Content Index [170 240 -6 6]');
subplot(3,1,2);
  bar(lags, r);
  title('Lagged Correlation between PC1 and TX index');
  xlabel('PC1 Leads TX index   |   TX index leads PC1');

for i = 1:2;
  subplot(3,1,i);
    axis([-15 15 -0.4 1.1]);
    set(gca, 'YTick', -0.4:.2:1, 'XTick', -20:2:20);
    grid on
end

r_exp = r((nlag+1)/2).*ac;

fishz = 0.5 * log((1+r)./(1-r));
fishmu = 0.5 * log((1+r_exp)./(1-r_exp));

dof = dof_corr(tx, pcs(:,1));
dof = (dof/2) - 3;
%dof = 47;

sigz = 1 ./ sqrt(dof);

subplot(3,1,3);
  bar(lags, fishz);
  hold on;
    plot(lags, fishmu, '-k', ...
         lags, fishmu+1.96*sigz, '--k', ...
         lags, fishmu-1.96*sigz, '--k');
  hold off
    axis([-15 15 -1.1 1.1]);
    set(gca, 'YTick', -2:.2:2, 'XTick', -20:2:20);
    grid on

title('Fisher''s Z-Statistic for < 0-80m CT, NPTX >, with Confidence Intervals');
xlabel('0-80m CT Leads NPTX index   |   NPTX index leads 0-80m CT');


colormap([.5 .5 .5]);

cd /home/disk/tao/dvimont/matlab/CSIRO/Heat/GRL_Figs
print -dps2 fishz_stat.ps

%  Check out western boundary, on EQ

lims = [130 150 -7.5 15];
tx = getheat(lims, 4:7, tim);
%tx = shiftdim(tx, 1);
%tx = [tx(1,1:2,:); tx(2,2:3,:); tx(3,1:2,:)];
%tx = shiftdim(tx, 2);

tx = shiftdim(tx, 1);
tx = squeeze(mean2(mean2(tx)));

%  Look at SST in NW Pac

lims = [150 180 42.5 47.5];
tx = getnc('temp', lims, 1, tim);
tx = shiftdim(tx, 1);
tx = squeeze(mean2(mean2(tx)));


%  Try western boundary