diagnose | R Documentation |
List all pairs of units assigned to different treatment conditions whose difference on a specified variable falls within a specified range.
diagnose(object, data, id.vars, suspect.var, suspect.range = NULL)
object |
a dataframe or list of dataframes of assigned units, such as output from |
data |
a dataframe with auxiliary information on assigned units, including the specified variable |
id.vars |
a required string or vector of two strings specifying which column(s) of |
suspect.var |
a string specifying which column of |
suspect.range |
a vector defining the range of |
object
requires rows to correspond to blocks and columns to correspond to treatment conditions, such as output from assignment
.
data
should include identifying variables and variable suspected of interference or imbalance. Typically, data
may be the same dataframe input into block
.
An example of specified identifying variables is id.vars = c("id", "id2")
. Unlike block
, diagnose
requires that the length of id.vars
correspond to the level of the original blocking. See block
documentation for details.
An example of specified suspect range is suspect.var = "b2"
, suspect.range = c(0,50)
identifies all units assigned to different treatment conditions no more than 50 units apart on variable "b2"
.
A list of dataframes, each containing a group's pairs of units assigned to different treatments falling within suspect.range
on the variable suspect.var
. The last column of each dataframe displays the observed difference between the two units.
Ryan T. Moore
assignment
, block
data(x100)
# First, block
out <- block(x100, groups = "g", n.tr = 2, id.vars = c("id"),
block.vars = c("b1", "b2"), algorithm = "optGreedy",
distance = "mahalanobis", level.two = FALSE, valid.var = "b1",
valid.range = c(0,500), verbose = TRUE)
# Second, assign
assg <- assignment(out, seed = 123)
# Third, diagnose
diag <- diagnose(object = assg, data = x100, id.vars = "id",
suspect.var = "b2", suspect.range = c(0,50))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.