Code used for trend analysis, regression, correlation, and maximum covariance analysis (MCA). ============================ Functions --------- 1. Maximum Covariance Analysis (MCA) - mca.m: Performs Maximum Covariance Analysis between two spatiotemporal fields - Supports area-weighted analysis - Returns spatial patterns, time series, and squared covariance fractions 2. Trend Analysis - field_trend_sen.m: Applies Sen's slope and Mann-Kendall test to spatial fields - trend_sen.m: Implements Sen's slope estimator - mann_kendall.m: Performs Mann-Kendall trend test 3. Regression and Correlation - field_regress.m: Performs linear regression of spatial fields against a time series - corr_auto.m: Calculates correlation with consideration of autocorrelation Dependencies ----------- - MATLAB Statistics Toolbox - All functions should be in the same directory or MATLAB path Usage Examples ------------- 1. Maximum Covariance Analysis: [U_p, V_p, pc_U, pc_V, scf, s2_sum] = mca(data1, data2, n_mca, 'aw', lat1, lon1, lat2, lon2); 2. Trend Analysis: [b, p] = field_trend_sen(data, p_level); 3. Field Regression: [b, p, r] = field_regress(data, index); Notes ----- - Input data should be properly preprocessed (detrended, demeaned if necessary) - For spatial data, dimensions should be organized as (latitude × longitude × time) - Missing values should be represented as NaN