# Autocorrelation on a 1D wave

Peeyush Khare

Wed, 05/04/2022 - 08:24 am

Hi,

I am running autocorrelation on a 1D wave and need to get out a graph with the Pearson correlation coefficient on the y-axis and the lag number on the x-axis. I tried the autocorrelation function from the allstatsprocedures library and also correlate/Auto but neither of the two are giving me what I need. I also do not see any outputs in the command window from which I could extract this info after running the library function.

Kindly advise how can I do this.

Thanks a ton!

Peeyush

I think it is important to clearly define what you need:

If you have a single wave and you want to compute the "Pearson correlation coefficient" you will get exactly one number (see the equation for r in the documentation for the StatsCorrelation operation). For one wave only the result is uninteresting as you can see from the equation.

If you want to compute the "autocorrelation" you should look at the Correlate operation with /AUTO flag.

A.G.

May 4, 2022 at 10:20 am - Permalink

Hi A.G.

Thanks for your response and advice. Actually, I need to run autocorrelation on a 1D wave, and create a graph where the y-axis is the correlation coefficient, r, and x-axis is the lag. The intention is to find the index number where the correlation coefficient value transitions from positive to negative, and I basically need to find the last positive correlation coefficient in the autocorrelation process of the 1D wave.

Does this help in clarifying things a little bit?

Sincerely,

Peeyush

May 4, 2022 at 02:19 pm - Permalink

Try the following:

display ddd

Duplicate/O ddd,W_Correlation

Correlate/AUTO ddd, W_Correlation

Display W_Correlation

May 4, 2022 at 02:22 pm - Permalink

Thanks A.G., this did it!

May 16, 2022 at 03:01 am - Permalink

It's actually Correlate/AUTO/NODC that worked for me! Thanks for the help!

May 16, 2022 at 06:39 am - Permalink