| diagnose {blockTools} | 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 assignment. |
data |
a dataframe with auxiliary information on assigned units,
including the specified variable suspect.var. |
id.vars |
a required string or vector of two strings specifying which
column(s) of data contain identifying information. |
suspect.var |
a string specifying which column of data
contains the variable suspected of interference or imbalance. |
suspect.range |
a vector defining the range of
suspect.var within which units in different treatment
conditions must fall to be considered suspect. |
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
{tt 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
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))