#| child: aaa.Rmd
#| include: false

r descr_models("logistic_reg", "glm")

Tuning Parameters

This engine has no tuning parameters but you can set the family parameter (and/or link) as an engine argument (see below).

Translation from parsnip to the original package

#| label: glm-reg
logistic_reg() |> 
  set_engine("glm") |> 
  translate()

To use a non-default family and/or link, pass in as an argument to set_engine():

#| label: glm-reg-engine
logistic_reg() |> 
  set_engine("glm", family = stats::binomial(link = "probit")) |> 
  translate()

Preprocessing requirements

#| child: template-makes-dummies.Rmd

Case weights

#| child: template-uses-case-weights.Rmd

However, the documentation in [stats::glm()] assumes that is specific type of case weights are being used:"Non-NULL weights can be used to indicate that different observations have different dispersions (with the values in weights being inversely proportional to the dispersions); or equivalently, when the elements of weights are positive integers w_i, that each response y_i is the mean of w_i unit-weight observations. For a binomial GLM prior weights are used to give the number of trials when the response is the proportion of successes: they would rarely be used for a Poisson GLM."

Saving fitted model objects

#| child: template-butcher.Rmd

Examples

The "Fitting and Predicting with parsnip" article contains examples for logistic_reg() with the "glm" engine.

References



tidymodels/parsnip documentation built on June 2, 2025, 8:10 a.m.