Skip to content

Conversation

@a-difabio
Copy link
Contributor

The glmer engine was available only for logistic regression, this PR adds it as an engine for linear_reg().
I tried to follow the code already present for the lmer engine as an example.

@topepo
Copy link
Member

topepo commented Jun 16, 2022

Thanks! It looks fine but we'll have to write in the engine docs that people might expect to get a warning:

library(tidymodels)
library(multilevelmod)

tidymodels_prefer()
theme_set(theme_bw())

data(sleepstudy, package = "lme4")

lmer_spec <- 
  linear_reg() %>% 
  set_engine("glmer")

lmer_fit <- 
  lmer_spec %>% 
  fit(Reaction ~ Days + (1|Subject), data = sleepstudy)
#> Warning in lme4::glmer(formula = Reaction ~ Days + (1 | Subject), data = data, :
#> calling glmer() with family=gaussian (identity link) as a shortcut to lmer() is
#> deprecated; please call lmer() directly

lmer_fit
#> parsnip model object
#> 
#> Linear mixed model fit by REML ['lmerMod']
#> Formula: Reaction ~ Days + (1 | Subject)
#>    Data: data
#> REML criterion at convergence: 1786.465
#> Random effects:
#>  Groups   Name        Std.Dev.
#>  Subject  (Intercept) 37.12   
#>  Residual             30.99   
#> Number of obs: 180, groups:  Subject, 18
#> Fixed Effects:
#> (Intercept)         Days  
#>      251.41        10.47

Created on 2022-06-16 by the reprex package (v2.0.1)

@topepo topepo merged commit a3d98fc into tidymodels:main Jun 16, 2022
@a-difabio a-difabio deleted the glmer-linear-regression branch June 19, 2022 19:21
@github-actions
Copy link

github-actions bot commented Jul 4, 2022

This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants