vdorie / stan4bart

Uses Stan sampler and math library to semiparametrically fit linear and multilevel models with additive Bayesian Additive Regression Tree (BART) components.
40 stars 4 forks source link

Var list changing size #6

Open jlevy44 opened 2 years ago

jlevy44 commented 2 years ago

I am trying to fit a stan4bart model after the latest update but am getting the following error:

fit <- stan4bart(dx ~ bart(. - dx - history) + history,  dat_new[dat_new$train,],
                 cores = 1, seed = 0,
                 verbose = 1,
                 bart_args=list(keepTrees=T),
                 test=dat_new[!dat_new$train,])
'varlist' has changed (from nvar=9) to new 10 after EncodeVars() -- should no longer happen!
jlevy44 commented 2 years ago

I was able to get this to work by directly converting my data frame into a model matrix and back to a data frame. Perhaps some of the issue could be with factor variable encoding?

vdorie commented 2 years ago

Is this with an install from a recent commit? I made some changes last week to hopefully address this, and I can't recreate it locally.