Learn R Programming

parameters (version 0.17.0)

standard_error: Standard Errors

Description

standard_error() attempts to return standard errors of model parameters

Usage

standard_error(model, ...)

# S3 method for default standard_error( model, component = "all", vcov = NULL, vcov_args = NULL, verbose = TRUE, ... )

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

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

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

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

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

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

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

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

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

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

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

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

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

Arguments

model

A model.

...

Arguments passed to or from other methods.

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.

vcov

Variance-covariance matrix used to compute uncertainty estimates (e.g., for robust standard errors). This argument accepts a covariance matrix, a function which returns a covariance matrix, or a string which identifies the function to be used to compute the covariance matrix.

  • A covariance matrix

  • A function which returns a covariance matrix (e.g., stats::vcov())

  • A string which indicates the kind of uncertainty estimates to return.

    • Heteroskedasticity-consistent: "vcovHC", "HC", "HC0", "HC1", "HC2", "HC3", "HC4", "HC4m", "HC5". See ?sandwich::vcovHC.

    • Cluster-robust: "vcovCR", "CR0", "CR1", "CR1p", "CR1S", "CR2", "CR3". See ?clubSandwich::vcovCR.

    • Bootstrap: "vcovBS", "xy", "residual", "wild", "mammen", "webb". See ?sandwich::vcovBS.

    • Other sandwich package functions: "vcovHAC", "vcovPC", "vcovCL", "vcovPL".

vcov_args

List of arguments to be passed to the function identified by the vcov argument. This function is typically supplied by the sandwich or clubSandwich packages. Please refer to their documentation (e.g., ?sandwich::vcovHAC) to see the list of available arguments.

verbose

Toggle warnings and messages.

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.

method

For linear mixed models, method can be "kenward" or "satterthwaite".

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.

Examples

Run this code
# NOT RUN {
model <- lm(Petal.Length ~ Sepal.Length * Species, data = iris)

standard_error(model)

standard_error(model, vcov = "HC3")

standard_error(model,
               vcov = "vcovCL",
               vcov_args = list(cluster = iris$Species))
# }

Run the code above in your browser using DataLab