blockTools (version 0.6-3)

diagnose: Diagnose whether units assigned to different treatment conditions may be subject to interference or pairwise imbalance

Description

List all pairs of units assigned to different treatment conditions whose difference on a specified variable falls within a specified range.

Usage

diagnose(object, data, id.vars, suspect.var, suspect.range = NULL)

Arguments

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.

Value

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.

Details

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".

See Also

assignment, block

Examples

Run this code
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))

Run the code above in your browser using DataCamp Workspace