vcov.RdIt extracts the matrix of variances and covariances from gmm or gel objects.
An object of class gmm or gmm returned by the function gmm or gel
If set to TRUE, the covariance matrix of the Lagrange multipliers is produced.
Type of covariance matrix for the meat
A list of arguments to pass to kernHAC
If TRUE, it computes the robust to
misspecification covariance matrix
Other arguments when vcov is applied to another class object
For tsls(), if vcov is set to a different value thand "Classical", a sandwich covariance matrix is computed.
A matrix of variances and covariances
# GMM #
n = 500
phi<-c(.2,.7)
thet <- 0
sd <- .2
x <- matrix(arima.sim(n = n,list(order = c(2,0,1), ar = phi, ma = thet, sd = sd)), ncol = 1)
y <- x[7:n]
ym1 <- x[6:(n-1)]
ym2 <- x[5:(n-2)]
H <- cbind(x[4:(n-3)], x[3:(n-4)], x[2:(n-5)], x[1:(n-6)])
g <- y ~ ym1 + ym2
x <- H
res <- gmm(g, x)
vcov(res)
#> (Intercept) ym1 ym2
#> (Intercept) 0.0030167086 -0.0002188802 -0.000686408
#> ym1 -0.0002188802 0.0019379030 -0.001486345
#> ym2 -0.0006864080 -0.0014863453 0.002234502
## GEL ##
t0 <- c(0,.5,.5)
res <- gel(g, x, t0)
vcov(res)
#> (Intercept) ym1 ym2
#> (Intercept) 0.0024277007 -0.0001820004 -0.0004507665
#> ym1 -0.0001820004 0.0019476920 -0.0015296322
#> ym2 -0.0004507665 -0.0015296322 0.0021093394
vcov(res, lambda = TRUE)
#> Lam((Intercept)) Lam(h1) Lam(h2) Lam(h3)
#> Lam((Intercept)) 0.0000168905 1.063603e-04 1.136954e-04 -1.163313e-04
#> Lam(h1) 0.0001063603 1.173884e-03 2.276777e-04 -1.514140e-03
#> Lam(h2) 0.0001136954 2.276777e-04 1.238226e-03 -2.605773e-05
#> Lam(h3) -0.0001163313 -1.514140e-03 -2.605773e-05 2.012997e-03
#> Lam(h4) -0.0001328265 -6.981608e-05 -1.636578e-03 -2.737010e-04
#> Lam(h4)
#> Lam((Intercept)) -1.328265e-04
#> Lam(h1) -6.981608e-05
#> Lam(h2) -1.636578e-03
#> Lam(h3) -2.737010e-04
#> Lam(h4) 2.210267e-03