cov_fn: Generate autocorrelation function

Description Usage Arguments Details Value Examples

View source: R/stat_gp.R

Description

Generate autocorrelation function

Usage

1
cov_fn(t, sigma = 4, gamma = 3)

Arguments

t

Vector of time lags.

sigma

Standard deviation for the Gaussian process.

gamma

Parameter co-determining (with sigma) the length of the autocorrelation.

Details

Autocorrelation function for a Gaussian process, defined as sigma^2 * exp(-t^2 / (2 * gamma^2)). To convert covariances to correlations, use cov_fn(t, sigma, gamma) / sigma^2.

Value

Vector of covariances. The duration of the autocorrelation across lags is determined by the ratio of sigma and gamma.

Examples

1
2
3
sig <- 4
plot(cov_fn(1:20, sigma = sig) / sig^2,
     type = 'b', ylim = c(0, 1), ylab = 'correlation', xlab = 'lag')

dalejbarr/autocorr documentation built on March 27, 2021, 3:03 a.m.