Description Usage Arguments Value Examples
View source: R/rbartModelMatrix.R
rbartModelMatrix takes a data frame of explanatory variables (x) and turns it into a numeric matrix suitable for BART. This is used when some of the x variables are factors. The returned matrix will first have columns for all the numeric variables in the data frame and then columns for all the factors expanded into binary dummy variables. Note that if a factor has k levels, then BART wants k dummies (not k-1 as in linear regression). So for example, a factor with two levels named xf, will result in two columns named xf1 and xf2.
1 | rbartModelMatrix(xdf)
|
xdf |
Data frame to be turned into a matrix for BART. |
Matrix from of explanatory variables in the data frame xdf.
1 2 3 4 5 6 7 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.