pin: Count error for h2 and corr.

Description Usage Arguments Details Value Author(s) References Examples

Description

pin This function counts standard error(se) for heritability(h2) and corr value and also outputs significent level for corr value in asreml and breedR package.

Usage

1
2
3
4
5
6
7
8
9
pin(object, formula, asrV, signif, corN, Rdf, digit, vres)

## S3 method for class 'asreml'
pin(object, formula = NULL, asrV = 3, signif = FALSE,
  corN = NULL, Rdf = FALSE, digit = 3, vres = FALSE)

## S3 method for class 'remlf90'
pin(object, formula = NULL, signif = FALSE, digit = 3,
  vres = FALSE)

Arguments

object

asreml or breedR results.

formula

formula for h2 or corr.

asrV

Index for asreml version, 3(default),or 4(new version).

signif

Index to output signif levels, F(default) for non-signif.

corN

Number of corr, 1(default).

Rdf

Index to output results to vector, F(default) for non-vector output.

digit

Index for decimal number, 3(default).

vres

Index(T) to return results in vectors, F(default) for direct results.

Details

Count error for h2 and corr value, also outputs significent level.

Value

the result is returned directly.

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
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
## Not run: 
## working for breedR package
library(breedR)
library(AAFMM)

data(globulus)
res.animal <- remlf90(fixed = phe_X ~ 1,
                      random = ~ gg,
                      genetic = list(model = 'add_animal',
                      pedigree = globulus[, 1:3],
                      id = 'self'),
                      data = globulus)
                      
pin(res.animal,h2~V2/(V1+V2+V3))

## End(Not run) 

## Not run: 
## working for asreml or asreml4 package
library(AAFMM)
data(PrSpa)
df<-PrSpa

## when works for ASReml-R V3.0
library(asreml) # V3.0

# exmaple 1.1 single trait model
fm1<-asreml(h5~1+Rep, random=~Fam, 
             subset=Spacing=='3',data=df)

summary(fm)$varcomp[,1:3]

pin(fm1, h2 ~4*V1/(V1+V2))
pin(fm1, h2 ~4*V1/(V1+V2),Rdf=TRUE)

# exmaple 1.2 us model
fm2<-asreml(cbind(dj,h5)~ trait+trait:Rep, 
            random=~ us(trait):Fam, 
            rcov=~units:us(trait),
            subset=Spacing=='3',data=df,maxit=40)
                        
summary(fm2)$varcomp[,1:3]

pin(fm2, h2_A ~ 4 * V1/(V1+V5)) # heritability for trait A
pin(fm2, h2_B ~ 4 * V3/(V3+V7)) # heritability for trait B

# genetic corr
pin(fm2, gCORR ~ V2/sqrt(V1*V3),signif=TRUE) 

# phenotype corr
pin(fm2, pCORR ~ (V2+V6)/sqrt((V1+V5)*(V3+V7)),signif=TRUE) 

# exmaple 1.3 corr model
fm3<-asreml(cbind(dj,h3,h5)~ trait+trait:Rep, 
            random=~ corgh(trait):Fam, 
            rcov=~units:us(trait),
            subset=Spacing=='3',data=df,maxit=40)
                        
summary(fm3)$varcomp[,1:3]
pin(fm3,corN=3)

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

# exmaple 2.1 single trait model, default gamma parameterization.
fm1b<-asreml(h5~1+Rep, random=~Fam, subset=Spacing=='3',data=df)

summary(fm)$varcomp[,1:3]

pin(fm1b, h2 ~4*V1/(V1+V2),asrV=4)
pin4(fm1b, h2 ~4*V1/(V1+V2)) # same results, but with pin4()

# The same model with fm1b, but with sigma parameterization.
fm1c<-asreml(h5~1+Rep, random=~Fam, 
               residual=~idv(units),
               subset=Spacing=='3',data=df)
               
summary(fm1c)$varcomp[,1:3]

pin(fm1c, h2 ~4*V1/(V1+V3),asrV=4)
pin4(fm1c, h2 ~4*V1/(V1+V3))

# exmaple 2.2 us model
fm2b<-asreml(cbind(h3,h5)~ trait+trait:Rep, 
            random=~ us(trait):Fam, 
            residual=~units:us(trait),
            subset=Spacing=='3',data=df,maxit=40)
            
summary(fm2b)$varcomp[,1:3]

# heritability for trait A
pin(fm2b, h2_A ~ 4 * V1/(V1+V5),asrV=4) 
pin4(fm2b, h2_A ~ 4 * V1/(V1+V5)) 

# heritability for trait B
pin(fm2b, h2_B ~ 4 * V3/(V3+V7),asrV=4) 
pin4(fm2b, h2_B ~ 4 * V3/(V3+V7))

# genetic corr
pin(fm2b, gCORR ~ V2/sqrt(V1*V3),signif=TRUE,asrV=4)
pin4(fm2b, gCORR ~ V2/sqrt(V1*V3),signif=TRUE)

# phenotype corr
pin(fm2b, pCORR ~ (V2+V6)/sqrt((V1+V5)*(V3+V7)),signif=TRUE,asrV=4) 
pin4(fm2b, pCORR ~ (V2+V6)/sqrt((V1+V5)*(V3+V7)),signif=TRUE) 

# exmaple 2.3 corr model
fm3b<-asreml(cbind(h3,h4,h5)~ trait+trait:Rep, 
            random=~ corgh(trait):Fam, 
            residual=~units:us(trait),
            subset=Spacing=='3',data=df,maxit=40)
                        
summary(fm3b)$varcomp[,1:3]

pin(fm3b,corN=3,asrV=4) 
pin4(fm3b,corN=3) 

## End(Not run)

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