Ok, I don't have a solution, but maybe I'm onto something. First, I tried to figure which list elements from bartFit
are plotted on the second plot. You can look at the structure of the bart using str(bartFit)
. It seems that second plot is created from $y
and $yhat.train.mean
, which seems right when you look at it:
plot(bartFit$yhat.train.mean ~ bartFit$y)
but it's obviously missing the bars. So I decided to change the strategy and traceback()
to see how those plots are created. No luck, until I changed the name of x-scale to force an error.
plot(bartFit, xlab="something")
Which gave me only the first plot, error message, but also ability to traceback()
. There, I could see that the second plot is created using:
4: plot.default(x$y, qm, ylim = range(ql, qu), xlab = "y", ylab = "posterior interval for E(Y|x)", ...)
3: plot(x$y, qm, ylim = range(ql, qu), xlab = "y", ylab = "posterior interval for E(Y|x)", ...)
but that's not good. I have no idea what is qm
, or where ylim
ranges come from. So I started playing with par
. There I discovered very, very crude solution to use par
argument mfg
to "force" plotting only the second plot. This will still leave empty space for one plot, but won't plot it. But it behaves strangely as well. Tricky one.
plot(bartFit)
par(mfg=c(1,2))
plot(bartFit)