MMBlup: BLUP from MM4LMM results

View source: R/MMBlup.R

MMBlupR Documentation

BLUP from MM4LMM results

Description

This function computes the BLUP for each random vector included in the MMEst output. Note that this function can be called only if the argument X of MMEst was set to NULL

Usage

  MMBlup(Y,Cofactor = NULL, X = NULL, fmla = NULL,ZList=NULL,VarList,ResMM)

Arguments

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.

X

Must be NULL.

fmla

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.

ResMM

A list as displayed by the MMEst function for a Variance Component Analysis.

Value

The function returns a list where each element corresponds to the Best Linear Unbiased Prediction of a random component of the model.

Author(s)

GQMS CoreFunctions Team

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)
  BlupVA <- MMBlup(Y=DataHybrid$Trait  , Cofactor = matrix(DataHybrid$Trial)
                    , ZList = ZL  ,  VarList = VL , ResMM=ResultVA)

MM4LMM documentation built on July 11, 2022, 5:06 p.m.