How to plot a spatial correlation with a p-value threshold?
조회 수: 12 (최근 30일)
이전 댓글 표시
Hi there!
I am trying to set a p-value threshold and plot along with my spatial correlation. The spatial correlation is between temperature and precipitation over a 40 year time series across all latitudes and longitudes in my study. This is what I have so far:
precip = double(ncread('precip_1979_2019.nc','precip'); % size = 316x332x40 (latxlonxyears)
temp = double(ncread('temp_1979_2019.nc','t2m'); % size = 316x332x40 (latxlonxyears)
lat = double(ncread('temp_1979_2019.nc','latitude')); % size = 316x332 (latxlon)
lon = double(ncread('temp_1979_2019.nc','longitude')); % size = 316x332 (latxlon)
% here I run the correlation for each latxlon point to get a spatial correlation plot (316x332)
for p = 1:316
for q = 1:332
X(p,q)=corr2(squeeze(precip(p,q,:)),squeeze(snowfall(p,q,:)));
end
end
This gives me a great map of correlation values between temperature and precipitation.
My question is, how can I then find the areas in this correlation plot that have a p-value < 0.05?
I have tried this:
XX = [];
for s = 1:316
for q = 1:332
[r,p]=corrcoef(squeeze(annual_snowfall_matrix(s,q,:)),squeeze(annual_mean_sie(s,q,:)));
%XX = [XX;p(1)];
XX = cat(3,XX,p);
end
end
xxreshape = reshape(XX,[316 332]);
but all of the values come out as 1 for both r and p.
Any suggestions or help is greatly appreciated!
Thank you
댓글 수: 0
채택된 답변
Jeff Miller
2021년 2월 5일
After you get X (bottom of your first code segment):
rCrit = 0.312; % Based on N=40 and alpha = 0.05, 2-tailed, from a table of critical r values
sigLoc = abs(X)>rCrit;
sigLoc(lat,long) will be true if the correlation was signficant
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Climate Science and Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!