bartModelMatrix {BART} | R Documentation |
The external BART functions operate on matrices in memory. Therefore, if the user submits a vector or data.frame, then this function converts it to a matrix. Also, it determines the number of cutpoints necessary for each column when asked to do so.
bartModelMatrix(X, numcut=0L, usequants=FALSE, type=7, rm.const=FALSE, cont=FALSE, xinfo=NULL)
X |
A vector or data.frame to create the matrix from. |
numcut |
The maximum number of cutpoints to consider.
If |
usequants |
If |
type |
Determines which quantile algorithm is employed. |
rm.const |
Whether or not to remove constant variables. |
cont |
Whether or not to assume all variables are continuous. |
xinfo |
You can provide the cutpoints to BART or let BART
choose them for you. To provide them, use the |
set.seed(99) a <- rbinom(10, 4, 0.4) table(a) x <- runif(10) df <- data.frame(a=factor(a), x=x) b <- bartModelMatrix(df) b b <- bartModelMatrix(df, numcut=9) b b <- bartModelMatrix(df, numcut=9, usequants=TRUE) b ## Not run: f <- bartModelMatrix(as.character(a)) ## End(Not run)