Skip to contents

Covariance matrix for the estimator of the structural parameters from objects returned by feglm. The covariance is computed from the hessian, the scores, or a combination of both after convergence.

Usage

# S3 method for class 'feglm'
vcov(
  object,
  type = c("hessian", "outer.product", "sandwich", "clustered"),
  ...
)

Arguments

object

an object of class "feglm".

type

the type of covariance estimate required. "hessian" refers to the inverse of the negative expected hessian after convergence and is the default option. "outer.product" is the outer-product-of-the-gradient estimator. "sandwich" is the sandwich estimator (sometimes also referred as robust estimator), and "clustered" computes a clustered covariance matrix given some cluster variables.

...

additional arguments.

Value

A named matrix of covariance estimates.

A named matrix of covariance estimates.

References

Cameron, C., J. Gelbach, and D. Miller (2011). "Robust Inference With Multiway Clustering". Journal of Business & Economic Statistics 29(2).

See also

Examples

# same as the example in feglm but extracting the covariance matrix

# subset trade flows to avoid fitting time warnings during check
set.seed(123)
trade_2006 <- trade_panel[trade_panel$year == 2006, ]
trade_2006 <- trade_2006[sample(nrow(trade_2006), 500), ]

mod <- fepoisson(
  trade ~ log_dist + lang + cntg + clny | exp_year + imp_year | pair,
  trade_2006
)

round(vcov(mod, type = "clustered"), 5)
#>          log_dist     lang     cntg     clny
#> log_dist  1.67116 -1.67416  2.12613  0.63717
#> lang     -1.67416 15.33709 -4.80656 -3.67469
#> cntg      2.12613 -4.80656 19.28607  1.86277
#> clny      0.63717 -3.67469  1.86277  5.02271