Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean up and change default naming args for confint/profile #774

Open
bbolker opened this issue Mar 24, 2024 · 1 comment
Open

clean up and change default naming args for confint/profile #774

bbolker opened this issue Mar 24, 2024 · 1 comment

Comments

@bbolker
Copy link
Member

bbolker commented Mar 24, 2024

tl;dr propose to (1) make "new"/interpretable names of random-effect parameters the default for profile/confint, (2) harmonize the argument names across these functions. The main question is: what is the best adjustment/deprecation path for these backward-incompatible changes? (jump to *** for discussion)

At present the default behaviour of confint.merMod and profile.merMod is to use names for the random-effects components .sig01, .sig02, ... and .sigma for the residual variance. This works well with the plotting methods for profile objects — names of this form get [automatically converted to appropriate plotmath expressions] — but they are inscrutable/non-transparent for users.

About 11 years ago we wrote code to produce more informative names (of the form, e.g., sd_(Intercept)|Subject). These are requested by calling confint with oldNames = FALSE or profile with signames = FALSE. There are two problems with this:

  • these options are not particularly visible; I suspect most users don't know about them
  • it's a little weird to have two different argument names doing essentially the same thing in two functions (and using different naming conventions; the horse is way out of the barn, but it would be good to try to define what we thought the naming conventions were for lme4, and gradually adjust things internally and [slower] externally).

We could start by issuing a warning if the signames/oldNames arguments weren't specified explicitly (i.e. by testing missing()). This would be annoying if repeated frequently. Depending on how fancy we want to be, we could warn once per session or every xx hours [see machinery in lifecycle::deprecate_warn — I'm nervous about depending on lifecycle since it's tidyverse-ish, but it only has three non-base reverse dependencies (cli, glue, rlang ...].

We could simultaneously add new arguments (or change one function to be the same as the other) while keeping the old argument in place to allow the warning, e.g. if both functions used oldnames or old.names (either of which would be more consistent with the dominant argument naming convention), we could warn on use of signames/oldNames ...


PS This also exposes a bug/infelicity, namely that confint() inherits the naming setting from profile, even if it's explicitly overridden ...

library(lme4)
fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy)
pp <- profile(fm1, signames = FALSE)
ci <- confint(pp, oldNames = TRUE)
rownames(ci)
[1] "sd_(Intercept)|Subject"       "cor_Days.(Intercept)|Subject"
[3] "sd_Days|Subject"              "sigma"                       
[5] "(Intercept)"                  "Days"     
@jaganmn
Copy link
Contributor

jaganmn commented Apr 25, 2024

You could emulate how Matrix implements once per process deprecation warnings, e.g., C-s warnDeprecatedCoerce in R/zzz.R.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants