designAmeasures {dae}R Documentation

Calculates the average variance of pairwise differences from the variance matrix for predictions


Calculates the average variance of pairwise differences between (of elementary contrasts of) preductions, possibly for different subgroups of the predictions, from the variance matrix for the predictions. If groups are specified then the A-optimality measures are calculated for the differences between predictions within each group and for those between predictions from different groups. If groupsizes are specified, but groups are not, the predictions will be sequentially broken into groups of the size specified by the elements of groupsizes. The groups can be named.


designAmeasures(Vpred, groupsizes = NULL, groups = NULL)



The variance matrix of the predictions. It can be obtained using mat.Vpredicts.


A numeric containing group sizes. The sum of the elements of groupsizes must be less than or equal to the order of Vpred. If groupsizes is a named vector, the names are used to label the groups. If NULL, either groups is used or the average for all pairwise differences is obtained.


A list, each element of which specifies a subroup of the predictions over whose pairwise differences the variances are to be averaged. If there is more than one group, the variances of all between and within group pairwise differences are averaged. If the elements of groups are named , the names are used to label the groups. If groups is NULL, either groupsizes is used or the average for all pairwise differences is obtained.


The variance matrix of pairwise differences is calculated as v_{ii} + v_{jj} - 2 v_{ij}, where v_{ij} is the element from the ith row and jth column of Vpred. Then the mean of these is computed for the nominated groups.


A matrix containing the within and between group A-optimality measures.


Chris Brien


Smith, A. B., D. G. Butler, C. R. Cavanagh and B. R. Cullis (2015). Multi-phase variety trials using both composite and individual replicate samples: a model-based design approach. Journal of Agricultural Science, 153, 1017-1029.

See Also

mat.Vpred, designAnatomy.


## Reduced example from Smith et al. (2015) 
## Generate two-phase design
mill.fac <- fac.gen(list(Mrep = 2, Mday = 2, Mord = 3))
field.lay <- fac.gen(list(Frep = 2, Fplot = 4))
field.lay$Variety <- factor(c("D","E","Y","W","G","D","E","M"), 
                            levels = c("Y","W","G","M","D","E")) <- cbind(mill.fac, field.lay[c(3,4,5,8,1,7,3,4,5,8,6,2),])
rownames( <- NULL

## Set up matrices
n <- nrow(
W <- model.matrix(~ -1+ Variety,
ng <- ncol(W)
Gg<- diag(1, ng)
Vu <- with(, fac.vcmat(Mrep, 0.3) + 
                         fac.vcmat(fac.combine(list(Mrep, Mday)), 0.2) + 
                         fac.vcmat(Frep, 0.1) + 
                         fac.vcmat(fac.combine(list(Frep, Fplot)), 0.2))
R <- diag(1, n)
## Calculate the varaince matrix of the predicted random Variety effects
Vp <- mat.Vpred(W = W, Gg = Gg, Vu = Vu, R = R)
## Calculate A-optimality measure
designAmeasures(Vp, groups=list(fldUndup = c(1:4), fldDup = c(5,6)))
grpsizes <- c(4,2)
names(grpsizes) <- c("fldUndup", "fldDup")
designAmeasures(Vp, groupsizes = grpsizes)
designAmeasures(Vp, groupsizes = c(4))
designAmeasures(Vp, groups=list(c(1,4),c(5,6)))

## Calculate the variance matrix of the predicted fixed Variety effects, elminating the grand mean
Vp.reduc <- mat.Vpred(W = W, Gg = 0, Vu = Vu, R = R, 
                      eliminate = projector(matrix(1, nrow = n, ncol = n)/n))
## Calculate A-optimality measure

[Package dae version 3.2-13 Index]