insight
insight copied to clipboard
`get_variance()` reports incorrect variance for `brms` logit models
I think that insight::get_variance() reports the incorrect residual variance for logit models from brms (and possibly other packages). It reports the variance as 1 (which is correct for a probit model), but it should be $\pi^2/3$ for bernoulli or ordered logistic models. Based on some quick detective work, it seems that the source of this problem may be insight:::.compute_variance_distribution(), which uses 1 as the default value. See the following lines:
if (is.null(sig))
sig <- 1
and
else {
dist.variance <- sig
}
Do you have a reproducible example? get_variance() not only includes sigma, but other variance components from mixed models as well. In the case of logistic regression, pi^2/3 is used as distribution-specific variance, see:
https://github.com/easystats/insight/blob/ddb8c4a65d1fa438feae4787cab382486e8933fb/R/compute_variances.R#L504-L515
We have largely revised get_variance(). Feel free to re-open or open a new issue if you still see this problem.