Skip to content

add '-2*log(L)' to anova tidy renamer list#1239

Merged
simonpcouch merged 1 commit into
tidymodels:mainfrom
bbolker:main
Mar 26, 2025
Merged

add '-2*log(L)' to anova tidy renamer list#1239
simonpcouch merged 1 commit into
tidymodels:mainfrom
bbolker:main

Conversation

@bbolker

@bbolker bbolker commented Mar 25, 2025

Copy link
Copy Markdown
Contributor

We recently changed the name "deviance" to "-2*log(L)" in anova output in lme4 ("deviance" is technically incorrect, and confusing, for the value we were actually reporting). This does not affect broom directly, but it affects the cardx package, which calls broom::tidy() on anova() output from lme4. Because "-2*log(L)" isn't in the list of renamers that tidy.anova uses, this now throws a warning (and makes cardx fail its checks).

It's a little hard to implement a test for this change since lme4 is handled by broom.mixed and not broom ... you could do something hacky like this, but I'll leave it up to you to decide if you want to do that.

m <- lm(mpg ~ cyl + hp, mtcars)
aa <- anova(m)
names(aa)[5] <- "-2*log(L)"
expect_no_warning(broom::tidy(aa))

I know pushing out a new release is a hassle, but at least it's been 6 months since the last release and there are some other improvements to include in this release ... do you think you might be able to do this soon ... ?

@alexpghayes

alexpghayes commented Mar 25, 2025 via email

Copy link
Copy Markdown
Collaborator

@bbolker

bbolker commented Mar 25, 2025

Copy link
Copy Markdown
Contributor Author

FWIW what my PR does is to rename "-2*log(L)" and "X.2.log.L." (the name-mangled version) to "minus2logL", which is clunky but is indeed syntactically safe ...

(Our rationale for choosing "-2*log(L)" as the label even though it's syntactically unsafe is that it's hard to think of a short, syntactically safe alternative ...)

@simonpcouch simonpcouch left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Just saw your email as well--happy to get this on CRAN in the coming days.

@simonpcouch simonpcouch merged commit 5dcc8cb into tidymodels:main Mar 26, 2025
@github-actions

Copy link
Copy Markdown

This pull request has been automatically locked. If you believe the issue addressed here persists, please file a new PR (with a reprex: https://reprex.tidyverse.org) and link to this one.

@github-actions github-actions Bot locked and limited conversation to collaborators Apr 10, 2025
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.

3 participants