assg2xBalance: Calculate balance statistics from an assignment object

View source: R/assg2xBalance.R

assg2xBalanceR Documentation

Calculate balance statistics from an assignment object

Description

Calculate several balance statistics for experimental units assigned to treatment conditions. Naturally accepts output from the assignment function, and passes it to xBalance from library(RItools). Provides balance summaries for the entire experiment and by group.

Usage

assg2xBalance(assg.obj, data, id.var, bal.vars, to.report = "all")

Arguments

assg.obj

an output object from assignment.

data

the data frame that was input into block for blocking.

id.var

a string specifying the column of data containing identifying information.

bal.vars

a string or vector of strings specifying which column(s) of data contain the variables on which balance is to be checked.

to.report

a string or vector of strings passed to xBalance listing the measures to report for each group. See Details for more information.

Details

As of RItools version 0.1-11, to.report must be a subset of c("std.diffs","z.scores","adj.means", "adj.mean.diffs","adj.mean.diffs.null.sd", "chisquare.test","p.values", "all"). The default, all, returns all measures.

Value

A list of output objects from xBalance. For each group defined in the assignment object, one list element is assigned the name of that group and summarizes the balance in that group according to to.report. The last element of the list is named "Overall" and summarizes balance across all groups. The elements of this list are themselves objects of class c("xbal", "list").

If assg.obj has only one group, the first element of the output list is named "Group1", and the second is named "Output". In this case, these two elements will be identical.

Author(s)

Ryan T. Moore

References

Hansen, Ben B. and Jake Bowers. 2008. "Covariate balance in simple, stratified and clustered comparative studies". Statistical Science 23(2):219–236.

Bowers, Jake and Mark Fredrickson and Ben Hansen. 2010. "RItools:Randomization Inference Tools". R package version 0.1-11.

Moore, Ryan T. 2012. "Multivariate Continuous Blocking to Improve Political Science Experiments". Political Analysis, 20(4):460–479, Autumn.

See Also

assignment

Examples

data(x100)
b <- block(x100, groups = "g", id.vars = "id", block.vars = c("b1", "b2"))
a <- assignment(b)
axb <- assg2xBalance(a, x100, id.var = "id", bal.vars = c("b1", "b2"))
axb
# axb is a list with 4 elements (one for each of 3 groups, plus one for 'Overall')


blockTools documentation built on Oct. 20, 2024, 1:08 a.m.