ggpredict doesn't work for vglm models where multiple.responses = TRUE
B0ydT opened this issue · 1 comments
B0ydT commented
I've been messing around with multivariate models in the 'VGAM' package, and have had some trouble with ggeffects
as illustrated:
library(VGAM)
library(ggeffects)
data("hunua")
shunua <- hunua[sort.list(with(hunua, altitude)), ]
fit <- vglm(cbind(agaaus, kniexc) ~ altitude,
binomialff(multiple.responses = TRUE), data = shunua)
ggpredict(fit, "altitude [all]")
# Error in `$<-.data.frame`(`*tmp*`, "predicted", value = c(0.217797358721427, :
# replacement has 128 rows, data has 64
I've got it working locally with some minor changes to get_predictions_vglm
(checking if multiple responses are expected) and will submit a PR shortly. I aimed to only change the behaviour where multiple.responses = TRUE
, but I'm still quite new to VGAM
so I'm more than happy to make any suggested changes as necessary.
Thanks for your time if you get a chance to look at this, and thanks for an awesome package regardless!
strengejacke commented
I added a test, let's see if this passes.