standard_error_robust: Robust estimation

Description Usage Arguments Value Note See Also Examples

View source: R/robust_estimation.R

Description

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.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
standard_error_robust(
  model,
  vcov_estimation = "HC",
  vcov_type = NULL,
  vcov_args = NULL,
  component = "conditional",
  ...
)

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

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

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 sandwich::vcovCL() to compute clustered covariance matrix estimators), or vcov_estimation = "HC" (which calls sandwich::vcovHC() to compute heteroskedasticity-consistent covariance matrix estimators).

vcov_type

Character vector, specifying the estimation type for the robust covariance matrix estimation (see sandwich::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.

component

Should all parameters or parameters for specific model components be returned?

...

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().

method

Method for computing degrees of freedom for confidence intervals (CI) and the related p-values. Allowed are following options (which vary depending on the model class): "residual", "normal", "likelihood", "satterthwaite", "kenward", "wald", "profile", "boot", "uniroot", "ml1", "betwithin", "hdi", "quantile", "ci", "eti", "si", "bci", or "bcai". See section Confidence intervals and approximation of degrees of freedom in model_parameters() for further details.

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.

See Also

Working examples cam be found in this vignette.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
if (require("sandwich", quietly = TRUE)) {
  # robust standard errors, calling sandwich::vcovHC(type="HC3") by default
  model <- lm(Petal.Length ~ Sepal.Length * Species, data = iris)
  standard_error_robust(model)
}
## Not run: 
if (require("clubSandwich", quietly = TRUE)) {
  # 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)
  )
}

## End(Not run)

parameters documentation built on Oct. 19, 2021, 1:07 a.m.