fastacf | R Documentation |

Compute the ACF of a signal.

```
fastacf (signal, lag.max = length(signal), window = 'hann',
show = TRUE, correct = FALSE)
```

`signal` |
The signal, a numeric vector. |

`lag.max` |
The maximum lag value to be returned. |

`window` |
The type of window to be applied to the signal. Uses the windowfunc() function in this package. For no window select 'rectangular'. |

`show` |
If TRUE, the results are plotted. |

`correct` |
If TRUE, the output is corrected based on the window length and the window function that is applied. |

The autocorrelation function is calculated using the inverse Fourier transform applied to the power spectrum. This leads to much faster calculation times than the acf() function included in the typical R installation. Corrections for window type and length are carried out as described in Boersma (1993).

A dataframe with the following columns:

`lag ` |
Indicates the lag value. |

`acf ` |
Indicates the ACF value at the lag. |

Santiago Barreda <sbarreda@ucdavis.edu>

Boersma, P., (1993). Accurate short-term analysis of the fundamental frequency and the harmonics-to-noise ratio of a sampled sound. Proc. Instit. Phon. Sci. 17: 97-110.

```
## Uncomment and run the code below to see the speed advantage.
## Raising the n makes the difference even more pronounced.
#n = 25000
#system.time ({
#acf (rnorm (n), plot = F, lag.max = n)
#})
#system.time ({
#fastacf (rnorm (n), plot = F, lag.max = n)
#})
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.