## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ----setup--------------------------------------------------------------------
library(baselinr)

## -----------------------------------------------------------------------------
study <- data.frame(
  treat = c(1, 1, 1, 0, 0, 0),
  pretest = c(5, 6, 7, 4, 5, 6), # continuous -> Hedges' g
  female = c(1, 0, 1, 0, 0, 1) # binary     -> Cox index
)

baseline_equivalence(study, treatment = "treat")

## -----------------------------------------------------------------------------
# Standardized mean difference (Hedges' g) for a continuous covariate
hedges_g(study$pretest, study$treat)

# Cox index for a binary covariate
cox_index(study$female, study$treat)

# Classify any effect size(s) into the WWC categories
wwc_classify(c(0.03, 0.12, 0.80))

## ----loveplot, eval = requireNamespace("ggplot2", quietly = TRUE), fig.width = 7, fig.height = 2.6----
love_plot(baseline_equivalence(study, treatment = "treat"))

## ----eval = FALSE-------------------------------------------------------------
# gt_baseline(baseline_equivalence(study, treatment = "treat"))

