#' @title Autocorrelation function
#' @description Function to compute the estimated autocorrelation function at pre-defined lags.
#' @author Neyko Neykov \email{neyko.neykov@@meteo.bg}, J. Bedia, D. San-Mart\'in, S. Herrera
#' @template templateIndexParams
#' @param lag.max Maximum lag considered for acf calculation. Default \code{lag.max = 1}.
#' @return A scalar with the estimated autocorrelation for that lag.
#' @export
index.acf <- function(ts, lag.max = 1){
meanObj <- acf(ts, na.action = na.pass,
plot = FALSE,
lag.max = lag.max,
type = "correlation",
demean = TRUE)
tail(meanObj$acf,1)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.