You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the report. I can confirm the bug. The newdata is actually found without any problem. But for some reason the predict() method tries to re-evaluate the Call$data from the fitted model and it does so in the wrong environment. Not sure why this is neeeded in the first place. A minimal reproducible example is:
library("gamlss")
pred <- function() {
d <- data.frame(y = sin(1:10), x = 1:10)
m <- gamlss(y ~ x, data = d, family = NO)
predict(m, newdata = d)
}
pred()
## GAMLSS-RS iteration 1: Global Deviance = 20.7488
## GAMLSS-RS iteration 2: Global Deviance = 20.7488
## Error in eval(Call$data) : object 'd' not found
Remark: Using the successor package gamlss2 (not yet on CRAN) the same code works. But the predict() method works a bit differently.
I'm trying to use the predict function within a shiny app and it seems to have a problem with the newdata option:
RStudio 2021.09.0 Build 351
R 4.4.1
gamlss 5.4.22
Not working (predict.gamlss and newdata):
Error:
Working (gamlss, no newdata):
Working (predict.lm, newdata):
The text was updated successfully, but these errors were encountered: