area_between: Area Between Estimated Autocovariance Functions.

View source: R/metrics.R

area_betweenR Documentation

Area Between Estimated Autocovariance Functions.

Description

This function estimates the area between two estimated autocovariance functions.

Usage

area_between(est1, est2, lags = c(), plot = FALSE)

## S3 method for class 'CovEsts'
area_between(est1, est2, lags = c(), plot = FALSE)

## Default S3 method:
area_between(est1, est2, lags = c(), plot = FALSE)

Arguments

est1

A numeric vector representing the first estimated autocovariance function.

est2

A numeric vector of the same length as est1 representing the second estimated autocovariance function

lags

An optional vector of lags starting from 0 up until some other lag. If empty, a vector of lags is created starting from 0 until len(est1) - 1, by 1.

plot

A boolean determining whether a plot should be created. By default, no plot is created.

Details

This function estimates the area between two estimated autocovariance functions over a set of lags, from 0 up to h_{n} defined by

\int_{0}^{h_{n}} \left| \hat{C}_{1}(h) - \hat{C}_{2}(h) \right| dh ,

where \hat{C}_{1}(\cdot) and \hat{C}_{2}(\cdot) are estimated autocovariance functions.

To approximate this integral the trapezoidal rule is used.

If lags is empty, a uniform time grid with a step of 1 will be used which may result in a different area than if lags is specified.

Value

A numeric value representing the estimated area between two estimated autocovariance functions.

Methods (by class)

  • area_between(CovEsts): Method for CovEsts objects.

  • area_between(default): Method for numeric vectors.

Examples

x <- seq(0, 5, by=0.1)
estCov1 <- exp(-x^2)
estCov2 <- exp(-x^2.1)
area_between(estCov1, estCov2, lags=x)
area_between(estCov1, estCov2, lags=x, plot = TRUE)

CovEsts documentation built on April 19, 2026, 5:06 p.m.