how to perform lag correlation between two spatial data?
10 次查看(过去 30 天)
显示 更早的评论
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 个评论
George Abrahams
2024-1-23
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.
回答(1 个)
Taylor
2024-1-23
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 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!