Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

p-values for crosscorrelation?

652 views
Skip to first unread message

elsa

unread,
May 23, 2010, 3:43:03 PM5/23/10
to
Hi,

I am elsa and i have problem with my master thesis and i need your support!
I am working with time series analysis. I wanted to calculate the cross-correlation of time series and i used the crosscorr but i don't know how to calculate the p-values for each delay.Somebody told me to calculate p-values with corrcoeff but this gives me only the p-values for delay τ=0.

Please help me.......

Rogelio

unread,
May 23, 2010, 6:21:04 PM5/23/10
to
Hi elsa,
I think what you need is to check wether the crosscorrelation is significant or not at the corresponding lag. You can simply plot the crosscorrelation and you will see some blue lines indicating a 95% confidence inteval, it the red line is above or below the lines it means that it is statistical significant different from zero, and hence there is a correlation. This is based on the asymptotic distribution of the crosscorrelation, namely N(0,1/sqrt(N)) where either one of the process is white noise. Then if you really want pvales, you already now the null distribution so get p vales as 1-normcdf(.).
Hope this help

"EE Student " <n...@cec.wustl.edu> wrote in message <htc36i$e9e$1...@fred.mathworks.com>...
> "elsa " <elsa_si...@hotmail.com> wrote in message <htc0g7$krm$1...@fred.mathworks.com>...

> So what have you tried and where are you stuck? Crosscorrelation seems rather elementry for a masters thesis, and if you are writing your thesis on a subject you ought have exhausted most of your resources and be an expert by now. If your are trying to calculate a normaized crosscorrelation such that the values returned are the correlation coefficients, you could implement a NCC that follows the J.P. Lewis approach presented in his paper found at
>
> http://www.idiom.com/~zilla/Work/nvisionInterface/nip.html
>
> Now in his paper he presents the formula in 2D since it is used for template matching, but it will also work in the 1D case assuming you program it correctly. You may also want to look up what the statistical cross-covaiance is as you may find it useful in your analysis.
>
>

elsa

unread,
May 24, 2010, 3:45:06 AM5/24/10
to
thank you rogelio for your answer!
I want to do exactly this. I know that the cross correlation follows t-student distribution with n-2 degrees of freedom. I want to do a test- hypothesis if the cross correlation is 0 for each delay so my time series are uncorrelated. For &#964;=0 there is
[P B]=corrcoeff(A1,A2) where A1 and A2 is vector time serries,B is a matrix with correlation coefficients, and P is the p-value.And i try to calculate the p-values for the other delays with the crosscorr() but this doesn't calculate the p-values an i try to construct a function for this!

Rogelio

unread,
May 24, 2010, 8:13:05 AM5/24/10
to
ok, which book do you have? where did you read that the crosscorrelation follows a t student distribution?
you dont want to use corrcoeff function, that will compute the sample correlation between two variables. What you want is to compute the crosscorrelation between two variables taking into account the pass of time. Use crosscorr function, and just specify the first 3 inputs. Then let the value of the crosscorrelation be x_h, where h is the lag time, the pvalues that you want are obtained as 1 - tstudentcdf (x_h,n-2). But you need to be aware of what you are doing and how to interprete pvalues. As I mentioned before, by using crosscorr you will get the confidence intervals so you can reject or not the crosscorrelation hypothesis. However, the intervals in matlab, if im not mistaking, are based in a N(0,1/sqrt(N)), the asympthotic distribution of the crosscorrelation.


"elsa " <elsa_si...@hotmail.com> wrote in message <htdaq2$biv$1...@fred.mathworks.com>...

Wayne King

unread,
May 24, 2010, 8:28:07 AM5/24/10
to
"Rogelio" <rogelio.a....@student.bi.no> wrote in message <htdqgh$cvr$1...@fred.mathworks.com>...

Hi, I agree with Rogelio, you want to estimate the cross correlation sequence and place confidence bounds on that sequence as Rogelio suggested. If you don't have the Econometrics toolbox, but have the Signal Processing Toolbox, use xcorr to estimate the cross correlation sequence.

Wayne

elsa

unread,
May 24, 2010, 9:00:26 AM5/24/10
to
ok thanks for your help!

I don't understand why i will take the sequence of cross correlation but i will try to apply. The correlation coefficient is a special case of cross correlation when delay is &#964;=0 and i found on the internet that we transforme to a t-statistic which follows t-student distribution with n-2 degrees of freedom.
really now i am comfused!!

so never mind, thank you for your interest!!

Rogelio

unread,
May 25, 2010, 2:22:06 AM5/25/10
to
Ok, if your are interested in lag h=0 then you can use the first function that you mentioned. But the concept of crosscorrealtion in time series is different to the concept of correlation coefficient between two variables. Since you mentioned that you are working with time series and you used the word crosscorrelation i thought you were interested to different lag values. I suggest you to read a bit about crosscorrelation and correlation coefficient, as well as pvalues, then you can clear your mind and uderstand what you really need for your thesis.

"elsa " <elsa_si...@hotmail.com> wrote in message <htdt9a$ecl$1...@fred.mathworks.com>...

EE Student

unread,
May 23, 2010, 4:29:06 PM5/23/10
to
"elsa " <elsa_si...@hotmail.com> wrote in message <htc0g7$krm$1...@fred.mathworks.com>...

So what have you tried and where are you stuck? Crosscorrelation seems rather elementry for a masters thesis, and if you are writing your thesis on a subject you ought have exhausted most of your resources and be an expert by now. If your are trying to calculate a normaized crosscorrelation such that the values returned are the correlation coefficients, you could implement a NCC that follows the J.P. Lewis approach presented in his paper found at

alexb...@gmail.com

unread,
May 7, 2020, 3:15:17 PM5/7/20
to
This will do it for you:

Alex Backer (2020). xcorrpvalue (https://www.mathworks.com/matlabcentral/fileexchange/75403-xcorrpvalue), MATLAB Central File Exchange.
0 new messages