Calculate variance-covariance matrix for a fitted model object.

# S3 method for splm
vcov(object, ...)

# S3 method for spautor
vcov(object, ...)

# S3 method for spglm
vcov(object, var_correct = TRUE, ...)

# S3 method for spgautor
vcov(object, var_correct = TRUE, ...)

Arguments

object

A fitted model object from splm(), spautor(), spglm(), or spgautor().

...

Other arguments. Not used (needed for generic consistency).

var_correct

A logical indicating whether to return the corrected variance-covariance matrix for models fit using spglm() or spgautor(). The default is TRUE.

Value

The variance-covariance matrix of coefficients obtained via coef(). Currently, only the variance-covariance matrix of the fixed effects is supported.

Examples

spmod <- splm(z ~ water + tarp,
  data = caribou,
  spcov_type = "exponential", xcoord = x, ycoord = y
)
vcov(spmod)
#>              (Intercept)        waterY      tarpnone     tarpshade
#> (Intercept)  0.096679779 -2.079467e-03 -2.849136e-03 -2.725104e-03
#> waterY      -0.002079467  4.158934e-03  4.831252e-17  1.421403e-17
#> tarpnone    -0.002849136  4.831252e-17  6.019454e-03  3.242625e-03
#> tarpshade   -0.002725104  1.421403e-17  3.242625e-03  5.878022e-03