smoothG function

Kernel smoothing of a matrix of time series

Kernel smoothing of a matrix of time series

It applies the required kernel smoothing to the moment function in order for the GEL estimator to be valid. It is used by the gel function.

smoothG(x, bw = bwAndrews, prewhite = 1, ar.method = "ols", weights = weightsAndrews, kernel = c("Bartlett", "Parzen", "Truncated", "Tukey-Hanning"), approx = c("AR(1)", "ARMA(1,1)"), tol = 1e-7)

Arguments

  • x: a n×qn\times q matrix of time series, where n is the sample size.
  • bw: The method to compute the bandwidth parameter. By default, it uses the bandwidth proposed by Andrews(1991). As an alternative, we can choose bw=bwNeweyWest (without "") which is proposed by Newey-West(1996).
  • prewhite: logical or integer. Should the estimating functions be prewhitened? If TRUE or greater than 0 a VAR model of order as.integer(prewhite) is fitted via ar with method "ols" and demean = FALSE.
  • ar.method: character. The method argument passed to ar for prewhitening.
  • weights: The smoothing weights can be computed by weightsAndrews of it can be provided manually. If provided, it has to be a r×1r\times 1vector (see details).
  • approx: a character specifying the approximation method if the bandwidth has to be chosen by bwAndrews.
  • tol: numeric. Weights that exceed tol are used for computing the covariance matrix, all other weights are treated as 0.
  • kernel: The choice of kernel

Details

The sample moment conditions t=1ng(θ,xt)\sum_{t=1}^n g(\theta,x_t) is replaced by: t=1ngk(θ,xt)\sum_{t=1}^n g^k(\theta,x_t), where gk(θ,xt)=i=rrk(i)g(θ,xt+i)g^k(\theta,x_t)=\sum_{i=-r}^r k(i) g(\theta,x_{t+i}), where rr is a truncated parameter that depends on the bandwidth and k(i)k(i) are normalized weights so that they sum to 1.

If the vector of weights is provided, it gives only one side weights. For exemple, if you provide the vector (1,.5,.25), k(i)k(i) will become (.25,.5,1,.5,.25)/(.25+.5+1+.5+.25)=(.1,.2,.4,.2,.1)(.25,.5,1,.5,.25)/(.25+.5+1+.5+.25) = (.1,.2,.4,.2,.1)

Returns

smoothx: A q×qq \times q matrix containing an estimator of the asymptotic variance of nxˉ\sqrt{n} \bar{x}, where xˉ\bar{x} is q×1q\times 1vector with typical element xˉi=1nj=1nxji\bar{x}_i = \frac{1}{n}\sum_{j=1}^nx_{ji}. This function is called by gel but can also be used by itself.

kern_weights: Vector of weights used for the smoothing.

References

Anatolyev, S. (2005), GMM, GEL, Serial Correlation, and Asymptotic Bias. Econometrica, 73 , 983-1002.

Andrews DWK (1991), Heteroskedasticity and Autocorrelation Consistent Covariance Matrix Estimation. Econometrica, 59 , 817--858.

Kitamura, Yuichi (1997), Empirical Likelihood Methods With Weakly Dependent Processes. The Annals of Statistics, 25 , 2084-2102.

Zeileis A (2006), Object-oriented Computation of Sandwich Estimators. Journal of Statistical Software, 16 (9), 1--16. URL tools:::Rd_expr_doi("10.18637/jss.v016.i09") .

Examples

g <- function(tet, x) { n <- nrow(x) u <- (x[7:n] - tet[1] - tet[2]*x[6:(n-1)] - tet[3]*x[5:(n-2)]) f <- cbind(u, u*x[4:(n-3)], u*x[3:(n-4)], u*x[2:(n-5)], u*x[1:(n-6)]) return(f) } n = 500 phi<-c(.2, .7) thet <- 0.2 sd <- .2 x <- matrix(arima.sim(n = n, list(order = c(2, 0, 1), ar = phi, ma = thet, sd = sd)), ncol = 1) gt <- g(c(0, phi), x) sgt <- smoothG(gt)$smoothx plot(gt[,1]) lines(sgt[,1])
  • Maintainer: Pierre Chausse
  • License: GPL (>= 2)
  • Last published: 2023-06-06

Useful links