Re: [R] Cross-correlation between two time series data

2006-09-04 Thread Spencer Graves
  'ccf' provides a plot with red, dashed lines indicating an 
approximate 95% threshold for the correlation. 

  Beyond that, with any particular model fit, you can get confidence 
intervals and anova tests for any particular parameter estimated. 

  If neither of these are adequate, I suppose one might be able to 
try Markov Chain Monte Carlo, but I've never used that, so I can't 
comment further on that. 

  If you would like more help from this listserve, please provide 
more detail of your application including commented, minimal, 
self-contained, reproducible code, explaining something you've tried and 
why it is not adequate (as suggested in the posting guide 
www.R-project.org/posting-guide.html). 

  Hope this helps. 
  Spencer Graves

Juni Joshi wrote:
Hi all,

I  have  two  time  series  data  (say  x  and  y). I am interested to
calculate the correlation between them and its confidence interval (or
to  test  no  correlation). Function cor.test(x,y) does the test of no
correlation. But this test probably is wrong because of autocorrelated
data.

ccf()  calculates the correlation between two series data. But it does
not  provide  the  confidence intervals of cross correlation. Is there
any  function  that  calculates the confidence interval of correlation
between  two  time  series data or performs the test of no correlation
between two time series data.

Thanks.

Jun
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Cross-correlation between two time series data

2006-09-04 Thread Andrew Robinson
Jun,

If your interest is to estimate the correlation and either a
confidence interval or a test for no correlation, then you might try
to proceed as follows.  This is a Monte-Carlo significance test, and a
useful strategy.

1) use ccf() to compute the cross-correlation between x and y.

2) repeat the following steps, say, 1000 times.

2a) randomly reorder the values of one of the time series, say x.
Call the randomly reordered series x'. 

2b) use ccf() to compute the cross-correlation between x' and y.
Store that cross-correlation.

3) the 1000 cross-correlation estimates computed in step 2 are all
   estimating cross-correlation 0, conditional on the data.  A
   two-tailed test then is: if the cross-correlation computed in step
   1 is outside the (0.025, 0.975) quantiles of the empirical
   distribution of the cross-correlations computed in step 2, then,
   reject the null hypothesis that x and y are uncorrelated, with size
   0.05.

I hope that this helps.

Andrew


Juni Joshi wrote:
Hi all,

I  have  two  time  series  data  (say  x  and  y). I am interested to
calculate the correlation between them and its confidence interval (or
to  test  no  correlation). Function cor.test(x,y) does the test of no
correlation. But this test probably is wrong because of autocorrelated
data.

ccf()  calculates the correlation between two series data. But it does
not  provide  the  confidence intervals of cross correlation. Is there
any  function  that  calculates the confidence interval of correlation
between  two  time  series data or performs the test of no correlation
between two time series data.

Thanks.

Jun
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


-- 
Andrew Robinson  
Department of Mathematics and StatisticsTel: +61-3-8344-9763
University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599
Email: [EMAIL PROTECTED] http://www.ms.unimelb.edu.au

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Cross-correlation between two time series data

2006-09-04 Thread Spencer Graves
Hi, Andrew: 

  This will produce a permutation distribution for the correlation 
under the null hypothesis of zero correlation between the variables.  
This is a reasonable thing to do, and would probably produce limits more 
accurate than the dashed red lines on the 'ccf' plot.  However, they 
would NOT be confidence interval(s). 

  For a confidence interval on cross correlation, you'd have to 
hypothesize some cross correlation pattern between x and y, preferably 
parameterized parsimoniously, then somehow determine an appropriate 
range of values consistent with the data.  By the time you've done all 
that, you've effectively fit some model and constructed confidence 
intervals on the parameter(s). 

  Best Wishes,
  Spencer

Andrew Robinson wrote:
 Jun,

 If your interest is to estimate the correlation and either a
 confidence interval or a test for no correlation, then you might try
 to proceed as follows.  This is a Monte-Carlo significance test, and a
 useful strategy.

 1) use ccf() to compute the cross-correlation between x and y.

 2) repeat the following steps, say, 1000 times.

 2a) randomly reorder the values of one of the time series, say x.
 Call the randomly reordered series x'. 

 2b) use ccf() to compute the cross-correlation between x' and y.
 Store that cross-correlation.

 3) the 1000 cross-correlation estimates computed in step 2 are all
