dbarts prediction

Hi everyone,
I am trying to use the predict function using a bart model built with the package dbarts
However, I get an error related to unexpected argument in the formula
My code is really simple

mod_BART<- bart(x.train = dataset[, -2], y.train = dataset[, 1], keeptrees = TRUE)
invisible(mod_BART$fit$state)
predict(mod_BART , newdata = dataset[, -2], type="bart")

I do not understand what I am doing wrong .. I also looked at the documentation of the function ...
Can anyone help me?
image

We would really need a lot mode information, about the predictors, the outcome data, the type of model, what type of predciton you are making, etc. A reprodiucble example (in code, not images) is the best way to get a good answer.

@Max
Sorry you are right ..
This is an example using the PimaIndiansDiabetes2 dataset

(I get the same error)

library(mlbench)     # for PimaIndiansDiabetes2 dataset
library(dbarts)

# load the diabetes dataset
data(PimaIndiansDiabetes2)

PimaIndiansDiabetes2$diabetes<-ifelse(PimaIndiansDiabetes2$diabetes=='pos',1,0)

mod_BART<- dbarts::bart(x.train = PimaIndiansDiabetes2[,-9], # predictors 
                        y.train = PimaIndiansDiabetes2[, 9], # outcome variable
                        keeptrees = TRUE)

invisible(mod_BART$fit$state)
predict(object=mod_BART , newdata=PimaIndiansDiabetes2)

@Max
I found out a solution
I have to call the dbarts predict function explicitly by executing:

dbarts:::predict.bart

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.