Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

standard_error

Standard Errors


Description

standard_error() attempts to return standard errors of model parameters, while standard_error_robust() attempts to return robust standard errors.

Usage

standard_error(model, ...)

## Default S3 method:
standard_error(model, method = NULL, verbose = TRUE, ...)

## S3 method for class 'DirichletRegModel'
standard_error(model, component = c("all", "conditional", "precision"), ...)

## S3 method for class 'averaging'
standard_error(model, component = c("conditional", "full"), ...)

## S3 method for class 'factor'
standard_error(model, force = FALSE, verbose = TRUE, ...)

## S3 method for class 'betareg'
standard_error(model, component = c("all", "conditional", "precision"), ...)

## S3 method for class 'glmmTMB'
standard_error(
  model,
  effects = c("fixed", "random"),
  component = c("all", "conditional", "zi", "zero_inflated", "dispersion"),
  verbose = TRUE,
  ...
)

## S3 method for class 'merMod'
standard_error(model, effects = c("fixed", "random"), method = NULL, ...)

## S3 method for class 'poissonmfx'
standard_error(model, component = c("all", "conditional", "marginal"), ...)

## S3 method for class 'betamfx'
standard_error(
  model,
  component = c("all", "conditional", "precision", "marginal"),
  ...
)

## S3 method for class 'MixMod'
standard_error(
  model,
  effects = c("fixed", "random"),
  component = c("all", "conditional", "zi", "zero_inflated"),
  verbose = TRUE,
  ...
)

## S3 method for class 'mixor'
standard_error(model, effects = "all", ...)

## S3 method for class 'clm2'
standard_error(model, component = c("all", "conditional", "scale"), ...)

## S3 method for class 'zeroinfl'
standard_error(
  model,
  component = c("all", "conditional", "zi", "zero_inflated"),
  method = NULL,
  verbose = TRUE,
  ...
)

## S3 method for class 'coxph'
standard_error(model, method = NULL, ...)

Arguments

model

A model.

...

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

If "robust", robust standard errors are computed by calling standard_error_robust(). standard_error_robust(), in turn, calls one of the vcov*()-functions from the sandwich or clubSandwich package for robust covariance matrix estimators. For certain mixed models, method may also be one of "wald", "ml1", "betwithin", "satterthwaite" or "kenward".

verbose

Toggle warnings and messages.

component

Should all parameters, parameters for the conditional model, or for the zero-inflated part of the model be returned? Applies to models with zero-inflated component. component may be one of "conditional", "zi", "zero-inflated", "dispersion" or "all" (default). May be abbreviated.

force

Logical, if TRUE, factors are converted to numerical values to calculate the standard error, with the lowest level being the value 1 (unless the factor has numeric levels, which are converted to the corresponding numeric value). By default, NA is returned for factors or character vectors.

effects

Should standard errors for fixed effects or random effects be returned? Only applies to mixed models. May be abbreviated. When standard errors for random effects are requested, for each grouping factor a list of standard errors (per group level) for random intercepts and slopes is returned.

Value

A data frame with at least two columns: the parameter names and the standard errors. Depending on the model, may also include columns for model components etc.

Note

For Bayesian models (from rstanarm or brms), the standard error is the SD of the posterior samples.

Examples

model <- lm(Petal.Length ~ Sepal.Length * Species, data = iris)
standard_error(model)

parameters

Processing of Model Parameters

v0.13.0
GPL-3
Authors
Daniel Lüdecke [aut, cre] (<https://orcid.org/0000-0002-8895-3206>, @strengejacke), Dominique Makowski [aut] (<https://orcid.org/0000-0001-5375-9967>), Mattan S. Ben-Shachar [aut] (<https://orcid.org/0000-0002-4287-4801>), Indrajeet Patil [aut] (<https://orcid.org/0000-0003-1995-6531>, @patilindrajeets), Søren Højsgaard [aut], Zen J. Lau [ctb], Vincent Arel-Bundock [ctb] (<https://orcid.org/0000-0003-1995-6531>, @vincentab), Jeffrey Girard [ctb] (<https://orcid.org/0000-0002-7359-3746>, @jeffreymgirard)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.