gamlss-dev / gamlss

gamlss: Generalized Additive Models for Location Scale and Shape
https://CRAN.R-project.org/package=gamlss
10 stars 4 forks source link

Function not working in gamlss #13

Closed pph23 closed 2 weeks ago

pph23 commented 2 weeks ago

'predict.gamlss' function is not working/not available in the current version.

zeileis commented 2 weeks ago

The predict() method for gamlss objects is provided in both the current CRAN and the current development version on R-universe.

library("gamlss")
m <- gamlss(dist ~ pb(speed), data = cars)
## GAMLSS-RS iteration 1: Global Deviance = 411.3478 
## GAMLSS-RS iteration 2: Global Deviance = 411.3478 
predict(m, newdata = data.frame(speed = 20))
## [1] 60.68918

However, the underlying function predict.gamlss is not fully exported and thus you cannot access it directly. It is available in the package, though, and you should call it through the generic predict() as above. If you need to access the source code, you can do so by using the fully-qualified name with the ::: notation:

predict.gamlss
## Error: object 'predict.gamlss' not found
gamlss:::predict.gamlss
## function (object, what = c("mu", "sigma", "nu", "tau"), parameter = NULL, 
##     newdata = NULL, type = c("link", "response", "terms"), terms = NULL, 
##     se.fit = FALSE, data = NULL, ...) 
## {
##     concat <- function(..., names = NULL) {
##         tmp <- list(...)
## [...]