texreg icon indicating copy to clipboard operation
texreg copied to clipboard

Model names when `besides = TRUE` and multiple models are passed

Open dheimgartner opened this issue 1 year ago • 0 comments

Hi,

I've noted a very small issue when using beside = TRUE (e.g., for objects of class zeroinfl as in texreg:::extract.zeroinfl. Usually, multiple models can be passed to the texreg (API) functions and if passed as a named list the names are considered in the output. Alternatively, custom.names can be supplied. However, for multi-part models (e.g., zerofinlated or hurdles) and in combination with beside = TRUE this seems to be buggy.

Here is a reprex:

data("bioChemists", package = "pscl")
fm_zinb2 <- zeroinfl(art ~ . | ., data = bioChemists, dist = "negbin")
# debugonce(texreg:::extract.zeroinfl)
texreg::screenreg(fm_zinb2, beside = TRUE)
texreg::screenreg(list(fm_zinb2, fm_zinb2), beside = TRUE)
texreg::screenreg(list(m1 = fm_zinb2, m2 = fm_zinb2), beside = TRUE)  # buggy
texreg::screenreg(list(fm_zinb2, fm_zinb2), custom.model.names = c("m1 count", "m1 zero", "m2 count", "m2 zero"))  # complains about 4 names passed but only two models

So the bug is that the model names (here m1 and m2) overwrite Count model and Zero model of m1.

Just thought, I make you aware of it but this is not urgent at all.

Thanks for your work!

Best, Daniel

dheimgartner avatar Oct 17 '24 10:10 dheimgartner