estimating cross-correlation 0, conditional on the data.  A
two-tailed test then is: if the cross-correlation computed in step
1 is outside the (0.025, 0.975) quantiles of the empirical
distribution of the cross-correlations computed in step 2, then,
reject the null hypothesis that x and y are uncorrelated, with size
0.05.

 I hope that this helps.

 Andrew


 Juni Joshi wrote:
   
Hi all,

I  have  two  time  series  data  (say  x  and  y). I am interested to
calculate the correlation between them and its confidence interval (or
to  test  no  correlation). Function cor.test(x,y) does the test of no
correlation. But this test probably is wrong because of autocorrelated
data.

ccf()  calculates the correlation between two series data. But it does
not  provide  the  confidence intervals of cross correlation. Is there
any  function  that  calculates the confidence interval of correlation
between  two  time  series data or performs the test of no correlation
between two time series data.

Thanks.

Jun
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

 



__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Cross-correlation between two time series data

2006-09-04 Thread Andrew Robinson
Hi Spencer,

you are quite right.  I should have been careful to emphasize that the
strategy I suggested was intended only to produce the test for no
correlation clause of the either a confidence interval or a test for
no correlation sentence.

Cheers

Andrew

On Mon, Sep 04, 2006 at 04:00:44PM -0700, Spencer Graves wrote:
 Hi, Andrew: 
 
  This will produce a permutation distribution for the correlation 
 under the null hypothesis of zero correlation between the variables.  
 This is a reasonable thing to do, and would probably produce limits more 
 accurate than the dashed red lines on the 'ccf' plot.  However, they 
 would NOT be confidence interval(s). 
 
  For a confidence interval on cross correlation, you'd have to 
 hypothesize some cross correlation pattern between x and y, preferably 
 parameterized parsimoniously, then somehow determine an appropriate 
 range of values consistent with the data.  By the time you've done all 
 that, you've effectively fit some model and constructed confidence 
 intervals on the parameter(s). 
 
  Best Wishes,
  Spencer
 
 Andrew Robinson wrote:
 Jun,
 
 If your interest is to estimate the correlation and either a
 confidence interval or a test for no correlation, then you might try
 to proceed as follows.  This is a Monte-Carlo significance test, and a
 useful strategy.
 
 1) use ccf() to compute the cross-correlation between x and y.
 
 2) repeat the following steps, say, 1000 times.
 
 2a) randomly reorder the values of one of the time series, say x.
 Call the randomly reordered series x'. 
 
 2b) use ccf() to compute the cross-correlation between x' and y.
 Store that cross-correlation.
 
 3) the 1000 cross-correlation estimates computed in step 2 are all
estimating cross-correlation 0, conditional on the data.  A
two-tailed test then is: if the cross-correlation computed in step
1 is outside the (0.025, 0.975) quantiles of the empirical
distribution of the cross-correlations computed in step 2, then,
reject the null hypothesis that x and y are uncorrelated, with size
0.05.
 
 I hope that this helps.
 
 Andrew
 
 
 Juni Joshi wrote:
   
Hi all,
 
I  have  two  time  series  data  (say  x  and  y). I am interested to
calculate the correlation between them and its confidence interval (or
to  test  no  correlation). Function cor.test(x,y) does the test of no
correlation. But this test probably is wrong because of autocorrelated
data.
 
ccf()  calculates the correlation between two series data. But it does
not  provide  the  confidence intervals of cross correlation. Is there
any  function  that  calculates the confidence interval of correlation
between  two  time  series data or performs the test of no correlation
between two time series data.
 
Thanks.
 
Jun
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 
 
   

-- 
Andrew Robinson  
Department of Mathematics and StatisticsTel: +61-3-8344-9763
University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599
Email: [EMAIL PROTECTED] http://www.ms.unimelb.edu.au

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Cross-correlation between two time series data

2006-08-29 Thread Juni Joshi

   Hi all,

   I  have  two  time  series  data  (say  x  and  y). I am interested to
   calculate the correlation between them and its confidence interval (or
   to  test  no  correlation). Function cor.test(x,y) does the test of no
   correlation. But this test probably is wrong because of autocorrelated
   data.

   ccf()  calculates the correlation between two series data. But it does
   not  provide  the  confidence intervals of cross correlation. Is there
   any  function  that  calculates the confidence interval of correlation
   between  two  time  series data or performs the test of no correlation
   between two time series data.

   Thanks.

   Jun
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.