how to perform lag correlation between two spatial data?
7 views (last 30 days)
Show older comments
Hello everyone,
I have two spatial data sets for 5years, temperature and rainfall (180x360x60). here 180x360 is lat and lon and 60 is number of months.
I want to do the lag correlation analysis (at 0, 1, 2, 3 month) between these two data sets? the outputs will be same as the data format:
correlation coefficient = 180x360
pvalue = 180x360
I have done this analysis with vector data but I am stuck in this, can someone suggest me how this could be done?
thanks.
2 Comments
George Abrahams
on 23 Jan 2024
What type of correlation are you looking for? I'm going to assume the Pearson correlation coefficient, as you were satisfied with this in your previous question.
Answers (1)
Taylor
on 23 Jan 2024
If you input two matrices, A and B, into corrcoef, corrcoef will convert them into their vector representation equivalent to corrcoef(A(:), B(:)) or corrcoef([A(:) B(:)]) (https://www.mathworks.com/help/matlab/ref/corrcoef.html#f80-999628-B). Thus, you will get a 2x2 matrix for the correlation coefficients and p-values (https://www.mathworks.com/help/matlab/ref/corrcoef.html#f80-999628-R). You will need to loop over each latitude/longitude and each month (e.g., corrcoef(A(:,ii,jj), A(:,ii,jj+1))) if you are trying to analyze correlation at the perlatitude/longitude level. Otherwise, corrcoef(A(:,:,jj), A(:,:,jj+1)) will yield the correlation coefficients for all latitudes and longitudes across time.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!