Message Boards Message Boards

Computing cross-correlation functions with R

Posted 2 years ago

Hello everybody!

I'd like to compute a cross-correlation function between two series, and tests the associated correlations. So , I installed the R package testcorr, and tried to use it. Here are the data - X and Y:

{-642.004, 868.033, 2349.77, 495.083, -936.701, -736.624, -1486.5, \
-869.085, -804.311, -1047.68, -2046.03, 1837.88, 460.754, -328.591, \
-1700.7, 1654.02, 1013.84, 708.321, -268.351, -949.075, -512.195, \
678.279, 856.308, -777.521, 59.4771, 84.0603, -1183.99, 135.548, \
408.194, 256.78, -271.863, -720.311, -376.047, -154.643, -430.367, \
-67.3941, 192.493, -493.307, -881.871, 809.421, 865.245, 558.035, \
963.753, 563.865, 2769.64, 26.12, 1621.85, 112.908, 291.257, 1147.36, \
-533.438, -1235.32, -691.728, 3.97176, 532.937, 1864.95, 1738.2, \
552.992, -454.449}

{-0.00998941, 0.0071068, 0.00808673, -0.00404125, -0.00872067, \
-0.00404463, -0.0123207, -0.00179597, -0.0160066, -0.0418455, \
-0.0282053, 0.020036, 0.0267333, 0.0118294, -0.0139968, 0.00918354, \
0.00421741, 0.0043127, -0.0110621, -0.0012861, -0.00504955, \
0.00246591, 0.00140764, -0.00920429, -0.00106081, -0.00479588, \
-0.0137673, -0.00091937, 0.0053697, -0.00370543, -0.00262768, \
-0.00730329, -0.00592445, -0.00449267, -0.00918608, 0.00602736, \
0.00106166, -0.00932159, -0.00636868, 0.0183391, 0.0000588634, 
 1.27043*10^-6, 0.0053536, -0.0015097, 0.0159575, -0.0106661, \
0.00470653, -0.00367833, 0.0000453121, 0.00510883, -0.000102482, \
-0.00290209, -0.00564072, -0.000536546, -0.000153299, 0.00557932, \
0.023456, 0.0215825, -0.0149272}

The program works, but I cannot see the whole result, because page 2 clears page 1...

RSet["x", X];
RSet["y", Y];

REvaluate[
  "cc.test(x, y, max.lag = 10, alpha = 0.05, lambda = 2.576, plot = \
TRUE, table = TRUE, var.name = NULL, scale.font = 1)
  "];

What should I do to see everything?

From another side, I would prefer to keep the issue on a file. I tried

REvaluate["pdf(\"CrossCor.pdf\")
  cc.test(x, y, max.lag = 10, alpha = 0.05, lambda = 2.576, plot = \
TRUE, table = TRUE, var.name = NULL, scale.font = 2)
  dev.off()"];

but something is wrong... Claude

POSTED BY: Claude Mante
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract