MMVcov | R Documentation |
This function computes the covariance matrix of variance estimators using either the inverse of the Expected Hessian Matrix or the inverse of the Average Information Matrix.
MMVcov(ResMM , Y , Cofactor = NULL , formula = NULL,
ZList = NULL , VarList , information="Expected")
ResMM |
A list as displayed by the |
Y |
The vector of response values used in the function |
Cofactor |
The incidence matrix corresponding to fixed effects common to all models to be adjusted used in the function |
formula |
The formula object specifying the fixed effect part of all models separated by + operators used in the function |
ZList |
The list of incidence matrices associated with random and residual effects used in the function |
VarList |
The list of covariance matrices associated with random and residual effects used in the function |
information |
A string specifying the method used to approximate the covariance matrix. It can be either "Expected" (default) to use the Expected Hessian Matrix or "AI" to use the Average Information Matrix. The AI matrix is always computed using Reml estimates whereas the expected hessian matrix could also be used for ML estimates. |
If information
is not specified then the algorithm computes the covariance matrix using the Expected matrix based on the inference method (Reml or ML) used in the first item of ResMM
. If information
is equal to "AI" then it computes the AI matrix to calculate the covariance matrix. Only the first item of ResMM
is analyzed.
The output of the function is a list:
vcov |
The covariance matrix of the variance estimators |
SE |
The standard errors of the variance estimators (the square root of the covariance matrix diagonal) |
F. Laporte and T. Mary-Huard
require('MM4LMM')
data(VarianceComponentExample)
DataHybrid <- VarianceComponentExample$Data
KinF <- VarianceComponentExample$KinshipF
KinD <- VarianceComponentExample$KinshipD
##Build incidence matrix for each random effect
Zf <- t(sapply(as.character(DataHybrid$CodeFlint), function(x)
as.numeric(rownames(KinF)==x)))
Zd <- t(sapply(as.character(DataHybrid$CodeDent), function(x)
as.numeric(rownames(KinD)==x)))
##Build the VarList and ZList objects
VL = list(Flint=KinF , Dent=KinD , Error = diag(1,nrow(DataHybrid)))
ZL <- list(Flint=Zf , Dent=Zd , Error = diag(1,nrow(DataHybrid)))
##Perform inference
#A first way to call MMEst
ResultVA <- MMEst(Y=DataHybrid$Trait , Cofactor = matrix(DataHybrid$Trial)
, ZList = ZL , VarList = VL)
Expected_vcov <- MMVcov(ResMM=ResultVA,Y=DataHybrid$Trait,
Cofactor = matrix(DataHybrid$Trial),
, ZList = ZL , VarList = VL)
AI_vcov <- MMVcov(ResMM=ResultVA,Y=DataHybrid$Trait,
Cofactor = matrix(DataHybrid$Trial),
, ZList = ZL , VarList = VL , information = "AI")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.