model.comp: Model comparison for asreml.

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/model.comp.R

Description

This function would compare models with different random structure under the same fixed factors.

Usage

1
model.comp(m1=NULL,m2=NULL,Nml=NULL,mulM=NULL,LRT=NULL,rdDF=NULL)

Arguments

m1

Model 1 asreml results.

m2

Model 2 asreml results.

Nml

A vector with more than 2 asreml results.

mulM

mulM is "TRUE" for a vector's comparison with multi-models, default (FALSE).

LRT

Value TRUE for Likelihood ratio test (LRT), default (FALSE) for no LRT.

rdDF

Value TRUE to control Ddf minus 0.5, default FALSE for LRT with Ddf. If TRUE, Ddf would minus 0.5, ie, Ddf=Ddf-0.5 .

Value

m1

An asreml result,such as "m1.asr"

Nml

A vector, such as "c(m1,m2,m3,m4)"

Author(s)

Yuanzhen Lin <yzhlinscau@163.com>

References

Yuanzhen Lin. R & ASReml-R Statistics. China Forestry Publishing House. 2016

See Also

Website for instant update: yzhlin-asreml.ys168.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
library(asreml)
library(AAfun)
df<-PrSpa

fm<-asreml(h5~ 1+Rep,random=~ Fam, 
            subset=Spacing=='3',data=df,maxit=40)
            
fm1a<-asreml(cbind(dj,h5)~ trait+trait:Rep, 
            random=~ us(trait):Fam, rcov=~units:us(trait),
            subset=Spacing=='3',data=df,maxit=40)
fm1b<-asreml(cbind(dj,h5)~ trait+trait:Rep, 
            random=~ diag(trait):Fam, rcov=~units:us(trait),
            subset=Spacing=='3',data=df,maxit=40)

fm3a<-asreml(cbind(dj,h3,h5)~ trait+trait:Rep, 
            random=~ diag(trait):Fam, rcov=~units:us(trait),
            subset=Spacing=='3',data=df,maxit=40)
            
fm3b<-asreml(cbind(dj,h3,h5)~ trait+trait:Rep, 
            random=~ diag(trait):Fam, rcov=~units:us(trait),
            subset=Spacing=='3',data=df,maxit=40)

#####   model comparison    #####
model.comp(m1=fm1a,m2=fm1b)
model.comp(m1=fm1a,m2=fm1b,LRT=TRUE)
model.comp(m1=fm1a,m2=fm1b,LRT=TRUE,rdDF=TRUE)

model.comp(Nml=c(fm3a,fm3b,fm1a,fm1b,fm),mulM=TRUE)
model.comp(Nml=c(fm3a,fm3b,fm1a,fm1b,fm),mulM=TRUE,LRT=TRUE)

yzhlinscau/AAfun documentation built on May 21, 2020, 2:19 p.m.