preprocess {bonsaiforest}R Documentation

Data Preprocessing

Description

Function to preprocess the data and obtain the design matrices corresponding to a model with just interaction of the covariates with the treatment, to a model with just the main effects and to a model just with the covariates and one-hot encoding.

Usage

preprocess(trt, subgr, covars, data)

Arguments

trt

(string)
the treatment variable name. The treatment variable must be a factor with 2 levels where the first level is the control and the second one the treatment.

subgr

(character)
vector with the name of the subgroup variables from which we want to obtain the subgroup treatment effect.

covars

(character)
vector with the name of the variables that we want to include in the model. The subgr variables have to be included here.

data

(⁠data frame⁠)
the data frame with the variables.

Value

List with design_ia, design_main, design_dummy, subgr_names.

Examples

preprocess("arm", c("x_1", "x_2"), c("x_1", "x_2", "x_3"), example_data)

[Package bonsaiforest version 0.1.0 Index]