0

I am trying to extract the estimated variance-covariance matrix for specific variables after performing the Sun and Abraham’s estimator. Below is the regression model:

lost = feols(y ~  X1+ X2 + X3 + X4 + sunab(g, year) | id + year, data = impact, "cluster")

For instance, I need to exclude X1 and X2 when extracting the variance-covariance matrix. So, I use the following code:

sigma= vcov(lost, drop=c("X1|X2"))

Unfortunately, the matrix still contains X1 and X2. Any help would be much appreciated.

Ing
  • 1
  • 1
  • I'm not familiar with that package but am not surprised that your drop argument was not succeeding. You attempted to embed a logical operator in a string value. R is not likely to recognize that maneuver since it generally does not parse character values. Have you tried `drop=c("X1", "X2")`. You should also say were you got that package because the CRAN package server says it's not available for recent R systems.. – IRTFM Oct 12 '22 at 16:51
  • Also: I suspect you might be confused about which package is being used. There is a `feols` function in the "fixest" package. HOWEVER, I don't see a drop argument to vcov.fixest function – IRTFM Oct 12 '22 at 16:57
  • @IRTFM, thank you for your quick answer. I am sorry, I am just a beginner in R. I read the package from [here] (https://cran.r-project.org/web/packages/fixest/fixest.pdf). So, you are correct, I use the one from the ```fixest``` package. But, the ```drop``` command worked well when extracting the beta coefficients and the SEs, like ```betahat = coef(lost, drop=c("X1|X2"))``` – Ing Oct 14 '22 at 06:13

1 Answers1

0

You can consider the following approach :

library(fixest)
res <- feols(Sepal.Length ~ Sepal.Width + Sepal.Width ^ 2 + Petal.Length +  Petal.Length ^ 2| Species, iris)
mat_Vcov <- vcov(res)
mat_Vcov[1 : 2, 1 : 2]

                 Sepal.Width     I(Sepal.Width^2)
Sepal.Width       0.08465362     -0.016474490
I(Sepal.Width^2) -0.01647449      0.003265214
Emmanuel Hamel
  • 1,769
  • 7
  • 19