Calculate robust standard errors and produce coefficient tablesSource:
This function wraps around several sandwich and lmtest functions to calculate robust standard errors and returns them in a useful format.
get_robust_se( model, type = "HC3", cluster = NULL, data = model.frame(model), vcov = NULL )
A regression model, preferably of class
sandwich::vcovHC()for some more details on these choices. Note that some of these do not work for clustered standard errors (see sandwich::vcovCL()]).
If you want clustered standard errors, either a string naming the column in
datathat represents the clusters or a vector of clusters that is the same length as the number of rows in
The data used to fit the model. Default is to just get the
You may provide the variance-covariance matrix yourself and this function will just calculate standard errors, etc. based on that. Default is NULL.
A list with the following:
coefs: a coefficient table with the estimates, standard errors, t-statistics, and p-values from
ses: The standard errors from
ts: The t-statistics from
ps: The p-values from
type: The argument to
FALSEindicator of whether clusters were used.
cluster: The clusters or name of cluster variable used, if any.
vcov: The robust variance-covariance matrix.