| Title: | WWC-Aligned Baseline Equivalence Tables for Education Impact Evaluations |
|---|---|
| Description: | Produces report-ready baseline equivalence tables for impact evaluations in education research, following the conventions of the What Works Clearinghouse (WWC). Computes standardized mean differences (Hedges' g) between treatment and comparison groups for continuous covariates and classifies each covariate into the WWC baseline-equivalence categories (satisfied, satisfied with statistical adjustment, or not satisfied). |
| Authors: | Yuxia Liang [aut, cre] (ORCID: <https://orcid.org/0009-0008-6489-3836>) |
| Maintainer: | Yuxia Liang <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.5.0 |
| Built: | 2026-06-30 21:31:21 UTC |
| Source: | https://github.com/cran/baselinr |
Computes overall and differential sample attrition for a two-group design, the inputs to the What Works Clearinghouse (WWC) attrition standard. Differential attrition is the absolute difference between the treatment and comparison attrition rates.
attrition(treatment, retained, na.rm = TRUE)attrition(treatment, retained, na.rm = TRUE)
treatment |
Vector identifying group membership; exactly two unique
non-missing values (the larger is treated as the treatment group, as in
|
retained |
Logical (or |
na.rm |
Logical; drop rows where |
This function reports the attrition rates; it does not classify them. Compare the overall and differential rates against the WWC attrition boundary for your chosen response assumption (cautious or optimistic) in the Procedures Handbook.
A one-row data frame with columns attrition_overall,
attrition_treatment, attrition_comparison, and
differential_attrition (all proportions).
What Works Clearinghouse (2022). Procedures Handbook (Version 5.0). U.S. Department of Education.
set.seed(1) g <- rep(c(1, 0), each = 100) kept <- rbinom(200, 1, ifelse(g == 1, 0.9, 0.8)) attrition(g, kept)set.seed(1) g <- rep(c(1, 0), each = 100) kept <- rbinom(200, 1, ifelse(g == 1, 0.9, 0.8)) attrition(g, kept)
Builds a report-ready baseline-equivalence table for a set of covariates, reporting group sample sizes, summaries, the appropriate standardized effect size, and the corresponding What Works Clearinghouse (WWC) equivalence category for each covariate. Continuous covariates use Hedges' g; binary covariates use the Cox index.
baseline_equivalence(data, treatment, covariates = NULL)baseline_equivalence(data, treatment, covariates = NULL)
data |
A data frame. |
treatment |
String naming the column in |
covariates |
Character vector of column names to evaluate. Defaults to
all numeric, logical, and factor columns in |
A covariate with exactly two unique non-missing values is treated as binary; any other numeric covariate is treated as continuous. A non-numeric covariate with more than two categories is not supported and raises an error.
A data frame with one row per covariate and the columns:
covariate; type ("continuous" or "binary"); n_treatment,
n_comparison; mean_treatment, mean_comparison (group means for
continuous covariates, event proportions for binary ones); sd_treatment,
sd_comparison; effect_size (Hedges' g or Cox index, per type); and
wwc_category.
What Works Clearinghouse (2022). Procedures Handbook (Version 5.0). U.S. Department of Education.
df <- data.frame( treat = c(1, 1, 1, 0, 0, 0), pretest = c(5, 6, 7, 4, 5, 6), female = c(1, 0, 1, 0, 0, 1) ) baseline_equivalence(df, treatment = "treat")df <- data.frame( treat = c(1, 1, 1, 0, 0, 0), pretest = c(5, 6, 7, 4, 5, 6), female = c(1, 0, 1, 0, 0, 1) ) baseline_equivalence(df, treatment = "treat")
Computes the What Works Clearinghouse (WWC) Cox index, a standardized effect size for a binary (dichotomous) covariate. The Cox index places the difference between two proportions on a scale comparable to Hedges' g, so it can be classified with the same baseline-equivalence thresholds.
cox_index(x, treatment, na.rm = TRUE)cox_index(x, treatment, na.rm = TRUE)
x |
A binary covariate (numeric |
treatment |
Vector the same length as |
na.rm |
Logical; drop rows where |
The index is , where and are the proportions in the "event"
category for the treatment and comparison groups.
A single numeric value: the Cox index. Returns NA (with a warning)
when a group proportion is exactly 0 or 1, where the index is undefined.
What Works Clearinghouse (2022). Procedures Handbook (Version 5.0). U.S. Department of Education.
x <- c(1, 1, 1, 1, 0, 1, 0, 0) g <- c(1, 1, 1, 1, 0, 0, 0, 0) cox_index(x, g)x <- c(1, 1, 1, 1, 0, 1, 0, 0) g <- c(1, 1, 1, 1, 0, 0, 0, 0) cox_index(x, g)
Renders the result of baseline_equivalence() as a formatted gt table
with rounded statistics and readable column labels. Requires the gt
package.
gt_baseline(equivalence, decimals = 2)gt_baseline(equivalence, decimals = 2)
equivalence |
A data frame returned by |
decimals |
Number of decimal places for the numeric columns. Default 2. |
A gt_tbl object.
if (requireNamespace("gt", quietly = TRUE)) { df <- data.frame( treat = c(1, 1, 1, 0, 0, 0), pretest = c(5, 6, 7, 4, 5, 6), female = c(1, 0, 1, 0, 0, 1) ) tbl <- gt_baseline(baseline_equivalence(df, "treat")) }if (requireNamespace("gt", quietly = TRUE)) { df <- data.frame( treat = c(1, 1, 1, 0, 0, 0), pretest = c(5, 6, 7, 4, 5, 6), female = c(1, 0, 1, 0, 0, 1) ) tbl <- gt_baseline(baseline_equivalence(df, "treat")) }
Computes the standardized mean difference (Hedges' g) between a treatment and a comparison group for a single numeric covariate, using the pooled within-group standard deviation and the small-sample correction factor used by the What Works Clearinghouse (WWC).
hedges_g(x, treatment, na.rm = TRUE)hedges_g(x, treatment, na.rm = TRUE)
x |
Numeric vector of covariate values. |
treatment |
Vector the same length as |
na.rm |
Logical; drop rows where |
The correction factor is , where
.
A single numeric value: Hedges' g. Positive when the treatment group mean exceeds the comparison group mean.
What Works Clearinghouse (2022). Procedures Handbook (Version 5.0). U.S. Department of Education.
x <- c(5, 6, 7, 4, 5, 6) g <- c(1, 1, 1, 0, 0, 0) hedges_g(x, g) # 0.8x <- c(5, 6, 7, 4, 5, 6) g <- c(1, 1, 1, 0, 0, 0) hedges_g(x, g) # 0.8
Plots the standardized effect size for each covariate from
baseline_equivalence(), with reference lines at the What Works
Clearinghouse (WWC) thresholds (0.05 and 0.25) and points coloured by WWC
category. Requires the ggplot2 package.
love_plot(equivalence, signed = FALSE)love_plot(equivalence, signed = FALSE)
equivalence |
A data frame returned by |
signed |
Logical. If |
A ggplot object.
if (requireNamespace("ggplot2", quietly = TRUE)) { df <- data.frame( treat = c(1, 1, 1, 0, 0, 0), pretest = c(5, 6, 7, 4, 5, 6), female = c(1, 0, 1, 0, 0, 1) ) love_plot(baseline_equivalence(df, "treat")) }if (requireNamespace("ggplot2", quietly = TRUE)) { df <- data.frame( treat = c(1, 1, 1, 0, 0, 0), pretest = c(5, 6, 7, 4, 5, 6), female = c(1, 0, 1, 0, 0, 1) ) love_plot(baseline_equivalence(df, "treat")) }
A small, simulated (not real) dataset for demonstrating baseline equivalence assessment in a quasi-experimental education evaluation. It represents 400 students: 200 who received a tutoring program and 200 comparison students who did not, with baseline covariates measured before the program and an outcome measured after. The treatment group is mildly positively selected, so the covariates span all three What Works Clearinghouse equivalence categories.
tutoringtutoring
A data frame with 400 rows and 8 variables:
Treatment indicator: 1 = received tutoring, 0 = comparison.
Baseline reading score (continuous).
Baseline attendance rate, 0-1 (continuous).
Age in years at baseline (continuous).
1 = female, 0 = not (binary).
Eligible for free or reduced-price lunch: 1 = yes (binary).
English language learner: 1 = yes (binary).
Reading score after the program (continuous outcome).
Simulated for package examples with data-raw/tutoring.R; not real
student data.
Maps standardized effect sizes to the three What Works Clearinghouse baseline-equivalence categories. Sign is ignored; classification uses the absolute value of the effect size.
wwc_classify(es)wwc_classify(es)
es |
Numeric vector of standardized effect sizes (e.g. values returned
by |
A character vector the same length as es:
"satisfied" when |es| <= 0.05 (no adjustment needed),
"satisfied_with_adjustment" when 0.05 < |es| <= 0.25
(equivalence holds only if the covariate is adjusted for in the
impact model),
"not_satisfied" when |es| > 0.25.
NA inputs return NA.
What Works Clearinghouse (2022). Procedures Handbook (Version 5.0). U.S. Department of Education.
wwc_classify(c(0.03, 0.12, 0.80))wwc_classify(c(0.03, 0.12, 0.80))
Summarizes a baseline_equivalence() table into a one-row overall
assessment: how many covariates fall in each What Works Clearinghouse (WWC)
category, the largest absolute effect size, and an overall verdict.
wwc_summary(equivalence)wwc_summary(equivalence)
equivalence |
A data frame returned by |
The overall verdict follows the logic of the categories: if any covariate is
"not_satisfied", baseline equivalence cannot be established
("not_satisfied"); otherwise, if any covariate requires adjustment, the
verdict is "satisfied_with_adjustment" (equivalence holds only if those
covariates are adjusted for in the impact model); otherwise "satisfied".
A one-row data frame with columns n_covariates, n_satisfied,
n_satisfied_with_adjustment, n_not_satisfied, max_abs_effect, and
overall.
What Works Clearinghouse (2022). Procedures Handbook (Version 5.0). U.S. Department of Education.
df <- data.frame( treat = c(1, 1, 1, 0, 0, 0), pretest = c(5, 6, 7, 4, 5, 6), female = c(1, 0, 1, 0, 0, 1) ) wwc_summary(baseline_equivalence(df, "treat"))df <- data.frame( treat = c(1, 1, 1, 0, 0, 0), pretest = c(5, 6, 7, 4, 5, 6), female = c(1, 0, 1, 0, 0, 1) ) wwc_summary(baseline_equivalence(df, "treat"))