Calculates the Kullback-Leibler-divergence-based R2 for generalized linear models.
References
Cameron, A. C. and Windmeijer, A. G. (1997) An R-squared measure of goodness of fit for some common nonlinear regression models. Journal of Econometrics, 77: 329-342.
Examples
model <- glm(vs ~ wt + mpg, data = mtcars, family = "binomial")
r2_kullback(model)
#> Kullback-Leibler R2
#> 0.3834362