Title: | Incomplete Block Designs |
---|---|
Description: | A collection of several utility functions related to binary incomplete block designs. Contains function to generate A- and D-efficient binary incomplete block designs with given numbers of treatments, number of blocks and block size. Contains function to generate an incomplete block design with specified concurrence matrix. There are functions to generate balanced treatment incomplete block designs and incomplete block designs for test versus control treatments comparisons with specified concurrence matrix. Allows performing analysis of variance of data and computing estimated marginal means of factors from experiments using a connected incomplete block design. Tests of hypothesis of treatment contrasts in incomplete block design set up is supported. |
Authors: | B N Mandal [aut, cre] |
Maintainer: | B N Mandal <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.6 |
Built: | 2024-11-01 05:40:09 UTC |
Source: | https://github.com/cran/ibd |
Computes lower bound to A-efficiency of a binary incomplete block design. Treatment by block incidence matrix of the design is to be supplied as input to the function.
A_eff(N)
A_eff(N)
N |
Treatment by block incidence matrix |
Aeff |
A-efficiency |
Baidya Nath Mandal <[email protected]>
N=matrix(c(1,0,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0,1,1,0,1,0,1,1,0,0,0,0,1,1,0,0,0,1,1,1,0,0,0,1,0,0, 1,0,1,1,0,0),nrow=7,byrow=TRUE) A_eff(N)
N=matrix(c(1,0,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0,1,1,0,1,0,1,1,0,0,0,0,1,1,0,0,0,1,1,1,0,0,0,1,0,0, 1,0,1,1,0,0),nrow=7,byrow=TRUE) A_eff(N)
Performs intrablock analysis of variance of data from experiments using a block design. It also computes estimated marginal means of the factor variables (e.g. treatments) and optionally estimates and tests the contrasts of factor variables (e.g treatments).
aov.ibd(formula,specs,data,contrast,joint=FALSE,details=FALSE,sort=TRUE,by=NULL, alpha=0.05,Letters = "ABCDEFGHIJ",...)
aov.ibd(formula,specs,data,contrast,joint=FALSE,details=FALSE,sort=TRUE,by=NULL, alpha=0.05,Letters = "ABCDEFGHIJ",...)
formula |
A formula specifying the model of the form response~treatment+block or response~block+treatment. Make sure the treatment and blocks are factor variables. |
specs |
A character vector specifying the names of the factors over which estimated marginal means are desired |
data |
A data frame in which the variables specified in the formula will be found. If missing, the variables are searched for in the standard way. |
contrast |
A matrix whose rows are contrasts of factors (e.g. treatments) |
joint |
If contrast argument has more than one row, then whether a joint test of the contrasts will be performed. Default is FALSE. If joint=TRUE, a check is performed whether the contrasts are pairwise orthogonal or not and then if orthoghonal, joint test is performed. |
details |
Logical, if details=TRUE then all objects including lm object from lm(), emmGrid object from emmeans() are returned. Default is FALSE. |
sort |
Logical value determining whether the least square means are sorted before the comparisons are produced. Default is TRUE. |
by |
Character value giving the name or names of variables by which separate families of comparisons are tested. If NULL, all means are compared. |
alpha |
Numeric value giving the significance level for the comparisons |
Letters |
Characters to be used for compact letter display of groups of factor variables over which least square means are computed. Default is english alphabet capital letters "ABCDEFGHIJ" |
... |
Not used |
The function makes use of lm() function in R and Anova() function in car package with specification of Type III sum of squares and emmeans(), contrast() functions in emmeans() package, cld() function in multcomp package and combines the results in a single place.
Returns a list with following components
lm.obj |
An object of class lm if details=TRUE |
ANOVA.table |
ANOVA table from the fitted lm object |
EMMEANS |
Estimated marginal means means with compact letter display |
contrast.analysis |
Contrast analysis result if contrast matrix was supplied |
Baidya Nath Mandal <[email protected]>
data(ibddata) aov.ibd(y~factor(trt)+factor(blk),data=ibddata) contrast=matrix(c(1,-1,0,0,0,0,0,0,0,0,0,1,-1,0,0,0,0,0),nrow=2,byrow=TRUE) aov.ibd(y~factor(trt)+factor(blk),specs="trt",data=ibddata,contrast=contrast)
data(ibddata) aov.ibd(y~factor(trt)+factor(blk),data=ibddata) contrast=matrix(c(1,-1,0,0,0,0,0,0,0,0,0,1,-1,0,0,0,0,0),nrow=2,byrow=TRUE) aov.ibd(y~factor(trt)+factor(blk),specs="trt",data=ibddata,contrast=contrast)
Generates a balanced incomplete block design with given number of treaments (v), number of blocks (b), number of replications (r), block size (k) and number of concurrences (lambda).
bibd(v,b,r,k,lambda,ntrial=5,pbar=FALSE)
bibd(v,b,r,k,lambda,ntrial=5,pbar=FALSE)
v |
number of treatments |
b |
number of blocks |
r |
number of replications |
k |
block size |
lambda |
number of concurrences |
ntrial |
number of trials. Default value is 5. |
pbar |
logical value indicating whether progress bar will be displayed or not. Default is FALSE |
v |
number of treatments |
b |
number of blocks |
r |
number of replications |
k |
block size |
lambda |
number of concurrences |
design |
block contents in a b by k matrix |
N |
treatments by blocks incidence matrix of the generated design |
NNP |
concurrence matrix of the generated design |
Aeff |
Lower bound to the A-efficiency of the generated design |
Deff |
Lower bound to the D-efficiency of the generated design |
The function works best for values of number of treatments (v) up to 30 and block size (k) up to 10. However, for block size (k) up to 3, much larger values of number of treatments (v) may be used.
Baidya Nath Mandal <[email protected]>
Mandal, B. N., Gupta, V. K. and Parsad, R. (2013). Application of optimization techniques for construction of incomplete block designs. Project report, IASRI, New Delhi.
Mandal, B. N., Gupta, V. K., & Parsad, R. (2014). Efficient Incomplete Block Designs Through Linear Integer Programming. American Journal of Mathematical and Management Sciences, 33(2), 110-124.
Mandal, B. N. (2015). Linear integer programming approach to construction of balanced incomplete block designs. Communications in Statistics-Simulation and Computation, 44:6, 1405-1411.
bibd(7,7,3,3,1) bibd(9,12,4,3,1)
bibd(7,7,3,3,1) bibd(9,12,4,3,1)
Generates a balanced treatment incomplete block design for specified parameters.
btib(v,b,r,r0,k,lambda,lambda0,ntrial=5,pbar=FALSE)
btib(v,b,r,r0,k,lambda,lambda0,ntrial=5,pbar=FALSE)
v |
number of test treatments |
b |
number of blocks |
r |
number of replications of test treatments |
r0 |
number of replications of the control treatment |
k |
block size |
lambda |
number of concurrences among test treatments |
lambda0 |
number of concurrences between test treatments and the control treatment |
ntrial |
number of trials. Default is 5. |
pbar |
logical value indicating whether progress bar will be displayed or not. Default is FALSE. |
v |
number of test treatments |
b |
number of blocks |
r |
number of replications of test treatments |
r0 |
number of replications of the control treatment |
k |
block size |
lambda |
number of concurrences among test treatments |
lambda0 |
number of concurrences between test treatments and the control treatment |
design |
generated block design |
N |
treatment by block incidence matrix of the generated block design |
NNP |
concurrence matrix of the generated design |
Aeff |
A-efficiency of the generated design |
The function works best for values of number of treatments (v) up to 30 and block size (k) up to 10. However, for block size (k) up to 3, much larger values of number of treatments (v) may be used.
Baidya Nath Mandal <[email protected]>
Mandal, B. N., Gupta, V. K. and Parsad, R. (2013). Application of optimization techniques for construction of incomplete block designs. Project report, IASRI, New Delhi.
Mandal, B. N., Gupta, V. K., & Parsad, R. (2014). Balanced treatment incomplete block designs through integer programming, Communications in Statistics - Theory and Methods, 46:8, 3728-3737.
btib(4,6,3,6,3,1,3,10)
btib(4,6,3,6,3,1,3,10)
Generates a balanced treatment incomplete block design for specified parameters by searching all possible combinations.
btib1(v,b,r,r0,k,lambda,lambda0)
btib1(v,b,r,r0,k,lambda,lambda0)
v |
number of test treatments |
b |
number of blocks |
r |
number of replications of test treatments |
r0 |
number of replications of the control treatment |
k |
block size |
lambda |
number of concurrences among test treatments |
lambda0 |
number of concurrences between test treatments and control treatment |
v |
number of test treatments |
b |
number of blocks |
r |
number of replications of test treatments |
r0 |
number of replications of control treatment |
k |
block size |
lambda |
number of concurrences among test treatments |
lambda0 |
number of concurrences between test treatments and control treatment |
design |
generated block design |
N |
treatment by block incidence matrix of the generated block design |
NNP |
concurrence matrix of the generated design |
Aeff |
A-efficiency of the generated design |
The function works best for values of number of treatments (v) up to 30 and block size (k) up to 10. However, for block size (k) up to 3, much larger values of number of treatments (v) may be used.
Baidya Nath Mandal <[email protected]>
Mandal, B. N., Gupta, V. K. and Parsad, R. (2013). Application of optimization techniques for construction of incomplete block designs. Project report, IASRI, New Delhi.
MANDAL, B. N., GUPTA, V. K. and PARSAD, R. (2012). Generation of Binary Incomplete Block Design with a Specified Concurrence Matrix. Journal of Statistics & Applications, 7.
btib(4,6,3,6,3,1,3)
btib(4,6,3,6,3,1,3)
Gives the information matrix from a given treatment by block incidence matrix of a block design
Cmatrix(N)
Cmatrix(N)
N |
treatment by block incidence matrix |
Cmatrix |
v by v information matrix where v is number of treatments |
Baidya Nath Mandal <[email protected]>
N = matrix(c(1,0,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0,1,1,0,1,0,1,1,0,0,0,0,1,1,0,0,0,1,1,1,0,0,0,1,0,0 ,1,0,1,1,0,0),nrow=7,byrow=TRUE) Cmatrix(N) Information.Matrix(N)
N = matrix(c(1,0,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0,1,1,0,1,0,1,1,0,0,0,0,1,1,0,0,0,1,1,1,0,0,0,1,0,0 ,1,0,1,1,0,0),nrow=7,byrow=TRUE) Cmatrix(N) Information.Matrix(N)
Computes lower bound to D-efficiency of a binary incomplete block design
D_eff(N)
D_eff(N)
N |
treatment by block incidence matrix |
Deff |
lower bound to D-efficiency |
Baidya Nath Mandal <[email protected]>
N=matrix(c(1,0,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0,1,1,0,1,0,1,1,0,0,0,0,1,1,0,0,0,1,1,1,0,0,0,1,0,0 ,1,0,1,1,0,0),nrow=7,byrow=TRUE) D_eff(N)
N=matrix(c(1,0,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0,1,1,0,1,0,1,1,0,0,0,0,1,1,0,0,0,1,1,1,0,0,0,1,0,0 ,1,0,1,1,0,0),nrow=7,byrow=TRUE) D_eff(N)
Generates treatment by block incidence matrix from a given block design
design_to_N(design) N(design)
design_to_N(design) N(design)
design |
design |
N |
A treatment by block incidence matrix of order v by b with elements as 0 and 1 where v is the number of treatments and b is the number of blocks |
Baidya Nath Mandal <[email protected]>
design = matrix(c(1,4,6,5,6,7,3,4,5,2,4,7,1,3,7,2,3,6,1,2,5),nrow=7,byrow=TRUE) design_to_N(design) # or alternatively N(design)
design = matrix(c(1,4,6,5,6,7,3,4,5,2,4,7,1,3,7,2,3,6,1,2,5),nrow=7,byrow=TRUE) design_to_N(design) # or alternatively N(design)
Generates an A- and D- efficient binary incomplete block design with given number of treaments(v), number of blocks(b) and block size(k) and optionally with a specified concurrence matrix(NNP).
ibd(v,b,k,NNPo,ntrial=5,pbar=FALSE)
ibd(v,b,k,NNPo,ntrial=5,pbar=FALSE)
v |
number of treatments |
b |
number of blocks |
k |
block size |
NNPo |
optionally, desired concurrence matrix. If not specified, a nearly balanced concurrence matrix is obtained automatically. |
ntrial |
number of trials. Default is 5. |
pbar |
progress bar. Default is FALSE. |
v |
number of treatments |
b |
number of blocks |
k |
block size |
NNP |
specified concurrence matrix |
N |
incidence matrix of the generated design |
design |
block contents in a b by k matrix |
conc.mat |
concurrence matrix of the generated design |
A.efficiency |
lower bound to A-efficiency of the generated design |
D.efficiency |
lower bound to D-efficiency of the generated design |
time.taken |
time taken to generate the design |
This function works best for values of number of treatments (v) up to 30 and block size (k) up to 10. However, for block size (k) up to 3, much larger values of number of treatments (v) may be used.
Baidya Nath Mandal <[email protected]>
Mandal, B. N., Gupta, V. K. and Parsad, R. (2013). Application of optimization techniques for construction of incomplete block designs. Project report, IASRI, New Delhi.
Mandal, B. N., Gupta, V. K., & Parsad, R. (2014). Efficient Incomplete Block Designs Through Linear Integer Programming. American Journal of Mathematical and Management Sciences, 33(2), 110-124.
ibd(v = 7,b = 7,k = 4, pbar=FALSE)
ibd(v = 7,b = 7,k = 4, pbar=FALSE)
Data from an experiment using incomplete block design
data("ibddata")
data("ibddata")
A data frame with 36 observations on the following 3 variables.
trt
Treatments
blk
Blocks
y
The response variable
The experiment used a balanced incomplete block design.
Dey,A. (1986). Theory of block designs. Wiley Eastern Limited, New Delhi.
data(ibddata)
data(ibddata)
Generates an incomplete block design for test vs control(s) comparisons with specified parameters and concurrence matrix.
ibdtvc(v1,v2,b,k,NNPo,ntrial=5,pbar=FALSE)
ibdtvc(v1,v2,b,k,NNPo,ntrial=5,pbar=FALSE)
v1 |
number of test treatments |
v2 |
number of control treatments |
b |
number of blocks |
k |
block size |
NNPo |
desired concurrence matrix |
ntrial |
number of trials, default is 5 |
pbar |
logical value indicating whether progress bar will be displayed. Default is FALSE. |
v1=v1,v2=v2,b=b,k=k,design=design,N=N, NNP=NNP,Aeff=Aeff)
v1 |
number of test treatments |
v2 |
number of control treatments |
b |
number of blocks |
k |
block size |
design |
generated block design |
N |
treatment by block incidence matrix of the generated block design |
NNP |
concurrence matrix of the generated design |
Baidya Nath Mandal <[email protected]>
Mandal, B. N., Gupta, V.K. and Parsad, R. (2013). Binary Incomplete Block Designs with a Specified Concurrence Matrix through Integer Programming, to be submitted for publication
NNPo=matrix(c(7,3,3,3,3,3,3,3,3,7,3,3,3,3,3,3,3,3,7,3,3,3,3,3,3,3,3,7,3,3,3,3,3,3,3,3,7, 3,3,3,3,3,3,3,3,7,3,3,3,3,3,3,3,3,9,9,3,3,3,3,3,3,9,9),nrow=8,byrow=TRUE) ibdtvc(6,2,15,4,NNPo)
NNPo=matrix(c(7,3,3,3,3,3,3,3,3,7,3,3,3,3,3,3,3,3,7,3,3,3,3,3,3,3,3,7,3,3,3,3,3,3,3,3,7, 3,3,3,3,3,3,3,3,7,3,3,3,3,3,3,3,3,9,9,3,3,3,3,3,3,9,9),nrow=8,byrow=TRUE) ibdtvc(6,2,15,4,NNPo)
Checks whether an incomplete block design is connected or not. Treatment by block incidence matrix of the design is to be supplied as input to the function. If the design is connected, it returns a value of 1 else it returns 0.
is.connected(N)
is.connected(N)
N |
incidence matrix |
connected |
connctedness |
Baidya Nath Mandal <[email protected]>
N=matrix(c(1,0,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0,1,1,0,1,0,1,1,0,0,0,0,1,1,0,0,0,1,1,1,0, 0,0,1,0,0,1,0,1,1,0,0),nrow=7,byrow=TRUE) is.connected(N)
N=matrix(c(1,0,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0,1,1,0,1,0,1,1,0,0,0,0,1,1,0,0,0,1,1,1,0, 0,0,1,0,0,1,0,1,1,0,0),nrow=7,byrow=TRUE) is.connected(N)
Checks whether an incomplete block design is equi-replicated or not. Treatment by block incidence matrix of the design is to be supplied as input to the function. If the design is equir-eplicated, it returns a value of 1 else it returns 0.
is.equir(N)
is.equir(N)
N |
incidence matrix |
equir |
equi-replicated |
Baidya Nath Mandal <[email protected]>
N=matrix(c(1,0,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0,1,1,0,1,0,1,1,0,0,0,0,1,1,0,0,0,1,1,1,0, 0,0,1,0,0,1,0,1,1,0,0),nrow=7,byrow=TRUE) is.equir(N)
N=matrix(c(1,0,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0,1,1,0,1,0,1,1,0,0,0,0,1,1,0,0,0,1,1,1,0, 0,0,1,0,0,1,0,1,1,0,0),nrow=7,byrow=TRUE) is.equir(N)
Checks whether an incomplete block design is orthogonal or not. Treatment by block incidence matrix of the design is to be supplied as input to the function. If the design is orthogonal, it returns a value of 1 else it returns 0.
is.orthogonal(N)
is.orthogonal(N)
N |
incidence matrix |
orthogonal |
orthogonal |
Baidya Nath Mandal <[email protected]>
N=matrix(c(1,0,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0,1,1,0,1,0,1,1,0,0,0,0,1,1,0,0,0,1,1,1,0, 0,0,1,0,0,1,0,1,1,0,0),nrow=7,byrow=TRUE) is.orthogonal(N)
N=matrix(c(1,0,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0,1,1,0,1,0,1,1,0,0,0,0,1,1,0,0,0,1,1,1,0, 0,0,1,0,0,1,0,1,1,0,0),nrow=7,byrow=TRUE) is.orthogonal(N)
Checks whether an incomplete block design is proper or not. Treatment by block incidence matrix of the design is to be supplied as input to the function. If the design is proper, it returns a value of 1 else it returns 0.
is.proper(N)
is.proper(N)
N |
incidence matrix |
proper |
proper |
Baidya Nath Mandal <[email protected]>
N=matrix(c(1,0,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0,1,1,0,1,0,1,1,0,0,0,0,1,1,0,0,0,1,1,1,0, 0,0,1,0,0,1,0,1,1,0,0),nrow=7,byrow=TRUE) is.proper(N)
N=matrix(c(1,0,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0,1,1,0,1,0,1,1,0,0,0,0,1,1,0,0,0,1,1,1,0, 0,0,1,0,0,1,0,1,1,0,0),nrow=7,byrow=TRUE) is.proper(N)
Checks whether an incomplete block design is variance balanced or not. Treatment by block incidence matrix of the design is to be supplied as input to the function. If the design is variance balanced, it returns a value of 1 else it returns 0.
is.vb(N)
is.vb(N)
N |
incidence matrix |
vb |
variance balanced |
Baidya Nath Mandal <[email protected]>
N=matrix(c(1,0,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0,1,1,0,1,0,1,1,0,0,0,0,1,1,0,0,0,1,1,1,0, 0,0,1,0,0,1,0,1,1,0,0),nrow=7,byrow=TRUE) is.vb(N)
N=matrix(c(1,0,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0,1,1,0,1,0,1,1,0,0,0,0,1,1,0,0,0,1,1,1,0, 0,0,1,0,0,1,0,1,1,0,0),nrow=7,byrow=TRUE) is.vb(N)
Generates the block contents from a given treatment by block incidence matrix
N_to_design(N) design(N)
N_to_design(N) design(N)
N |
treatment by block incidence matrix |
design |
a matrix with number of rows equal to number of blocks and number of columns equal to block size. Constant block size is assumed. Treatments are labelled as 1, 2, ..., v. |
Baidya Nath Mandal <[email protected]>
N=matrix(c(1,0,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0,1,1,0,1,0,1,1,0,0,0,0,1,1,0,0,0,1, 1,1,0,0,0,1,0,0,1,0,1,1,0,0),nrow=7,byrow=TRUE) N_to_design(N) design(N)
N=matrix(c(1,0,0,0,1,0,1,0,0,0,1,0,1,1,0,0,1,0,1,1,0,1,0,1,1,0,0,0,0,1,1,0,0,0,1, 1,1,0,0,0,1,0,0,1,0,1,1,0,0),nrow=7,byrow=TRUE) N_to_design(N) design(N)
Randomize a given block design
randomize(design)
randomize(design)
design |
design |
design |
Block design with a constant block size |
Baidya Nath Mandal <[email protected]>
design = matrix(c(1,4,6,5,6,7,3,4,5,2,4,7,1,3,7,2,3,6,1,2,5),nrow=7,byrow=TRUE) randomize(design)
design = matrix(c(1,4,6,5,6,7,3,4,5,2,4,7,1,3,7,2,3,6,1,2,5),nrow=7,byrow=TRUE) randomize(design)