mat.Vpred {dae} R Documentation

## Calculates the variances of a set of predicted effects from a mixed model

### Description

For n observations, w effects to be predicted, f nuiscance fixed effects and r nuisance random effects, the variances of a set of predicted effects is calculated using the incidence matrix for the effects to be predicted and, optionally, a variance matrix of the effects, an incidence matrix for the nuisance fixed factors and covariates, the variance matrix of the nuisance random effects in the mixed model and the residual variance matrix.

This function has been superseded by mat.Vpredicts, which allows the use of both matrices and formulae.

### Usage

mat.Vpred(W, Gg = 0, X = matrix(1, nrow = nrow(W), ncol = 1), Vu = 0, R, eliminate)

### Arguments

 W The n x w incidence matrix for the w effects to be predicted. Gg The w x w variance matrix of the w effects to be predicted. If the effects to be predicted are fixed, set to 0. X The n x f incidence matrix for the f nuisance fixed factors and covariates. The default is a column vector of ones. Vu The n x r variance matrix of the r nuisance random effects. If there are none, set to zero. R The residual variance matrix. eliminate The n x n projector onto the subspace corresponding to the effects to be eliminated from the information matrix prior to inverting it to form the variance matrix of the predicted effects. It is only appropriate to use this option when the effects to be predicted are fixed.

### Details

Firstly the information matrix is calculated as
A <- t(W) %*% Vinv %*% W + ginv(Gg) - A%*%ginv(t(X)%*%Vinv%*%X)%*%t(A), where Vinv <- ginv(Vu + R), A = t(W) %*% Vinv %*% X and ginv(B) is the unique Moore-Penrose inverse of B formed using the eigendecomposition of B.

If eliminate is set and the effects to be predicted are fixed then the reduced information matrix is calculated as A <- (I - eliminate) Vinv (I - eliminate).

Finally, the variance of the predicted effects is calculated: Vpred <- ginv(A).

### Value

A w x w matrix containing the variances and covariances of the predicted effects.

Chris Brien

### References

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.

designAmeasures, mat.Vpredicts.

### Examples

## 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 variance matrix of the predicted random Variety effects
Vp <- mat.Vpred(W = W, Gg = Gg, Vu = Vu, R = R)
designAmeasures(Vp)

## 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))
designAmeasures(Vp.reduc)


[Package dae version 3.2.28 Index]