bartModelMatrix: Deprecated: use bMM instead

View source: R/bartModelMatrix.R

bartModelMatrixR 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 numcut=0, then just return a matrix; otherwise, return a list.

usequants

If usequants is FALSE, then the cutpoints in xinfo are generated uniformly; otherwise, if TRUE, quantiles are used for the cutpoints.

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 xicuts argument.

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 n rows and p columns.

numcut

A vector of length p of the number of cut-points for each covariate.

grp

A vector that corresponds to variables in the input data.frame that were translated into dummy columns in the output matrix, i.e., for each input variable in order, there is a number in the vector corresponding to the number of output columns created for it.

See Also

bMM

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)

nftbart documentation built on May 1, 2023, 1:08 a.m.