calculate_acf: Calculate Autocorrelation Function (ACF) or Partial...

View source: R/tseries-acf.R

calculate_acfR Documentation

Calculate Autocorrelation Function (ACF) or Partial Autocorrelation Function (PACF) Values

Description

Wrappers around stats::acf() and stats::pacf() that standardize the inputs and outputs.

Usage

calculate_acf(x, .lags = NULL, .conf = 0.95)

## S3 method for class 'numeric'
calculate_acf(x, .lags = NULL, .conf = 0.95)

calculate_pacf(x, .lags = NULL, .conf = 0.95)

## S3 method for class 'numeric'
calculate_pacf(x, .lags = NULL, .conf = 0.95)

Arguments

x

A numeric vector.

.lags

(Optional) Maximum lag value used in calculations. If omitted, will be limited to one less than the number of observations in x.

.conf

(Optional) Confidence interval coverage probability. Default is for a 95% confidence interval.

Value

A tibble.

See Also

plot_acf() plot_pacf()

Examples

library(tidytest)

set.seed(1914)
x <- rnorm(100)

#> ACF
calculate_acf(x)
calculate_acf(x, .lags = 10, .conf = 0.8)

#> PACF
calculate_pacf(x)
calculate_pacf(x, .lags = 10, .conf = 0.8)


RobbyLankford/tidytest documentation built on Jan. 27, 2024, 7:36 a.m.