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)
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?

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.

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

(I get the same error)

library(mlbench)     # for PimaIndiansDiabetes2 dataset

# load the diabetes dataset


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

predict(object=mod_BART , newdata=PimaIndiansDiabetes2)

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


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.