model.comp: Model comparison for asreml.

Description Usage Arguments Author(s) References Examples

Description

model.comp 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,such as "m1.asr".

m2

Model 2 asreml results.

Nml

A vector with more than 2 asreml results, such as "c(m1,m2,m3,m4)".

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.

asrV

asreml version 3(default, V3), or 4 (new version V4).

Author(s)

Yuanzhen Lin <yzhlinscau@163.com>

References

Yuanzhen Lin. R & ASReml-R Statistics. China Forestry Publishing House. 2016 AAFMM website:https://github.com/yzhlinscau/AAFMM

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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
## Not run: 

library(AAFMM)
df<-PrSpa

## for ASReml-R V3.0
library(asreml)
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)


## for ASReml-R V4.0
library(asreml4)

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, 
             residual=~units:us(trait),
             subset=Spacing=='3',data=df,maxit=40)
             
fm1b<-asreml(cbind(dj,h5)~ trait+trait:Rep, 
             random=~ diag(trait):Fam, 
             residual=~units:us(trait),
             subset=Spacing=='3',data=df,maxit=40)

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

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

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

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

## End(Not run)

yzhlinscau/AAFMM documentation built on May 4, 2019, 4:17 a.m.