Is the result from xcorr(zsco​re(X),zsco​re(Y), 'coeff') the same as correlation coefficient for each lag position?

조회 수: 6 (최근 30일)
I have 2 data sets (X and Y). Both have different units, so I standardized them by calculating zscores for each data set. I would like to get correlation coefficient (r) between the 2 data sets for each lag position. I'm trying to understand if xcorr(zscore(X),zscore(Y), 'coeff') gives me r for each lag position.
Thank you

채택된 답변

Naman Chaturvedi
Naman Chaturvedi 2018년 9월 14일
Yes, you are correct. It does give the correlation coefficients for the every lag values. By using 'coeff' the following changes are made:-
xcorr(x,y,'coeff') = xcorr(x,y)/(sqrt(sum(abs(x).^2)*sum(abs(y).^2)))
Although, this xcorr(x,y,'coeff') is different from the pearson's definition of corr. coeff. in the sense that it doesn't subtract mean of x and y, your application will give the correct ans as the zscore already performs the normalization.
Check out the documentation for xcorr if you haven't already.
Hope this helps!
  댓글 수: 1
Chalita
Chalita 2018년 9월 15일
Thank you so much for your responses! Your explanation makes sense. I can now be sure that I have correct results.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by