Learn R Programming

insight (version 1.0.0)

get_statistic: Get statistic associated with estimates

Description

Returns the statistic (t, z, ...) for model estimates. In most cases, this is the related column from coef(summary()).

Usage

get_statistic(x, ...)

# S3 method for default get_statistic(x, column_index = 3, verbose = TRUE, ...)

# S3 method for glmmTMB get_statistic(x, component = "all", ...)

# S3 method for emmGrid get_statistic(x, ci = 0.95, adjust = "none", merge_parameters = FALSE, ...)

# S3 method for gee get_statistic(x, robust = FALSE, ...)

Value

A data frame with the model's parameter names and the related test statistic.

Arguments

x

A model.

...

Currently not used.

column_index

For model objects that have no defined get_statistic() method yet, the default method is called. This method tries to extract the statistic column from coef(summary()), where the index of the column that is being pulled is column_index. Defaults to 3, which is the default statistic column for most models' summary-output.

verbose

Toggle messages and warnings.

component

String, indicating the model component for which parameters should be returned. The default for all models is "all", which returns the requested information for all available model components. Furthermore, there are specific options depending on the model class. component then may be one of:

  • For zero-inflated models (gmmTMB, hurdle, zeroinfl, ...) can also be "conditional" or "zero-inflated". Note that the conditional component is also called count or mean component, depending on the model. glmmTMB also has a "dispersion" component.

  • For models with smooth terms, component = "smooth_terms" returns the test statistic for the smooth terms.

  • For models of class mhurdle, may also be one of "conditional", "zero_inflated", "infrequent_purchase" or "auxiliary".

  • For models of class clm2 or clmm2, may also be "scale".

  • For models of class betareg, betaor or betamfx, may also be "precision". For other *mfx models (logitmfx, betamfx, ...), may also be "marginal".

  • For models of class mvord, may also be "thresholds" or "correlation".

  • For models of class selection, may also be "selection", "outcome" or "auxiliary".

  • For models of class glmx, may also be "extra".

  • For models of class averaging, may also be "full".

ci

Confidence Interval (CI) level. Default to 0.95 (95%). Currently only applies to objects of class emmGrid.

adjust

Character value naming the method used to adjust p-values or confidence intervals. See ?emmeans::summary.emmGrid for details.

merge_parameters

Logical, if TRUE and x has multiple columns for parameter names (like emmGrid objects may have), these are merged into a single parameter column, with parameters names and values as values.

robust

Logical, if TRUE, test statistic based on robust standard errors is returned.

Examples

Run this code
data(mtcars)
m <- lm(mpg ~ wt + cyl + vs, data = mtcars)
get_statistic(m)

Run the code above in your browser using DataLab