calculate the correlation of a number of time series
이전 댓글 표시
If I have a matrix:
data = rand(365,5);
What is the most appropriate way of calculating the correlation between each column and the mean of the remaining columns. For example, for the first column:
R = nonzeros(tril(corrcoef(data(:,1),mean(data(:,2:end)')'),-1));
How could I repeat this procedure so that I have 5 correlation values i.e. for each series?
채택된 답변
추가 답변 (2개)
bym
2012년 7월 19일
Don't know what you are trying to accomplish, but here is one way
clc; clear
data = rand(365,5);
for k = 1:5
r = corrcoef(data(:,1),mean(data(:,2:end),2));
R(k) = r(2);
data = circshift(data,-1);
end
R
댓글 수: 1
Andrei Bobrov
2012년 7월 20일
data = circshift(data,[0 -1]);
Teja Muppirala
2012년 7월 20일
diag( corr( bsxfun(@minus, sum(data,2), data), data) )
댓글 수: 1
Teja Muppirala
2012년 7월 20일
CORR is from the Statistics Toolbox
카테고리
도움말 센터 및 File Exchange에서 Correlation and Convolution에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!