AnovaTest: Type I and Type III Tests for mixed models.

View source: R/AnovaTest.R

AnovaTestR Documentation

Type I and Type III Tests for mixed models.

Description

This function computes Type I and Type III tests for each fixed effect of a model, as displayed by the MMEst function. Alternatively, a specific linear combination of the fixed parameters may be tested (at 0).

Usage

AnovaTest(ResMMEst , TestedCombination=NULL , Type = "TypeIII" ,
    Cofactor = NULL , X = NULL , formula = NULL , VarList = NULL ,
    NbCores=1)

Arguments

ResMMEst

A list as displayed by the MMEst function.

TestedCombination

A contrast matrix or a list of contrast matrices C_m. Each matrix corresponds to a (set of) linear combination to be (jointly) tested at 0.

Type

"TypeI", "TypeIII" or "KR" (default is "TypeIII"). AnovaTest will compute tests of the given type for each fixed effect in the model. The option is ignored if a TestedCombination is provided. If Type is "KR" then AnovaTest will compute Type III test using Kenward Roger approximation, see Kenward and Roger (1997) for details.

Cofactor

The incidence matrix corresponding to fixed effects common to all models used in MMEst. If NULL, a single intercept is used as cofactor. This entry is needed when Type is "KR".

X

The incidence matrix or a list of incidence matrices corresponding to fixed effects specific to each model used in MMEst (default is NULL). This entry is needed when Type is "KR".

formula

The formula object specifying the fixed effect part of all models separated by + operators used in MMEst (default is NULL). This entry is needed when Type is "KR".

VarList

The list of correlation matrices associated with random and residual effects used in MMEst (default is NULL). This entry is needed when Type is "KR".

NbCores

The number of cores to be used.

Details

If no TestedCombination is provided, the function performs either Type I or Type III tests for each fixed effect in the model (default is Type III). If TestedCombination is provided, each linear combination in TestedCombination is tested at 0 using a Wald test. No check is performed regarding the estimability of the linear combination to be tested. If the dimension of the combination does not match with the dimension of ResMMEst, a NA is returned.

Value

The output of the function is a list with as many items as in the original input list ResMMEst. For each item of ResMMEst, a table is provided that contains the Wald test statistics, p-values and degrees of freedom for all tested hypotheses.

Author(s)

F. Laporte and T. Mary-Huard

References

Kenward, M. G., & Roger, J. H. (1997). Small sample inference for fixed effects from restricted maximum likelihood. Biometrics, 983-997.

Examples

  require('MM4LMM')
  data(QTLDetectionExample)
  Pheno <- QTLDetectionExample$Phenotype
  Geno <- QTLDetectionExample$Genotype
  Kinship <- QTLDetectionExample$Kinship

  ##Build the VarList object
  VL <- list(Additive = Kinship , Error = diag(1,length(Pheno)))
  
  ##Perform inference
  Result <- MMEst(Y=Pheno , X = Geno , VarList = VL)

  ##Compute tests
  AOV <- AnovaTest(Result,Type="TypeI")
  
  ##Test specific contrast matrix
  TC = matrix(c(0,1),nrow=1)
  AOV2 <- AnovaTest(Result, TestedCombination = TC)
  
  AOV3 <- AnovaTest(Result, TestedCombination = TC , Type="KR" , X = Geno , VarList = VL)


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