# getLongRunVar: Long-Run Variance In cointReg: Parameter Estimation and Inference in a Cointegrating Regression

## Description

This function computes the long-run variance Omega, the one sided long-run variance Delta (starting with lag 0) and the variance Sigma from an input matrix of residuals.

## Usage

 ```1 2``` ```getLongRunVar(u, bandwidth = c("and", "nw"), kernel = c("ba", "bo", "da", "pa", "qs", "tr"), demeaning = FALSE, check = TRUE, ...) ```

## Arguments

 `u` [`numeric` | `matrix`] Data on which to apply the calculation of the long-run variance. `bandwidth` [`numeric(1)`] The bandwidth to use for calculating the long-run variance as a positive intergerish value. `kernel` [`character(1)`] The kernel function to use for selecting the bandwidth. Default is Bartlett kernel (`"ba"`), see Details for alternatives. `demeaning` [`logical`] Demeaning of the data before the calculation (default is `FALSE`). `check` [`logical`] Wheather to check (and if necessary convert) the arguments. See `checkVars` for further information. `...` Arguments passed to `getBandwidthNW`.

## Details

The bandwidth can be one of the following:

• `"ba"`: Bartlett kernel

• `"bo"`: Bohmann kernel

• `"da"`: Daniell kernel

• `"pa"`: Parzen kernel

• `"qs"`: Quadratic Spectral kernel

• `"tr"`: Truncated kernel

## Value

[`list`] with components:

`Omega` [`matrix`]

Long-run variance matrix

`Delta` [`matrix`]

One-sided long-run variance matrix

`Sigma` [`matrix`]

Variance matrix

`getBandwidth`
 ``` 1 2 3 4 5 6 7 8 9 10``` ```set.seed(1909) x <- rnorm(100) band <- getBandwidthAnd(x, kernel = "ba") getLongRunVar(x, kernel = "ba", bandwidth = band) # shorter: getLongRunVar(x, kernel = "ba", bandwidth = "and") x2 <- arima.sim(model = list(ar = c(0.7, 0.2)), innov = x, n = 100) x2 <- cbind(a = x2, b = x2 + rnorm(100)) getLongRunVar(x2, kernel = "ba", bandwidth = "nw") ```