vcov.fixest {fixest} | R Documentation |
femlm
fitThis function extracts the variance-covariance of estimated parameters from a model estimated with femlm
, feols
or feglm
.
## S3 method for class 'fixest' vcov(object, se, cluster, dof = TRUE, exact_dof = FALSE, forceCovariance = FALSE, keepBounded = FALSE, ...)
object |
A |
se |
Character scalar. Which kind of standard error should be computed: “standard”, “White”, “cluster”, “twoway”, “threeway” or “fourway”? By default if there are clusters in the estimation: |
cluster |
Tells how to cluster the standard-errors (if clustering is requested). Can be either a list of vectors, a character vector of variable names, a formula or an integer vector. Assume we want to perform 2-way clustering over |
dof |
Logical, default is |
exact_dof |
Logical, default is |
forceCovariance |
(Advanced users.) Logical, default is |
keepBounded |
(Advanced users – feNmlm with non-linear part and bounded coefficients only.) Logical, default is |
... |
Other arguments to be passed to The computation of the VCOV matrix is first done in |
It returns a N\times N square matrix where N is the number of variables of the fitted model. This matrix has an attribute “type” specifying how this variance/covariance matrix has been computed (i.e. was it created using White correction, or was it clustered along a specific factor, etc).
Laurent Berge
See also the main estimation functions femlm
, feols
or feglm
. summary.fixest
, confint.fixest
, resid.fixest
, predict.fixest
, fixef.fixest
.
# Load trade data data(trade) # We estimate the effect of distance on trade (with 3 fixed-effects) est_pois = femlm(Euros ~ log(dist_km) + log(Year) | Origin + Destination + Product, trade) # By default, in the presence of FEs # the VCOV is clustered along the first FE vcov(est_pois) # "white" VCOV vcov(est_pois, se = "white") # "clustered" VCOV (with respect to the Product factor) vcov(est_pois, se = "cluster", cluster = trade$Product) # another way to make the same request: # note that previously arg. se was optional since deduced from arg. cluster vcov(est_pois, cluster = "Product") # yet another way: vcov(est_pois, cluster = ~Product) # Another estimation without cluster: est_pois_simple = femlm(Euros ~ log(dist_km) + log(Year), trade) # We can still get the clustered VCOV, # but we need to give the argument cluster: vcov(est_pois_simple, cluster = ~Product)