extract_fixed_effects: Extract fixed effects

View source: R/extract_fixed_effects.R

extract_fixed_effectsR Documentation

Extract fixed effects

Description

Extract fixed effects parameters, variance estimates etc.

Usage

extract_fixed_effects(
  model,
  ci_level = 0.95,
  ci_args = NULL,
  digits = 3,
  exponentiate = FALSE,
  ...
)

## S3 method for class 'merMod'
extract_fixed_effects(
  model,
  ci_level = 0.95,
  ci_args = list(method = "Wald"),
  digits = 3,
  exponentiate = FALSE,
  ...,
  p_value = "Wald"
)

## S3 method for class 'glmmTMB'
extract_fixed_effects(
  model,
  ci_level = 0.95,
  ci_args = NULL,
  digits = 3,
  ...,
  exponentiate = FALSE,
  component = "cond"
)

## S3 method for class 'lme'
extract_fixed_effects(
  model,
  ci_level = 0.95,
  ci_args = list(method = "Wald"),
  digits = 3,
  exponentiate = FALSE,
  ...
)

## S3 method for class 'brmsfit'
extract_fixed_effects(
  model,
  ci_level = 0.95,
  ci_args = NULL,
  digits = 3,
  exponentiate = FALSE,
  ...,
  component = NULL
)

## S3 method for class 'stanreg'
extract_fixed_effects(
  model,
  ci_level = 0.95,
  ci_args = NULL,
  digits = 3,
  exponentiate = FALSE,
  ...,
  component = NULL
)

## S3 method for class 'gam'
extract_fixed_effects(
  model,
  ci_level = 0.95,
  ci_args = list(method = "Wald"),
  digits = 3,
  exponentiate = FALSE,
  ...
)

extract_fixef(
  model,
  ci_level = 0.95,
  ci_args = NULL,
  digits = 3,
  exponentiate = FALSE,
  ...
)

Arguments

model

An lme4, glmmTMB, nlme, mgcv, or brms model.

ci_level

Confidence level < 1, typically above 0.90. A value of 0 will not report it (except for gam objects, which will revert to .95 due to gam.vcomp). Default is .95.

ci_args

Additional arguments to the corresponding confint method.

digits

Rounding. Default is 3.

exponentiate

Exponentiate the fixed-effect coefficient estimates and confidence intervals (common for logistic regression). If TRUE, also scales the standard errors by the exponentiated coefficient, transforming them to the new scale.

...

Other stuff to pass to the corresponding method.

p_value

For lme4 models, one of 'Wald' or 'KR'. See details.

component

For glmmTMB objects, which of the three components 'cond' or 'zi' to select. Default is 'cond'. For brmsfit (and experimentally, rstanarm) objects, this can filter results to a certain part of the output, e.g. 'sigma' or 'zi' of distributional models, or a specific outcome of a multivariate model. In this case component is a regular expression that begins parameters of the output.

Details

Essentially duplicates the broom::tidy approach with minor name changes. For lme4, 'Wald' p-values are provided lmer models for consistency with others, but there is much issue with them, especially for low N/small numbers of groups. The Kenward-Roger is also available if the pbkrtest package is installed (experimental). For either case, Only the p-value from the process is provide, all other output is default provided lme4 without adjustment.

Value

A data.frame with the fixed effects and associated statistics.

Note

extract_fixef is an alias.

For nlme, this is just a multiplier based on the estimated standard error and critical value for the ci_level.

See Also

broom.mixed::tidy.merMod(), broom.mixed::tidy.glmmTMB(), broom.mixed::tidy.lme(), broom.mixed::tidy.brmsfit()

Other extract: extract_cor_structure(), extract_het_var(), extract_model_data(), extract_random_coefs(), extract_random_effects(), extract_vc()

Examples

library(lme4)
library(mixedup)

lmer_mod <- lmer(Reaction ~ Days + (1 + Days | Subject), data = sleepstudy)

extract_fixed_effects(lmer_mod)


m-clark/mixedup documentation built on Oct. 15, 2022, 8:55 a.m.