How to correlate vector and matrix time series?
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Vedanta
am 12 Jan. 2024
Kommentiert: George Abrahams
am 24 Jan. 2024
Hello everyone,
I have two data time-series for five years, one is monthly sea surface temperature (SST) index (1X60) and another one is monthly rainfall in matrix form (180X360X60).
Now I want to correlate this monthly SST index with rainfall of every grid. How can I calculate correlation coefficient between these two data? Outputs should be in matrix form, Correlation Coefficient (180X360) and P-value (180X360).
Thanks.
0 Kommentare
Akzeptierte Antwort
George Abrahams
am 12 Jan. 2024
If you're asking about code only, i.e., not statistical methdology, it would look this:
% Example data. Using a smaller grid size for demonstration.
seaSurfaceTemp = rand( 1, 60 );
rainfall = rand( 3, 5, 60 );
gridSize = size( rainfall, 1:2 );
% Convert rainfall so that the columns are the monthly values for each grid.
rainfall = reshape( rainfall(:), [], length( seaSurfaceTemp ) )';
% For each grid, calculate the Pearson's correlation and p-value between
% seaSurfaceTemp and rainfall.
[ rho, pval ] = corr( seaSurfaceTemp', rainfall );
% Reshape rho and pval back into the grid format.
rho = reshape( rho, gridSize )
pval = reshape( pval, gridSize )
4 Kommentare
George Abrahams
am 24 Jan. 2024
Almost.
- The null hypothesis (
) is that no correlation exists between the two variables, rainfall and sea surface temperature.
- The p-value (p) is the likelihood of seeing a correlation between the two variables purely by random chance, i.e., when no correlation truly exists. Consider if you were to roll a dice 5 times and get the same number each time, it seems likely that the dice is weighted, but it may also just be due to chance. Note that for the Pearson correlation coefficient, corr calculates the p-value with a Student's t-test.
- The significance level (α) is set by you, typically to 5% (0.05) - not 95% as you stated. If
, you are satisfied that the correlation is real, you reject the null hypothesis and the correlation is deemed statistically-signficant, although you can never be 100% certain. If
, there is insufficient evidence to reject the null hypothesis, and you cannot show a statistically-significant correlation.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Hypothesis Tests finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!