Spatial Correlation between two variables

조회 수: 23 (최근 30일)
ANKUR KUMAR
ANKUR KUMAR 2017년 9월 28일
댓글: Deepthi B 2021년 8월 3일
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