designAmeasures {dae} | R Documentation |

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)`

`Vpred` |
The variance |

`groupsizes` |
A |

`groups` |
A |

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.

```
## 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"))
start.design <- cbind(mill.fac, field.lay[c(3,4,5,8,1,7,3,4,5,8,6,2),])
rownames(start.design) <- NULL
## Set up matrices
n <- nrow(start.design)
W <- model.matrix(~ -1+ Variety, start.design)
ng <- ncol(W)
Gg<- diag(1, ng)
Vu <- with(start.design, 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)
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
designAmeasures(Vp.reduc)
```

[Package *dae* version 3.2-13 Index]