Open ludi94 opened 9 months ago
For GLMs, the response is not standardized.
The default standardization method (refit
) does not standardize factors.
Therefore, in this model, nothing is standardized.
Thank you very much for your fast response and the clarification! Do you know if this is just not implemented or is it more critical to standardize factors in glms compared to lms?
Again, thank you very much!
It is not implemented by design: there is no way to "standardize" a non-numeric variable.
parameters::model_parameters()
has standardize = "basic"
method that standardizes the coefficients by the design matrix. But i don't see that this is implemented here yet, @rempsyc ?
I am just wondering why i get std. values when i use the same data but fitting a lm instead of glm: modell <- lm(anzahl_unfaelle ~ wetter, data = daten) report(modell)
Because for gaussian models, the response is standardized. For GLMs it does not make sense to standardize the response - the scale is not arbitrary, and changing it will qualitatively change the model, and often will just make the model not work (which is not true for gaussian models).
I see! Thanks a lot!
It's not super easy to find, but you can obtain results from different standardization methods using parameters::standardize_parameters()
:
library(easystats)
#> # Attaching packages: easystats 0.7.0
#> ✔ bayestestR 0.13.1.7 ✔ correlation 0.8.4.9000
#> ✔ datawizard 0.9.0.2 ✔ effectsize 0.8.6.3
#> ✔ insight 0.19.6.7 ✔ modelbased 0.8.6.4
#> ✔ performance 0.10.8.1 ✔ parameters 0.21.3.1
#> ✔ report 0.5.7.13 ✔ see 0.8.1
set.seed(123)
anzahl_unfaelle <- rpois(100, lambda = 3) # Lambda ist der erwartete Wert
mean(anzahl_unfaelle)
#> [1] 2.94
var(anzahl_unfaelle)
#> [1] 2.622626
wetter <- factor(sample(c("regnerisch", "bewölkt", "sonnig"), 100, replace = TRUE))
daten <- data.frame(anzahl_unfaelle, wetter)
modell <- glm(anzahl_unfaelle ~ wetter, data = daten, family = "poisson")
standardize_parameters(modell, method = "basic")
#> # Standardization method: basic
#>
#> Parameter | Std. Coef. | 95% CI
#> ---------------------------------------------
#> (Intercept) | 0.00 | [ 0.00, 0.00]
#> wetterregnerisch | 1.96e-03 | [-0.13, 0.13]
#> wettersonnig | 0.03 | [-0.10, 0.16]
#>
#> - Response is unstandardized.
See also the docs here: https://easystats.github.io/parameters/reference/standardize_parameters.html
parameters::model_parameters()
hasstandardize = "basic"
method that standardizes the coefficients by the design matrix. But i don't see that this is implemented here yet, @rempsyc ?
Not AFAIK
Question and context For a specific research question i fitted a generalized linear mixed model using a poisson link function due to the characteristics of my data.
For reporting purposes i used the report package and the report function. However, i noticed that the standardized coefficients and CIs are equal to the normal coefficients and CIs.
Can someone explain why?
I also fitted a glm with poisson to a randomly generated dataset and found the same after running the report(model) function.
Here is a minimal example:
The output:
The effect of wetter [regnerisch] is statistically non-significant and positive (beta = 4.45e-03, 95% CI [-0.29, 0.29], p = 0.976; Std. beta = 4.45e-03, 95% CI [-0.29, 0.29])
➞ beta = std. beta
➞ CI = std. CI
I appreciate any help!
Lukas