This function returns the sampling covariances, variances, and correlations of the random effects fitted in an mixed model solved using the Average Information algorithm

1 |

`model ` |
A model object returned by a call to the |

`AI.vec ` |
A numeric vector of the Average Information matrix. The order must be the row-wise lower triangle of the matrix (including the diagonal). |

`inverse ` |
A logical indicating whether the elements of the Average Information matrix are being provided. If FALSE, the Average Information matrix (and not its inverse) is being supplied. |

`Dimnames ` |
A vector of characters if names are desired for the output (co)variance/correlation matrix. If not specified, either the default labels from the |

The inverse of the Average Information matrix provides the sampling (co)variance of each random term in the mixed model. If a model from the ASReml-R function is supplied (`model`

is not NULL), this function extracts the inverse of the AI matrix from an ASReml-R model and organizes it so that the sampling covariances between random terms are located below the diagonal, the sampling variances of random terms are located along the diagonal, and the sampling correlations between random terms are located above the diagonal. The order of the variances along the diagonal is the same as the order entered in the random section of the `asreml`

function. This is also the same order as the rows of a call to the summary function, `summary(model)$varcomp`

.

If `model`

is NULL then `AI.vec`

should contain the vector of values from an Average Information matrix. The function will then reconstruct this matrix, invert it, and supply the sampling (co) variances and correlations for the random terms in the model as described above. Note, either `model`

or `AI.vec`

must be supplied, but not both.

A matrix of k x k dimensions is returned, if k is the number of random effects estimated in the model. Sampling covariances are below the diagonal, variances along the diagonal, and correlations are above the diagonal. If `Dimnames`

is specified, the row and column names are assigned according the vector of names in this argument.

The vector of `Dimnames`

should match the same order of variance components specified in the model.

Gilmour, A.R., Gogel, B.J., Cullis, B.R., & Thompson, R. 2009. ASReml User Guide Release 3.0. VSN International Ltd., Hemel Hempstead, UK.

1 2 3 4 5 6 7 8 9 10 11 12 13 | ```
## Not run:
library(asreml)
ginvA <- asreml.Ainverse(warcolak)$ginv
ginvD <- makeD(warcolak[,1:3])$listDinv
warcolak$IDD <- warcolak$ID
warcolak.mod <- asreml(trait1 ~ 1, random = ~ped(ID) + giv(IDD), ginverse = list(ID = ginvA, IDD = ginvD), data = warcolak)
summary(warcolak.mod)$varcomp
aiFun(model = warcolak.mod, Dimnames = c("Va", "Vd", "Ve"), inverse = TRUE)
## End(Not run)
output <- c(7.3075921, 7.0635161, 12.3423380, 1.9539486, 2.7586340, 0.6626111)
aiFun(AI.vec = output, inverse = FALSE, Dimnames = c("Va", "Vd", "Ve"))
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.