R/index.acf.R

Defines functions index.acf

Documented in index.acf

#' @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)
}
SantanderMetGroup/R_VALUE documentation built on July 4, 2023, 4:27 a.m.