balance_table: Creates balance table for the X variables across treatment...

View source: R/balance_table.R

balance_tableR Documentation

Creates balance table for the X variables across treatment status

Description

Creates balance table for the X variables across treatment status

Usage

balance_table(data, treatment)

Arguments

data

A data.frame, tibble or data.table

treatment

a string with treatment status column

Details

balance_table() performs t.test(X~treatment) for each X column in data. Every value of treatment i.e 1,2,3,...N is compared against control value (0) or the first value of the treatment column. For instance, If treatment column has values of (0,1,2,3), balance_table will return: the mean value of each treatment (for all X's), and the p_values of the t.test of (1,2,3) against treatment = 0.

Value

A tibble with Mean_value of each treatment status and p_values

Examples

data <-data.frame(x1 = rnorm(n = 100, mean = 100, sd = 15), 
                  x2=rnorm(n = 100, mean = 65), 
                  treatment = rep(c(0,1,2,3,4), each = 20))
balance_table(data, "treatment")

RCT documentation built on May 13, 2022, 9:06 a.m.