max_distance: Maximum Vertical Distance Between Estimated Functions.

View source: R/metrics.R

max_distanceR Documentation

Maximum Vertical Distance Between Estimated Functions.

Description

This function computes the maximum vertical distance between functions.

Usage

max_distance(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 as to whether a plot should be created. By default, no plot is created.

Details

This function computes the maximum vertical distance between functions:

D(\hat{C}_{1}(h), \hat{C}_{2}(h)) = \displaystyle \max_{h} \left| \hat{C}_{1}(h) - \hat{C}_{2}(h) \right| ,

where \hat{C}_{1}(\cdot) and \hat{C}_{2}(\cdot) are estimated autocovariance functions. It assumes that the estimated values are given for the same set of lags. The vectors of the function values must be of the same length.

Value

A numeric value representing the maximum vertical distance between the two estimated functions.

Examples

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

CovEsts documentation built on Sept. 10, 2025, 10:39 a.m.