Learn R Programming

colorednoise (version 1.1.1)

autocorrelation: 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)

Value

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

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.

Examples

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

Run the code above in your browser using DataLab