Learn R Programming

blocksdesign (version 1.8)

blocks: Block designs

Description

Constructs randomized nested block designs for unstructured treatment sets where treatments can have any arbitrary levels of replication and blocks can have any arbitrary feasible depth of nesting.

Usage

blocks(treatments, replicates, blocklevels = HCF(replicates),
  searches = max(1, 100 - sum(treatments) - prod(blocklevels)),
  seed = sample(10000, 1), jumps = 1)

Arguments

treatments
treatment numbers that provide a partition of the total required number of treatments into sets of equally replicated treatments.
replicates
replication numbers that provide the replictaion for each set of equally replicated treatments defined by the treatments list.
blocklevels
factor levels that define the number of nested blocks in each succesive blocks stratum taken in order from the highest to the lowest. The default is the hcf of the replication numbers.
searches
maximum number of local optima searched for a design optimization. The default is the maximum of 1 or (100 - total model terms).
seed
integer initializing the random number generator. The default is a random seed.
jumps
number of pairwise random treatment swaps used to escape a local maxima. The default is a single swap.

Value

  • DesignData frame giving the optimized block and treatment factors in plot order
  • PlanData frame giving a plan view of the treatments in the bottom stratum of the design
  • AOVData frame giving a skeleton analysis of variance of the degrees of freedom of the design
  • IncidencesBlocks-by-treatments incidence matrices for each stratum of the design
  • EfficienciesThe achieved A- and D-efficiencies for each stratum of the design together with an A-efficiency upper-bound, where available
  • seedNumerical seed for random number generator
  • searchesMaximum number of searches in each stratum
  • jumpsNumber of random treatment swaps to escape a local maxima

Details

The treatments and replicates parameters partition the treatments design into sets of equally replicated treatments where treatments contains the set sizes and replicates contains the set replication numbers. The sum of the set sizes is the total number of treatments and the sum of the cross-products of the set sizes and the replication numbers is the total number of plots. Treatments are numbered consecutively according to the treatments in the consecutive treatment sets.

The blocklevels parameter contains the numbers of nested blocks in the individual strata taken in order from the highest to the lowest stratum. The first block number is the number of main blocks, the second, if any, is the number of sub-blocks nested in each main block, the third, if any, is the number of sub-sub-blocks nested in each sub-block,and so on for all the reqired strata. If left blank, the default block design is a maximal set of orthogonal main blocks, where the maximal number of of orthogonal main blocks is the highest common factor of the replication numbers.

Whatever the block and treatment design, the block sizes in each stratum are always as equal as possible and never differ by more than a single unit in any particular stratum. If the number of nested blocks in any particular stratum exactly divdes the number of units, the block sizes in that stratum will be exactly equal; otherwise the blocks will differ by a single unit only.

Special square and rectangular lattice designs are constructed algebraically and include all designs that can be constructed from any single latin square, from any complete sets of prime or prime-power orthogonal latin squares or from a pair of orthogonal 10 x 10 Latin squares. All other non-orthogonal block designs are constructed by a D-optimality swapping algorithm that makes improving swaps between blocks until a local optima is atttained. The swapping algorithm works from the top stratum downwards and is always constrained to make improving swaps within the levels of any existing blocks. The whole process will be repeated according to the number of searches defined by the search parameter and the design returned will be the design with the best overall stratum efficiencies in top-down order.

Lattice designs where v is a prime-power require the MOLS package.

The principle design outputs comprise:

  • A design matrix showing the allocation of treatments to blocks with successive nested blocks factors arranged in successive columns in standard block order.
  • A design matrix as above but with the last (bottom) blocks factor shown arranged horizontally to give a plan view.
  • A set of incidence matrices, one for each blocks stratum, showing the number of times each treatment occurs in each block for each stratum.
  • A table showing the achieved D- and A-efficiency factors for each nested blocks stratum together with an A-efficiency upper bound, where available.
  • A table showing a skeleton analysis of degrees of freedom for the combined block and treatment design.

Very occasionally, the algorithm may fail to converge due to a near-singular design with a large number of single plot blocks. In that case, it may be best to build a simpler design with larger blocks and then to add the extra block constraints by hand using ad hoc or heuristic methods.

References

Sailer, M. O. (2013). crossdes: Construction of Crossover Designs. R package version 1.1-1. http://CRAN.R-project.org/package=crossdes

Examples

Run this code
# 3 treatments x 2 replicates, 2 treatments x 4 replicates and 4 treatments x 3 replicates
# the hcf of the replication numbers is 1 therefore the default design is completely randomized
blocks(treatments=c(3,2,4),replicates=c(2,4,3))

# 4 treatments x 4 replicates with 2 main blocks each containing two complete replicates
blocks(treatments=4,replicates=4,blocklevel=2)

# 50 treatments x 4 replicates with 4 main blocks and 5 nested sub-blocks in each main block
blocks(treatments=50,replicates=4,blocklevels=c(4,5))

# as above but with 20 additional single replicate treatments
# giving exactly one single replicate treatment per sub-block
blocks(treatments=c(50,20),replicates=c(4,1),blocklevels=c(4,5))

# 64 treatments x 2 replicates with 2 main blocks and five succesively nested 2-level factors
blocks(treatments=64,replicates=2,blocklevels=c(2,2,2,2,2,2))

# concurrence matrix of balanced incomplete block design
crossprod(blocks(13,4,13,searches=100)$Incidences[[1]])

# concurrence matrix for 13 treatments x 4 replicates and 13 treatments with one rep in 13 blocks
crossprod(blocks(c(13,13),c(4,1),13)$Incidences[[1]])

# 2**10 treatments x 2 replicates in 2**10 blocks giving a fully saturated blocks design
# (requires a considerable time to run!)
d=blocks(1024,2,rep(2,10))

Run the code above in your browser using DataLab