R/CovCorPer.R

Defines functions CovCorPer

Documented in CovCorPer

#' Covariance or correlation matrix from the Per-ACF
#'
#' Wrapper that computes the covariance or correlation matrix of \code{x} at lag 0 obtained from the Per-ACF.
#' @param x a numeric matrix
#' @param type character string giving the type of acf to be computed. Allowed values are "correlation" (the default) or "covariance".
#' @return a numeric matrix
#' @export
#' @examples
#' data.set <- cbind(fdeaths, mdeaths)
#' CovCorPer(data.set)
CovCorPer <- function(x, type = c("correlation", "covariance")) {
  type <- match.arg(type)
  mat.comp <- PerACF(x, lag.max = 1, plot = FALSE, type)$acf
  return(mat.comp[1, , ])
}

Try the acfMPeriod package in your browser

Any scripts or data that you put into this service are public.

acfMPeriod documentation built on July 23, 2019, 5:04 p.m.