BARTr: Fit a bayesian additive regression tree(BART) model for...

Description Usage Arguments Value Author(s) References

View source: R/BARTr.R

Description

Fit a bayesian additive regression tree(BART) model for regression

Usage

1
2
3
4
5
BARTr(X, y, x.test, sigdf = 3, sigquant = 0.9, k = 2, lambda = NA,
  sigest = NA, sigmaf = NA, power = 2, base = 0.95,
  p_split = "CGM", r = 2, ntree = 50, ndpost = 700, nskip = 300,
  Tmin = 2, printevery = 100, p_modify = c(2.5, 2.5, 4)/9,
  save_trees = F, rule = "bart", pre_train = T, n_pre_train = 100)

Arguments

X

training samples by features matrix

y

response

x.test

testing samples by feature matrix

sigdf, sigquant, k, lambda, sigest, sigmaf, power, base

see ?BART::wbart

p_split

choice of 'CGM', 'RS'. 'CGM' splits an internal node with probability base*(1+d)^(-power); 'RS': r^(-d), 2 <= r <= n. d is the depth of an internal node.

r

'RS' splits an internal node with probability r^(-d), 2 <= r <= n. d is the depth of an internal node.

ntree

number of trees

nskip, ndpost

number of burn-in and posterior draws

Tmin

minimum number of samples in a leaf node allowed

printevery

print progress for every 'printevery' iterations

p_modify

proportion of three moves: grow, prune, change.

save_trees

whether save all the trees from each iteration as a list

rule

The splitting rule of an internal node. Choices are: 1. "grp": Gaussian random projection, randomly draw a length p vector from standard normal as the linear combination coefficients of p variables; 2. sgrp: sparse Gaussian random projection, which generates sparse linear combination coefficients; 3. bart: originla bart splits, which are axis-aligned splits; 4. hyperplane: randomly connect two points from the node as the partiton of node space.

pre_train

whether pre-train the BART model using 'bart' rule before switching to another splitting rule.

n_pre_train

number of iterations of pre-train

Value

BARTr returns a list of the following elements.

yhat.train

A matrix with ndpost rows and nrow(X) columns.

yhat.test

A matrix with ndpost rows and nrow(x.test) columns.

yhat.train.mean

Posterior mean of MCMC draws of traning data fits

yhat.test.mean

Posterior mean of MCMC draws of testing data fits

sigma

draws of random error vairaince, length = nskip+ndpost

tree_history

If save_trees = TRUE, then a list of all trees

tree_proposal_total

A ntree by length(p_modify) matrix, the (i,j)th entry is the total number of jth proposal of ith tree

tree_proposal_accept

A ntree by length(p_modify) matrix, the (i,j)th entry is the total number of accepted jth proposal of ith tree

tree_leaf_count

Number of leaf nodes in each tree

Author(s)

Dongyue Xie: dongyxie@gmail.com

References

Chipman, H., George, E., and McCulloch R. (2010) Bayesian Additive Regression Trees. The Annals of Applied Statistics, 4,1, 266-298 <doi:10.1214/09-AOAS285>.


DongyueXie/bCART documentation built on Feb. 4, 2020, 12:26 a.m.