Learn R Programming

⚠️There's a newer version (0.6.6) of this package.Take me there.

blockTools

R package for Design of Randomized Experiments

blockTools blocks units into experimental blocks with one unit per treatment condition by creating a measure of multivariate distance between all possible pairs of units. Users can set the maximum, minimum, or an allowable range of differences between units on one variable. blockTools also randomly assigns units to treatment conditions, and can diagnose potential interference between units assigned to different treatment conditions. Users can write outputs to .tex and .csv files.

Examples

At the R prompt, type:

# load the example data: 
data(x100) 

# create blocked pairs:
out <- block(x100, id.vars = "id", block.vars = c("b1", "b2")) 

# assign one member of each pair to treatment/control:
assg <- assignment(out) 

# detect unit pairs with different treatment assignments 
#   that are within 1 unit of each other on variable "b1":
diag <- diagnose(assg, x100, id.vars = "id", suspect.var = "b1", suspect.range = c(0,1)) 

To view the results:

# The blocked pairs:
out$blocks 

# The assigned pairs:
assg

# Those pairs with small distances on "b1" between them:
diag

Installation

Install blockTools with

install.packages("blockTools")

If you have access to the private repository, this package can be installed via

devtools::install_github("ryantmoore/blockTools", 
                         auth_token = "<your PAT for this private repo>")

Copy Link

Version

Install

install.packages('blockTools')

Monthly Downloads

529

Version

0.6.5

License

GPL (>= 2) | file LICENSE

Maintainer

Ryan T Moore

Last Published

October 19th, 2024

Functions in blockTools (0.6.5)

outTeX

Export blocked or assigned data to .tex format files
seqblock

Sequential assignment of unit(s) into experimental conditions using covariates
block2seqblock

Prepare prior nonsequential assignments for subsequent sequential assignments
diagnose

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

Export blocked or assigned data to .csv format files
createBlockIDs

Create vector of integers containing block identifiers
assignment

Randomly assign blocked units to treatment conditions
extract_conditions

Create vector of integers containing treatment condition identifiers
blockTools-package

Block, Randomly Assign, and Diagnose Potential Interference in Randomized Experiments
assg2xBalance

Calculate balance statistics from an assignment object
invertRIconfInt

Calculate treatment effect confidence intervals by inverting the randomization test
x100

Simulated data for demonstrating blockTools functionality
block

Block units into homogeneous experimental blocks