BalanceR: Balance Check with Standardized Bias

View source: R/BalanceR.R

BalanceRR Documentation

Balance Check with Standardized Bias

Description

Balance check using standardized bias. If SBs are under 3, 5, 10, or 25, you can interprete covariates are balanced between experimental groups.

Usage

BalanceR(data, group, cov)

Arguments

data

Default dataset to use for balance check

group

Default character which indicates experimental group

cov

A vector of covariates name

; binary covariates are automatically converted to dummy variables.

Examples

## Not run: 
# Load a dummy dataset
data(BlcDF)

# Balance check of respondents' gender, age, education level, and marital status.
# A group indicator variable is "Group"
BlcDF %>%
    BalanceR(group = Group,
             cov   = c(Sex, Age, Educ, Marriage))

## Define new names of covariates
BlcDF %>%
    BalanceR(group = Group,
             cov   = c(Gender = Sex, Age, Educ, Marriage))

## Show a result with 4-digits
BlcDF %>%
    BalanceR(group = Group,
             cov   = c(Sex, Age, Educ, Marriage)) %>%
    print(digits = 4)

## Show only standardized biases
BlcDF %>%
    BalanceR(group = Group,
             cov   = c(Sex, Age, Educ, Marriage)) %>%
    print(only.SB = TRUE, digits = 3)

## Show a plot
BlcDF %>%
    BalanceR(group = Group,
             cov   = c(Sex, Age, Educ, Marriage)) %>%
    plot()

## Show a plot with vertical lines
BlcDF %>%
    BalanceR(group = Group,
             cov   = c(Sex, Age, Educ, Marriage)) %>%
    plot(vline = c(3, 5, 10))

## Change text and point sizes
BlcDF %>%
    BalanceR(group = Group,
             cov   = c(Sex, Age, Educ, Marriage)) %>%
    plot(point.size = 3, text.size = 12)

## Display black-white plot
BlcDF %>%
    BalanceR(group = Group,
             cov   = c(Sex, Age, Educ, Marriage)) %>%
    plot(color = FALSE)

## End(Not run)

JaehyunSong/BalanceR documentation built on March 12, 2023, 4:51 p.m.