bartModelMatrix {nftbart} | R Documentation |
Deprecated: use bMM instead
Description
Create a matrix out of a vector or data.frame
. The
compiled functions of this package 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.
Usage
bartModelMatrix(X, numcut=0L, usequants=FALSE, type=7, rm.const=FALSE,
cont=FALSE, xicuts=NULL, rm.vars=NULL)
Arguments
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. |
xicuts |
To specify your own cut-points, use the |
rm.vars |
The variables that you want removed. |
Value
If numcut==0
(the default), then a matrix of the
covariates is returned; otherwise, a list is returned with the
following values.
X |
A matrix of the covariates with |
numcut |
A vector of length |
grp |
A vector that corresponds to variables in the input
|
See Also
Examples
## 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 <- bartModelMatrix(df, numcut=9))
## (b <- bartModelMatrix(df, numcut=9, usequants=TRUE))
## Not run:
## this is an error
## f <- bartModelMatrix(as.character(a))
## End(Not run)