autcor: Autocorrelation

autcorR Documentation

Autocorrelation

Description

Estimate autocovariances and autocorrelations.

Usage

autcor(y, lag = NULL, plot = TRUE, lag_axis = TRUE)

Arguments

y

a univariate time series.

lag

maximum lag. Default is 2 \sqrt{n}, where n is the length of the time series y.

plot

logical. If TRUE (default), autocorrelations are plotted.

lag_axis

logical. If TRUE (default) with plot = TRUE, x-axis is drawn.

Value

acov

autocovariances.

acor

autocorrelations (normalized covariances).

mean

mean of y.

References

H.Akaike and T.Nakagawa (1988) Statistical Analysis and Control of Dynamic Systems. Kluwer Academic publishers.

Examples

# Example 1 for the normal distribution 
y <- rnorm(200)
autcor(y, lag_axis = FALSE)

# Example 2 for the ARIMA model
y <- arima.sim(list(order=c(2,0,0), ar=c(0.64,-0.8)), n = 200)
autcor(y, lag = 20)

timsac documentation built on Sept. 30, 2023, 5:06 p.m.