Spatial Correlation between two variables

35 次查看(过去 30 天)
How can I find the spatial correlation between two variables. For example: I have Latitude (having length 175) and longitude (having length 200). AOD having size 175*200 & AE having size 175*200. I want to find the spatial correlation between these two variables, AOD and AE.
  2 个评论
sarah connor
sarah connor 2017-11-18
Hello, I also have the same problem. Have you solved it? May you share your method?
ANKUR KUMAR
ANKUR KUMAR 2018-1-14
Here you can get timesaving toolbox in which spatialcorr3 is there. You can use this function to get the spatial correlation of 2 data sets.

请先登录,再进行评论。

采纳的回答

ANKUR KUMAR
ANKUR KUMAR 2017-12-2
For simplicity, I am taking A and B for which we want to find spatial correlation. lat have the dimension 240 and lon have the dimension 120.
Note: This method is applicable only if the A and B are in timesteps. For eg. dimesion of A and B are 120*240*365 . 365 is the timesteps.
A=rand(120,240,365);
B=rand(120,240,365);
for i=1:120
for j=1:240
C(i,j)=corr2(squeeze(A(i,j,:)),squeeze(B(i,j,:)));
end
end
If your data set contains some nan values, then you have to remove those nans for finding correlation, otherwise you will get all nan values If there is nan values, then use this
for i=1:120
for j=1:240
C(i,j)=nancorr2(A(i,j,:),B(i,j,:));
end
end
Below is function for nancorr2. Is you are using 2016b or later, then you can write function within a script. Otherwise you have to save it in another file.
function A=nancorr2(U,V)
id1=find(isnan(U));
id2=find(isnan(U));
id=union(id1,id2);
U(id)=[];
V(id)=[];
A=corr2(U,V);
end
  2 个评论
Sushovan Ghosh
Sushovan Ghosh 2020-6-16
编辑:Sushovan Ghosh 2020-6-16
how can i get the Statistical significance (p value) corresponding to this correlation coeff.(C)?
Please help!
Thanks in advance.
Deepthi B
Deepthi B 2021-8-3
@ANKUR KUMAR Sir, the code that you have given for calculating the spatial coorelation is calculating the correlation between the data available at a particular grid point ( 20.5 75 for example ) for the entire period (365 days). Is this spatial correlation? then we for this example , we will have (240*120) correlation values. Then how wil get reduced to one value for substituting in some equations?

请先登录,再进行评论。

更多回答(1 个)

ANKUR KUMAR
ANKUR KUMAR 2018-1-14
Here you can get timesaving toolbox in which spatialcorr3 is there. You can use this function to get the spatial correlation of 2 data sets.

类别

Help CenterFile Exchange 中查找有关 Computational Geometry 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by