Borrar filtros
Borrar filtros

How to plot a spatial correlation with a p-value threshold?

3 visualizaciones (últimos 30 días)
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

Respuesta aceptada

Jeff Miller
Jeff Miller el 5 de Feb. de 2021
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

Más respuestas (0)

Categorías

Más información sobre Climate Science and Analysis en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by