predict.wbart: Predict new observations with a fitted BART model

View source: R/predict.wbart.R

predict.wbartR Documentation

Predict new observations with a fitted BART model

Description

BART is a Bayesian approach to nonparametric function estimation and inference using a sum of trees.
For a continuous response y and a p-dimensional vector of predictors x = (x_1, ..., x_p)', BART models y and x using

y = f(x) + ε,

where f is a sum of Bayesian regression trees function and ε ~ N(0, σ^2).
This function uses S3 method for the class wbart and is inherited from the CRAN R package 'BART'.

Usage

## S3 method for class 'wbart'
predict(object, newdata, mc.cores = 1, openmp = (mc.cores.openmp() > 0), ...)

Arguments

object

An object of class wbart, returned from the function wbart().

newdata

A matrix of predictors with rows corresponding to new observations.

mc.cores

The number of threads to utilize.

openmp

A Boolean argument dictating whether OpenMP is utilized for parallel processing. This depends on whether OpenMP is available on your system which, by default, is verified with the function mc.cores.openmp().

...

Other arguments passed on to the function pwbart().

Value

Returns a matrix of prediction for newdata, whose rows correspond to draws and columns correspond to observations.

Author(s)

Chuji Luo: cjluo@ufl.edu and Michael J. Daniels: daniels@ufl.edu.

References

Chipman, H. A., George, E. I. and McCulloch, R. E. (2010). "BART: Bayesian additive regression trees." Ann. Appl. Stat. 4 266–298.

Linero, A. R. (2018). "Bayesian regression trees for high-dimensional prediction and variable selection." J. Amer. Statist. Assoc. 113 626–636.

Luo, C. and Daniels, M. J. (2021) "Variable Selection Using Bayesian Additive Regression Trees." arXiv preprint arXiv:2112.13998.

Rockova V, Saha E (2019). “On theory for BART.” In The 22nd International Conference on Artificial Intelligence and Statistics (pp. 2839–2848). PMLR.

Sparapani, R., Spanbauer, C. and McCulloch, R. (2021). "Nonparametric machine learning and efficient computation with bayesian additive regression trees: the BART R package." J. Stat. Softw. 97 1–66.

See Also

pwbart and wbart.

Examples

 
## simulate data (Scenario C.M.1. in Luo and Daniels (2021))
set.seed(123)
data = mixone(100, 10, 1, FALSE)
## run wbart() function
res = wbart(data$X, data$Y, ntree=10, nskip=100, ndpost=100)
## test predict.wbart() function
newdata = mixone(5, 10, 1, FALSE)$X
pred = predict(res, newdata)

BartMixVs documentation built on May 5, 2022, 9:05 a.m.