Methods for the sandwich::estfun() and sandwich::bread() generics.
These make all variance-covariance estimators in the sandwich package
available for objects of class bgw_mle, e.g., sandwich::sandwich() for
the robust variance-covariance matrix and sandwich::vcovCL() for
clustering at the individual level. The scores must first be added to the
model object using add_scores().
Value
estfun() returns the scores matrix. bread() returns the
variance-covariance matrix multiplied by the number of observations.
Details
Note that the default Hessian approximation in bgw::bgw_mle() is BHHH, in
which case the robust variance-covariance matrix equals vcov(x). Estimate
the model with bgw_settings = list(vcHessianMethod = "finiteDifferences")
to obtain a robust variance-covariance matrix that differs from vcov(x).
Examples
if (FALSE) { # \dontrun{
model <- add_scores(model, log_lik)
sandwich(model)
sandwich(model, adjust = TRUE)
vcovCL(model, cluster = db$id)
} # }