View source: R/assg2xBalance.R
assg2xBalance | R Documentation |
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.
assg2xBalance(assg.obj, data, id.var, bal.vars, to.report = "all")
assg.obj |
an output object from |
data |
the data frame that was input into |
id.var |
a string specifying the column of |
bal.vars |
a string or vector of strings specifying which column(s) of |
to.report |
a string or vector of strings passed to |
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.
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.
Ryan T. Moore
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.
assignment
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')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.