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

model_info

Access information from model objects


Description

Retrieve information from model objects.

Usage

model_info(x, ...)

## Default S3 method:
model_info(x, verbose = TRUE, ...)

Arguments

x

A fitted model.

...

Currently not used.

verbose

Toggle off warnings.

Details

model_info() returns a list with information about the model for many different model objects. Following information is returned, where all values starting with is_ are logicals.

  • is_binomial: family is binomial (but not negative binomial)

  • is_bernoulli: special case of binomial models: family is Bernoulli

  • is_poisson: family is poisson

  • is_negbin: family is negative binomial

  • is_count: model is a count model (i.e. family is either poisson or negative binomial)

  • is_beta: family is beta

  • is_betabinomial: family is beta-binomial

  • is_dirichlet: family is dirichlet

  • is_exponential: family is exponential (e.g. Gamma or Weibull)

  • is_logit: model has logit link

  • is_probit: model has probit link

  • is_linear: family is gaussian

  • is_tweedie: family is tweedie

  • is_ordinal: family is ordinal or cumulative link

  • is_cumulative: family is ordinal or cumulative link

  • is_multinomial: family is multinomial or categorical link

  • is_categorical: family is categorical link

  • is_censored: model is a censored model (has a censored response, including survival models)

  • is_truncated: model is a truncated model (has a truncated response)

  • is_survival: model is a survival model

  • is_zero_inflated: model has zero-inflation component

  • is_hurdle: model has zero-inflation component and is a hurdle-model (truncated family distribution)

  • is_dispersion: model has dispersion component

  • is_mixed: model is a mixed effects model (with random effects)

  • is_multivariate: model is a multivariate response model (currently only works for brmsfit objects)

  • is_trial: model response contains additional information about the trials

  • is_bayesian: model is a Bayesian model

  • is_gam: model is a generalized additive model

  • is_anova: model is an Anova object

  • is_ttest: model is an an object of class htest, returned by t.test()

  • is_correlation: model is an an object of class htest, returned by cor.test()

  • is_ranktest: model is an an object of class htest, returned by cor.test() (if Spearman's rank correlation), wilcox.text() or kruskal.test().

  • is_levenetest: model is an an object of class anova, returned by car::leveneTest().

  • is_onewaytest: model is an an object of class htest, returned by oneway.test()

  • is_proptest: model is an an object of class htest, returned by prop.test()

  • is_binomtest: model is an an object of class htest, returned by binom.test()

  • is_chi2test: model is an an object of class htest, returned by chisq.test()

  • is_xtab: model is an an object of class htest or BFBayesFactor, and test-statistic stems from a contingency table (i.e. chisq.test() or BayesFactor::contingencyTableBF()).

  • link_function: the link-function

  • family: the family-object

  • n_obs: number of observations

  • model_terms: a list with all model terms, including terms such as random effects or from zero-inflated model parts.

Value

A list with information about the model, like family, link-function etc. (see 'Details').

Examples

ldose <- rep(0:5, 2)
numdead <- c(1, 4, 9, 13, 18, 20, 0, 2, 6, 10, 12, 16)
sex <- factor(rep(c("M", "F"), c(6, 6)))
SF <- cbind(numdead, numalive = 20 - numdead)
dat <- data.frame(ldose, sex, SF, stringsAsFactors = FALSE)
m <- glm(SF ~ sex * ldose, family = binomial)

model_info(m)
## Not run: 
library(glmmTMB)
data("Salamanders")
m <- glmmTMB(
  count ~ spp + cover + mined + (1 | site),
  ziformula = ~ spp + mined,
  dispformula = ~DOY,
  data = Salamanders,
  family = nbinom2
)

## End(Not run)

model_info(m)

insight

Easy Access to Model Information for Various Model Objects

v0.14.0
GPL-3
Authors
Daniel Lüdecke [aut, cre] (<https://orcid.org/0000-0002-8895-3206>, @strengejacke), Dominique Makowski [aut, ctb] (<https://orcid.org/0000-0001-5375-9967>, @Dom_Makowski), Indrajeet Patil [aut, ctb] (<https://orcid.org/0000-0003-1995-6531>, @patilindrajeets), Philip Waggoner [aut, ctb] (<https://orcid.org/0000-0002-7825-7573>), Mattan S. Ben-Shachar [aut, ctb] (<https://orcid.org/0000-0002-4287-4801>), Brenton M. Wiernik [aut] (<https://orcid.org/0000-0001-9560-6336>, @bmwiernik)
Initial release

We don't support your browser anymore

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