How to estimate the Statistical Significance of a Correlation When the Data Are Serially Correlated in matlab?
17 次查看(过去 30 天)
显示 更早的评论
I want to calculate the statistical significance of a computed correlation coefficient when serial correlation is a concern.
I have two variables (var1 and var2). Data is attached.
I have computed lag correlation between the two time series following the standard procedure. Now I want to check whether estimated the correlation is significant or not using a matlab code.
Looking forward to your valuable suggestions.
For your better understanding on the problem you can refer to this paper
0 个评论
回答(1 个)
Scott MacKenzie
2022-3-17
编辑:Scott MacKenzie
2022-3-17
MATLAB's corrcoef function provides the correlation (r) as well as the significance (p) of the correlation. For your data set, the correlation is not significant (p > .05):
M = readmatrix('https://www.mathworks.com/matlabcentral/answers/uploaded_files/930474/DATA.txt');
a = M(:,1);
b = M(:,2);
nanIdx = isnan(a); % seems there are a few nans in a, remove
a = a(~nanIdx);
b = b(~nanIdx);
[r, p] = corrcoef(a,b);
fprintf('r=%.4f, p=%.4f\n', r(1,2), p(1,2));
2 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Descriptive Statistics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!