autocorrelation: Estimate the Temporal Autocorrelation of a Numeric Vector

View source: R/utils.R

autocorrelationR Documentation

Estimate the Temporal Autocorrelation of a Numeric Vector

Description

A wrapper for the acf function from the stats package that extracts only the temporal autocorrelation at a lag of one timestep (which is the type of temporal autocorrelation that this package simulates). The function omits NA values in the time series.

Usage

autocorrelation(x, biasCorrection = TRUE)

Arguments

x

A numeric vector.

biasCorrection

Autocorrelation estimates are biased for short time series. The function can correct for this bias in the manner proposed by Quenouille (1949). Set to TRUE by default.

Value

A single numeric value: the estimate of the temporal autocorrelation with a lag of 1.

Examples

rednoise <- colored_noise(timesteps = 50, mean = 0.5, sd = 0.2, phi = 0.3)
autocorrelation(rednoise)

japilo/colorednoise documentation built on April 13, 2024, 4:45 p.m.