Logistic models: Be less verbose by default + be less scary for users with less red #1038
Replies: 22 comments 2 replies
-
The red is just coming from your RStudio no? RStudio uses the same color for all messages, warnings, and errors. |
Beta Was this translation helpful? Give feedback.
-
I don't think these are messages per se, they are just part of the output, so we can specify colors as we often do elsewhere where we print info in yellow |
Beta Was this translation helpful? Give feedback.
-
Second is a message and only shown once per session: Line 909 in 034f5df |
Beta Was this translation helpful? Give feedback.
-
First one is also a message and not shown in red: Line 857 in 034f5df |
Beta Was this translation helpful? Give feedback.
-
I'd vote for:
In general, we should probably take a look at homogenizing outputs / colour schemes, we have sometimes some green, yellow, reds, etc. that we might be using inconsistently. |
Beta Was this translation helpful? Give feedback.
-
What about model info? Yellow, too? |
Beta Was this translation helpful? Give feedback.
-
it's a bit much, white is fine I'd say Maybe we could add a "Note: " before "Uncertainty intervals..." just to suggest to participants that it's not an issue per se that it's just for their information |
Beta Was this translation helpful? Give feedback.
-
But then it's never shown. You can always suppress all information with |
Beta Was this translation helpful? Give feedback.
-
Note that this note is useful for people less familiar with log(it) transformations! See also: library(parameters)
model <- lm(log(mpg) ~ hp, data = mtcars)
model_parameters(model)
#> Parameter | Coefficient | SE | 95% CI | t(30) | p
#> ----------------------------------------------------------------------
#> (Intercept) | 3.46 | 0.08 | [ 3.30, 3.62] | 44.04 | < .001
#> hp | -3.43e-03 | 4.87e-04 | [ 0.00, 0.00] | -7.05 | < .001
#>
#> Uncertainty intervals (equal-tailed) and p-values (two-tailed) computed
#> using a Wald t-distribution approximation.
#>
#> The model has a log-transformed response variable. Consider using
#> `exponentiate = TRUE` to interpret coefficients as ratios. library(parameters)
model <- lm(log(mpg) ~ hp, data = mtcars)
model_parameters(model, exponentiate = TRUE)
#> Parameter | Coefficient | SE | 95% CI | t(30) | p
#> ----------------------------------------------------------------------
#> (Intercept) | 31.83 | 2.50 | [27.11, 37.37] | 44.04 | < .001
#> hp | 1.00 | 4.85e-04 | [ 1.00, 1.00] | -7.05 | < .001
#>
#> Uncertainty intervals (equal-tailed) and p-values (two-tailed) computed
#> using a Wald t-distribution approximation.
#>
#> The model has a log-transformed response variable, and exponentiated
#> parameters are reported. A one-unit increase in the predictor is
#> associated with multiplying the outcome by that predictor's coefficient. |
Beta Was this translation helpful? Give feedback.
-
And yes, your alerting red color is just because you have an RStudio setting that prints messages in red?!? |
Beta Was this translation helpful? Give feedback.
-
Yes but printing this in the output is IMO not the right place for this kind of information 🙃
|
Beta Was this translation helpful? Give feedback.
-
We may remove that messages (though I find them helpful, because I bet there are many users not very familiar with these kind of transformations), I'd say we should at least keep this message (which is a warning about possible modelling/data issues): library(parameters)
d_sep <- data.frame(
y = c(0, 0, 0, 0, 1, 1, 1, 1),
x1 = c(1, 2, 3, 3, 5, 6, 10, 11),
x2 = c(3, 2, -1, -1, 2, 4, 1, 0)
)
m_sep <- suppressWarnings(glm(y ~ x1 + x2, data = d_sep, family = binomial))
model_parameters(m_sep, exponentiate = TRUE)
#> Parameter | Odds Ratio | SE | 95% CI | z | p
#> ----------------------------------------------------------------------
#> (Intercept) | 1.97e-29 | 3.61e-24 | [0.00, Inf] | -3.60e-04 | > .999
#> x1 | 4.36e+06 | 1.19e+11 | [0.00, ] | 5.59e-04 | > .999
#> x2 | 513.31 | 4.19e+07 | [0.00, ] | 7.65e-05 | > .999
#>
#> Uncertainty intervals (profile-likelihood) and p-values (two-tailed)
#> computed using a Wald z-distribution approximation.
#>
#> Some coefficients are very large, which may indicate issues with
#> complete separation. Created on 2024-10-27 with reprex v2.1.1 |
Beta Was this translation helpful? Give feedback.
-
We could move parts of the information into the docs - what would be the best place? I'd say the |
Beta Was this translation helpful? Give feedback.
-
I would prefer to leave the exponentiate message, but print it as regular text (white or yellow) rather than as a |
Beta Was this translation helpful? Give feedback.
-
So we have mixed opinions on this issue. How do we decide? |
Beta Was this translation helpful? Give feedback.
-
Reference Screenshots: https://x.com/strengejacke/status/1850483090109432136
|
Beta Was this translation helpful? Give feedback.
-
the problem of exponentiate is that it might lead to misleading interpretations for models with interactions etc. The last point is fair, and the idea of having a |
Beta Was this translation helpful? Give feedback.
-
@mattansb? also @profandyfield |
Beta Was this translation helpful? Give feedback.
-
The |
Beta Was this translation helpful? Give feedback.
-
I think all of these "tips" should appear as messages/warnings in the |
Beta Was this translation helpful? Give feedback.
-
The "interpretation" message is now moved into the docs - I think it's fine to not show this message. Furthermore, info text is yellow. What remains is the question whether / how (often) we should show the exp-messages. Therefore, I turned this issue into a discussion... |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
All reactions