tidy.xbal: 'broom::tidy()'/'glance()' methods for 'balanceTest()'...

View source: R/xbal_tidiers.R

tidy.xbalR Documentation

broom::tidy()/glance() methods for balanceTest() results

Description

Portion out the value of a balanceTest() call in a manner consistent with assumptions of the broom package.

Usage

tidy.xbal(
  x,
  strata = dimnames(x[["results"]])[["strata"]][1],
  varnames_crosswalk = c(z = "statistic", p = "p.value"),
  format = FALSE,
  digits = max(2, getOption("digits") - 4),
  ...
)

glance.xbal(x, strata = dimnames(x[["results"]])[["strata"]][1], ...)

Arguments

x

object of class "xbal", result of balanceTest() or xBalance()

strata

which stratification to return info about? Defaults to last one specified in originating function call (which appears first in the xbal array).

varnames_crosswalk

character vector of new names for xbal columns, named by the xbal column

format

if true, apply ⁠[RItools:::original_units_var_formatter()]⁠ to suitable sub-array en route

digits

passed to ⁠[RItools:::original_units_var_formatter()]⁠

...

Additional arguments passed to ⁠[RItools:::original_units_var_formatter()]⁠

Details

tidy.xbal() gives per-variable statistics whereas glance.xbal() extracts combined-difference related calculations. In both cases one has to specify which stratification one wants statistics about, as xbal objects can store info about several stratifications. tidy.xbal() has a parameter varnames_crosswalk not shared with glance.xbal(). It should be a named character vector, the elements of which give names of columns to be returned and the names of which correspond to columns of xbal objects' ‘results’ entry. Its ordering dictates the order of the result. The default value translates between conventional xbal column names and broom package conventional names.

vars

variable name

Control

mean of LHS variable = 0 group

Treatment

mean of LHS variable = 1 group

adj.diff

T - C diff w/ direct standardization for strata if applicable

std.diff

adj.diff/pooled.sd

pooled.sd

pooled SD

statistic

z column from the xbal object

p.value

p column from the xbal object

Additional parameters beyond those listed here are ignored (at this time).

Value

data frame composed of: for ⁠[RItools::tidy()]⁠, a column of variable labels (vars) and additional columns of balance-related stats; for ⁠[RItools::glance()]⁠, scalars describing a combined differences test, if found, and otherwise NULL.


RItools documentation built on March 31, 2023, 7:17 p.m.