glm_mverse: Fit generalized linear regression models across the...

View source: R/linear_models.R

glm_mverseR Documentation

Fit generalized linear regression models across the multiverse.

Description

glm_mverse fits glm across the multiverse according to model specifications provided by formula_branch. At least one formula_branch must have been added. You can also specify the underlying error distribution and the link function by adding a family_branch. If no family_branch has been provided, it follows the default behaviour of glm using the Gaussian distribution with an identity link.

Usage

glm_mverse(.mverse, parallel = FALSE, progress = FALSE)

Arguments

.mverse

a mverse object.

parallel

passed to multiverse::execute_multiverse() to indicate whether to execute the multiverse analysis in parallel. Defaults to FALSE.

progress

passed to multiverse::execute_multiverse() to indicate whether to include a progress bar for each step of the execution. Defaults to FALSE.

Value

A mverse object with glm fitted.

See Also

Other model fitting functions: glm.nb_mverse(), lm_mverse()

Examples



# Fitting \code{glm} models across a multiverse.
hurricane_strength <- mutate_branch(
  NDAM,
  HighestWindSpeed,
  Minpressure_Updated_2014
)
hurricane_outliers <- filter_branch(
  !Name %in% c("Katrina", "Audrey", "Andrew"),
  TRUE # include all
)
model_specifications <- formula_branch(
  alldeaths ~ MasFem,
  alldeaths ~ MasFem + hurricane_strength
)
model_distributions <- family_branch(poisson)
mv <- create_multiverse(hurricane) %>%
  add_filter_branch(hurricane_outliers) %>%
  add_mutate_branch(hurricane_strength) %>%
  add_formula_branch(model_specifications) %>%
  add_family_branch(model_distributions) %>%
  glm_mverse()


mverse documentation built on June 21, 2025, 5:09 p.m.