vcov.femlm {FENmlm} | R Documentation |
Extract the variance/covariance of a femlm fit
Description
This function extracts the variance-covariance of estimated parameters from a model estimated with femlm
.
Usage
## S3 method for class 'femlm'
vcov(object, se = c("standard", "white", "cluster",
"twoway", "threeway", "fourway"), cluster, dof_correction = FALSE,
forceCovariance = FALSE, keepBounded = FALSE, ...)
Arguments
object |
A femlm object. Obtained using |
se |
Character scalar. Which kind of standard error should be computed: “standard” (default), “White”, “cluster”, “twoway”, “threeway” or “fourway”? |
cluster |
A list of vectors. Used only if |
dof_correction |
Logical, default is |
forceCovariance |
(Advanced users.) Logical, default is |
keepBounded |
(Advanced users.) Logical, default is |
... |
Other arguments to be passed to The computation of the VCOV matrix is first done in |
Value
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 commputed (i.e. was it created using White correction, or was it clustered along a specific factor, etc).
Author(s)
Laurent Berge
See Also
femlm
, summary.femlm
, confint.femlm
, resid.femlm
, predict.femlm
, getFE
.
Examples
# 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)
# "normal" VCOV
vcov(est_pois)
# "white" VCOV
vcov(est_pois, se = "white")
# "clustered" VCOV (with respect to the Origin factor)
vcov(est_pois, se = "cluster")
# "clustered" VCOV (with respect to the Product factor)
vcov(est_pois, se = "cluster", cluster = trade$Product)
# another way to make the same request:
vcov(est_pois, se = "cluster", 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 cluster-vector:
vcov(est_pois_simple, se = "cluster", cluster = trade$Product)