preprocess_df: Preprocess a dataset for use with SoftBart

View source: R/quantile_normalize_bart.R

preprocess_dfR Documentation

Preprocess a dataset for use with SoftBart

Description

Preprocesses a data frame for use with softbart; not needed with other model fitting functions, but may also be useful when designing custom methods with MakeForest. Returns a data matrix X that will work with categorical predictors, and a vector of group indicators; this is required to get sensible variable selection for categorical variables, and should be passed in as the group argument to Hypers.

Usage

preprocess_df(X)

Arguments

X

A data frame, possibly containing categorical variables stored as factors.

Value

A list containing two elements.

  • X: a matrix consisting of the columns of the input data frame, with separate columns for the different levels of categorical variables.

  • group: a vector of group memberships of the predictors in X, to be passed as an argument to Hypers.

Examples

data(iris)
preprocess_df(iris)


SoftBart documentation built on June 8, 2025, 9:40 p.m.