table_moderator_c_bin: Auto-Bin a table of a continuous moderating variable into a...

View source: R/plot_moderators.R

table_moderator_c_binR Documentation

Auto-Bin a table of a continuous moderating variable into a discrete moderating variable

Description

Use a regression tree to optimally bin a continuous variable, this function will print out a table with estimates and 95

Usage

table_moderator_c_bin(.model, moderator, .name = "bin")

Arguments

.model

a model produced by 'bartCause::bartc()'

moderator

the moderator as a vector

.name

sting representing the name of the moderating variable

Value

a data.frame object

Author(s)

George Perrett

Examples


data(lalonde)
confounders <- c('age', 'educ', 'black', 'hisp', 'married', 'nodegr')
model_results <- bartCause::bartc(
 response = lalonde[['re78']],
 treatment = lalonde[['treat']],
 confounders = as.matrix(lalonde[, confounders]),
 estimand = 'ate',
 commonSuprule = 'none'
)
table_moderator_c_bin(model_results, lalonde$age, .name = 'age')


joemarlo/plotBart documentation built on May 31, 2024, 12:22 p.m.