Hi JMP Community,
(W10, 64-bit, JMP Pro 15.2.1)
I'm hoping to find out either what I'm doing wrong, or what I misunderstand about how JMP performs the cross-correlation calculations in the Time Series platform. In short, when I compare the cross correlation of a Sin(x) with a Cos(x) function, I don't get an answer of pi/2 (or 90-degree) as I would expect, I get 79-degrees instead.
I am trying to put together a simplified explanation and description of what the Time Series > Cross-correlation output means for some colleagues. To do that, I have made a simple table with 361 rows (values 0-360, each row is a degree, or 0.01745 radians) and several other columns that calculate the Sin(x), Sin(x-5), Sin(x-45), Cos(x), and a random uniform distribution (see attached table Periodic_series.jmp). The purpose is to demonstrate cross-correlation using simple trig functions that people can understand more directly than a complex time dependent function, like the SeriesJ data set.
If you run the first script in the data table, you get a graph of the trig functions (random uniform is left out on purpose). Everything looks as it should.
You can then run the time-series script, where Sin(x) is the Y input, and the other functions are the Input List columns so that you can do the cross-correlation analysis. Turning the cross correlation output into a data table (see cross-correlation.jmp data table), you can plot the correlation values vs. lag (run first script in this data table).
At first glance, this looks as it should: The cross-correlation of Sin(x) with Sin(x-5) has it's peak near -5, Sin(x) with Sin(x-45) looks to be near -45, and for Sin(x) with Cos(x) is near 90. However, if you use the crosshairs, you'll see that the cross-correlation between Sin(x) and Cos(x) is closer to 80.
In fact, if you run the script: Get lags in the data table, it prints out the lags in the Log window:
"Corr vs. Sin(x-5) lag in deg = [-5]"
"Corr vs. Sin(x-45) lag in deg = [-40]"
"Corr vs. Cos(x) lag in deg = [79]"
"Corr vs. Rondom Uniform lag in deg = [18]"
The only one that is correctly calculated is the lag of -5. Lagging Sin(x) by -45-degrees results in a lag of -40, not -45 as expected. Similarly, with Sin(x) and Cos(x), the lag is 79, when I would expect the value to be 90. I've tried this multiple different ways and with many more rows to see if it's a "resolution" issue, but I keep getting a lag of around 80.
Either the calculation is not returning the right lag, or I'm missing something. I'm guessing I'm missing something, but I'm not sure what it is. I've followed some suggestions from other posts and tried reading up on it in the JMP help here, but I can't find any details of the calculation for the cross-correlation that would explain why a trig function of Sin(x) doesn't have a lag of 90 with Cos(x).
Any thoughts/feedback on this is much appreciated.
Thanks!,
DS