MMVcov {MM4LMM}R Documentation

Covariance Matrix for variance estimators.

Description

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.

Usage

MMVcov(ResMM , Y , Cofactor = NULL , formula = NULL,
    ZList = NULL , VarList , information="Expected")

Arguments

ResMM

A list as displayed by the MMEst function for a Variance Component Analysis (only the first element of the list will be analyzed).

Y

The vector of response values used in the function MMEst.

Cofactor

The incidence matrix corresponding to fixed effects common to all models to be adjusted used in the function MMEst. If NULL, a vector full of 1 is used.

formula

The formula object specifying the fixed effect part of all models separated by + operators used in the function MMEst (default is NULL).

ZList

The list of incidence matrices associated with random and residual effects used in the function MMEst (default is NULL).

VarList

The list of covariance matrices associated with random and residual effects used in the function MMEst.

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.

Details

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.

Value

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)

Author(s)

F. Laporte and T. Mary-Huard

Examples

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

[Package MM4LMM version 3.0.2 Index]