Spatial Correlation between two variables

22 visualizaciones (últimos 30 días)
ANKUR KUMAR
ANKUR KUMAR el 28 de Sept. de 2017
Comentada: Deepthi B el 3 de Ag. de 2021
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 comentarios
sarah connor
sarah connor el 18 de Nov. de 2017
Hello, I also have the same problem. Have you solved it? May you share your method?
ANKUR KUMAR
ANKUR KUMAR el 14 de En. de 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.

Iniciar sesión para comentar.

Respuesta aceptada

ANKUR KUMAR
ANKUR KUMAR el 2 de Dic. de 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 comentarios
Sushovan Ghosh
Sushovan Ghosh el 16 de Jun. de 2020
Editada: Sushovan Ghosh el 16 de Jun. de 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 el 3 de Ag. de 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?

Iniciar sesión para comentar.

Más respuestas (1)

ANKUR KUMAR
ANKUR KUMAR el 14 de En. de 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.

Categorías

Más información sobre Computational Geometry 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