kernel_est: Kernel Correction for an Estimated Autocovariance Function.

View source: R/corrected_standard_estimator.R

kernel_estR Documentation

Kernel Correction for an Estimated Autocovariance Function.

Description

This function applies kernel correction to an estimated autocovariance function,

\widehat{C}_{T}^{(a)}(h) = \widehat{C}(h) a_{T}(h),

where a_{T}(h) := a(h / N_{T}). It uses a kernel a(\cdot) which decays or vanishes to zero (depending on the type of kernel) where a(0) = 1. The rate or value at which the kernel vanishes is N_{T}, which is recommended to be of order 0.1 N, where N is the length of the observation window, however, one may need to play with this value.

Usage

kernel_est(
  estCov,
  kernel_name = c("gaussian", "exponential", "wave", "rational_quadratic", "spherical",
    "circular", "bessel_j", "matern", "cauchy"),
  kernel_params = c(),
  N_T = 0.1 * length(estCov),
  maxLag = length(estCov) - 1,
  x = 0:length(estCov),
  type = c("autocovariance", "autocorrelation"),
  custom_kernel = FALSE
)

## S3 method for class 'CovEsts'
kernel_est(
  estCov,
  kernel_name = c("gaussian", "exponential", "wave", "rational_quadratic", "spherical",
    "circular", "bessel_j", "matern", "cauchy"),
  kernel_params = c(),
  N_T = 0.1 * length(estCov$acf),
  maxLag = length(estCov$acf) - 1,
  x = estCov$lags,
  type = c("autocovariance", "autocorrelation"),
  custom_kernel = FALSE
)

## Default S3 method:
kernel_est(
  estCov,
  kernel_name = c("gaussian", "exponential", "wave", "rational_quadratic", "spherical",
    "circular", "bessel_j", "matern", "cauchy"),
  kernel_params = c(),
  N_T = 0.1 * length(estCov),
  maxLag = length(estCov) - 1,
  x = 0:length(estCov),
  type = c("autocovariance", "autocorrelation"),
  custom_kernel = FALSE
)

Arguments

estCov

A vector whose values are an estimate autocovariance function.

kernel_name

The name of the kernel_ec function to be used. Possible values are: gaussian, exponential, wave, rational_quadratic, spherical, circular, bessel_j, matern, cauchy.

kernel_params

A vector of parameters of the kernel function. See kernel_ec for parameters. In the case of gaussian, wave, rational_quadratic, spherical and circular, N_T takes the place of \theta. For kernels that require parameters other than \theta, such as the Matern kernel, those parameters are passed.

N_T

The range at which the kernel function vanishes at. Recommended to be 0.1 N when considering all lags. This parameter may be large for a lag small estimation lag.

maxLag

An optional parameter that determines the maximum lag to compute the estimated autocovariance function at. Defaults to length(estCov) - 1.

x

A vector of lag indices. Defaults to the sequence 0:length(X). Must be at least as large as maxLag + 1.

type

Compute either the 'autocovariance' or 'autocorrelation'. Defaults to 'autocovariance'.

custom_kernel

If a custom kernel is to be used or not. Defaults to FALSE. See the examples of corrected_est for usage.

Value

A vector whose values are the kernel corrected autocovariance estimates or CovEsts S3 object (list) with the following values

acf

A numeric vector containing the autocovariance/autocorrelation estimates.

lags

A numeric vector containing the lag indices used to compute the estimates on, inherited from the argument estCov.

est_type

The type of estimate, namely 'autocorrelation' or 'autocovariance', this depends on the argument type.

est_used

The estimator function used, in this case, 'kernel_est'.

If a numeric vector is given for the argument estCov, then a numeric vector output is given, and if a CovEsts S3 object is given, a CovEsts object is given as output.

Methods (by class)

  • kernel_est(CovEsts): Method for CovEsts objects.

  • kernel_est(default): Method for numeric vectors.

Examples

X <- rnorm(1000)
Y <- c(X[1], X[2])
for(i in 3:length(X)) { Y[i] <- X[i] - 0.3*X[i - 1] - 0.6*X[i - 2] }
cov_est <- standard_est(Y)
plot(cov_est)
plot(kernel_est(cov_est,
     "bessel_j", kernel_params=c(0, 1), N_T=0.2*length(Y)))

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

Related to kernel_est in CovEsts...