Spatial Correlation between two variables

25 visualizzazioni (ultimi 30 giorni)
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 Commenti
sarah connor
sarah connor il 18 Nov 2017
Hello, I also have the same problem. Have you solved it? May you share your method?
ANKUR KUMAR
ANKUR KUMAR il 14 Gen 2018
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.

Accedi per commentare.

Risposta accettata

ANKUR KUMAR
ANKUR KUMAR il 2 Dic 2017
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 Commenti
Sushovan Ghosh
Sushovan Ghosh il 16 Giu 2020
Modificato: Sushovan Ghosh il 16 Giu 2020
how can i get the Statistical significance (p value) corresponding to this correlation coeff.(C)?
Please help!
Thanks in advance.
Deepthi B
Deepthi B il 3 Ago 2021
@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?

Accedi per commentare.

Più risposte (1)

ANKUR KUMAR
ANKUR KUMAR il 14 Gen 2018
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.

Categorie

Scopri di più su Computational Geometry in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by