standard_error_robust(), ci_robust() and p_value_robust() attempt to return indices based on robust estimation of the variance-covariance matrix, using the packages sandwich and clubSandwich.

standard_error_robust(
  model,
  vcov_estimation = "HC",
  vcov_type = NULL,
  vcov_args = NULL,
  ...
)

p_value_robust(
  model,
  vcov_estimation = "HC",
  vcov_type = NULL,
  vcov_args = NULL,
  ...
)

ci_robust(
  model,
  ci = 0.95,
  vcov_estimation = "HC",
  vcov_type = NULL,
  vcov_args = NULL,
  ...
)

Arguments

model

A model.

vcov_estimation

String, indicating the suffix of the vcov*()-function from the sandwich or clubSandwich package, e.g. vcov_estimation = "CL" (which calls vcovCL to compute clustered covariance matrix estimators), or vcov_estimation = "HC" (which calls vcovHC() to compute heteroskedasticity-consistent covariance matrix estimators).

vcov_type

Character vector, specifying the estimation type for the robust covariance matrix estimation (see vcovHC() or clubSandwich::vcovCR() for details).

vcov_args

List of named vectors, used as additional arguments that are passed down to the sandwich-function specified in vcov_estimation.

...

Arguments passed to or from other methods. For standard_error(), if method = "robust", arguments vcov_estimation, vcov_type and vcov_args can be passed down to standard_error_robust().

ci

Confidence Interval (CI) level. Default to 0.95 (95%).

Value

A data frame.

Note

These functions rely on the sandwich or clubSandwich package (the latter if vcov_estimation = "CR" for cluster-robust standard errors) and will thus only work for those models supported by those packages.

Examples

if (require("sandwich")) { # robust standard errors, calling sandwich::vcovHC(type="HC3") by default model <- lm(Petal.Length ~ Sepal.Length * Species, data = iris) standard_error_robust(model) }
#> Loading required package: sandwich
#> Parameter SE #> 1 (Intercept) 0.42486667 #> 2 Sepal.Length 0.08504442 #> 3 Speciesversicolor 0.67252996 #> 4 Speciesvirginica 0.58942889 #> 5 Sepal.Length:Speciesversicolor 0.12045791 #> 6 Sepal.Length:Speciesvirginica 0.10558799
if (require("clubSandwich")) { # cluster-robust standard errors, using clubSandwich iris$cluster <- factor(rep(LETTERS[1:8], length.out = nrow(iris))) standard_error_robust( model, vcov_type = "CR2", vcov_args = list(cluster = iris$cluster) ) }
#> Loading required package: clubSandwich
#> Registered S3 method overwritten by 'clubSandwich': #> method from #> bread.mlm sandwich
#> Parameter SE #> 1 (Intercept) 0.31972491 #> 2 Sepal.Length 0.06451833 #> 3 Speciesversicolor 0.47235519 #> 4 Speciesvirginica 0.34252942 #> 5 Sepal.Length:Speciesversicolor 0.08746672 #> 6 Sepal.Length:Speciesvirginica 0.06624836