bayes_ammi: Bayesian Estimation of Genotype by Environment Interaction...

Description Usage Arguments Value Author(s) References Examples

Description

Bayesian estimation method of linear–bilinear models for Genotype by Environment Interaction Model

Usage

1
2
## Default S3 method:
bayes_ammi(.data, .y, .gen, .env, .rep, .nIter)

Arguments

.data

data.frame

.y

Response Variable

.gen

Genotypes Factor

.env

Environment Factor

.rep

Replication Factor

.nIter

Number of Iterations

Value

Genotype by Environment Interaction Model

Author(s)

  1. Muhammad Yaseen (myaseen208@gmail.com)

  2. Diego Jarquin (diego.jarquin@gmail.com)

  3. Sergio Perez-Elizalde (sergiop@colpos.mx)

  4. Juan Burgueño (j.burgueno@cgiar.org)

  5. Jose Crossa (j.crossa@cgiar.org)

References

Perez-Elizalde, S., Jarquin, D., and Crossa, J. (2011) A General Bayesian Estimation Method of Linear–Bilinear Models Applied to Plant Breeding Trials With Genotype × Environment Interaction. Journal of Agricultural, Biological, and Environmental Statistics, 17, 15–37. (doi:10.1007/s13253-011-0063-9)

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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
data(cultivo2008)
fm1 <-
   ge_ammi(
      .data  = cultivo2008
     , .y    = y
     , .gen  = entry
     , .env  = site
     , .rep  = rep
     )

r0 <- fm1$g
c0 <- fm1$e
n0 <- fm1$Rep
k0 <- fm1$k

mu0      <- fm1$mu
sigma20  <- fm1$sigma2
tau0     <- fm1$tau
tao0     <- fm1$tao
delta0   <- fm1$delta
lambdas0 <- fm1$lambdas
alphas0  <- fm1$alphas
gammas0  <- fm1$gammas

ge_means0 <- fm1$ge_means$ge_means

data(cultivo2008)

fm2 <-
 ge_ammi(
   .data = cultivo2009
   , .y    = y
   , .gen  = entry
   , .env  = site
   , .rep  = rep
  )

k        <- fm2$k
alphasa  <- fm2$alphas
gammasa  <- fm2$gammas

alphas1  <- tibble::as_tibble(fm2$alphas)
gammas1  <- tibble::as_tibble(fm2$gammas)



# Biplots OLS
library(ggplot2)
    BiplotOLS1 <-
      ggplot(data = alphas1, mapping = aes(x = V1, y = V2)) +
      geom_point() +
      geom_hline(yintercept = 0) +
      geom_vline(xintercept = 0) +
      geom_text(aes(label = 1:nrow(alphas1)), vjust = "inward", hjust = "inward") +
      scale_x_continuous(
               limits = c(-max(abs(c(range(alphas1[, 1:2]))))
                         , max(abs(c(range(alphas1[, 1:2])))))) +
      scale_y_continuous(
               limits = c(-max(abs(c(range(alphas1[, 1:2]))))
                         , max(abs(c(range(alphas1[, 1:2])))))) +
      labs(title = "OLS", x = expression(u[1]), y = expression(u[2])) +
      theme_bw() +
      theme(plot.title = element_text(hjust = 0.5))
      print(BiplotOLS1)


    BiplotOLS2 <-
      ggplot(data = gammas1, mapping = aes(x = V1, y = V2)) +
      geom_point() +
      geom_hline(yintercept = 0) +
      geom_vline(xintercept = 0) +
      geom_text(aes(label = 1:nrow(gammas1)), vjust = "inward", hjust = "inward") +
      scale_x_continuous(
                limits = c(-max(abs(c(range(gammas1[, 1:2]))))
                         , max(abs(c(range(gammas1[, 1:2])))))) +
      scale_y_continuous(
                limits = c(-max(abs(c(range(gammas1[, 1:2]))))
                          , max(abs(c(range(gammas1[, 1:2])))))) +
      labs(title = "OLS", x = expression(v[1]), y = expression(v[2])) +
      theme_bw() +
      theme(plot.title = element_text(hjust = 0.5))
      print(BiplotOLS2)


    BiplotOLS3 <-
      ggplot(data = alphas1, mapping = aes(x = V1, y = V2)) +
      geom_point() +
      geom_hline(yintercept = 0) +
      geom_vline(xintercept = 0) +
      geom_text(aes(label = 1:nrow(alphas1)), vjust = "inward", hjust = "inward") +
      geom_point(data = gammas1, mapping = aes(x = V1, y = V2)) +
      geom_segment(data = gammas1, aes(x = 0, y = 0, xend = V1, yend = V2),
                    arrow = arrow(length = unit(0.2, "cm")), alpha = 0.75, color = "red") +
      geom_text(data = gammas1,
              aes(x = V1, y = V2, label = paste0("E", 1:nrow(gammasa)))
             , vjust = "inward", hjust = "inward") +
      scale_x_continuous(
              limits = c(-max(abs(c(range(alphas1[, 1:2], gammas1[, 1:2]))))
                        , max(abs(c(range(alphas1[, 1:2], gammas1[, 1:2])))))) +
      scale_y_continuous(
              limits = c(-max(abs(c(range(alphas1[, 1:2], gammas1[, 1:2]))))
                       , max(abs(c(range(alphas1[, 1:2], gammas1[, 1:2])))))) +
      labs(title = "OLS", x = expression(PC[1]), y = expression(PC[2])) +
      theme_bw() +
      theme(plot.title = element_text(hjust = 0.5))
      print(BiplotOLS3)


fm3 <-
  bayes_ammi(
    .data = cultivo2009
    , .y     = y
    , .gen   = entry
    , .env   = site
    , .rep   = rep
    , .nIter = 200
  )


Mean_Alphas <- tibble::as_tibble(matrix(colMeans(fm3$alphas1), ncol = 11))
Mean_Gammas <- tibble::as_tibble(matrix(colMeans(fm3$gammas1), ncol = 11))

# Biplots Bayesian
BiplotBayes1 <-
  ggplot(data = Mean_Alphas, mapping = aes(x = V1, y = V2)) +
  geom_point() +
  geom_hline(yintercept = 0) +
  geom_vline(xintercept = 0) +
  geom_text(aes(label = 1:nrow(Mean_Alphas)),
             vjust = "inward"
           , hjust = "inward") +
  scale_x_continuous(
     limits = c(-max(abs(c(range(Mean_Alphas[, 1:2]))))
               , max(abs(c(range(Mean_Alphas[, 1:2])))))) +
  scale_y_continuous(
      limits = c(-max(abs(c(range(Mean_Alphas[, 1:2]))))
                , max(abs(c(range(Mean_Alphas[, 1:2])))))) +
  labs(title = "Bayes", x = expression(u[1]), y = expression(u[2])) +
  theme_bw() +
  theme(plot.title = element_text(hjust = 0.5))

print(BiplotBayes1)


BiplotBayes2 <-
  ggplot(data = Mean_Gammas, mapping = aes(x = V1, y = V2)) +
  geom_point() +
  geom_hline(yintercept = 0) +
  geom_vline(xintercept = 0) +
  geom_text(aes(label = 1:nrow(Mean_Gammas)), vjust = "inward", hjust = "inward") +
  scale_x_continuous(
            limits = c(-max(abs(c(range(Mean_Gammas[, 1:2]))))
                      , max(abs(c(range(Mean_Gammas[, 1:2])))))) +
  scale_y_continuous(
            limits = c(-max(abs(c(range(Mean_Gammas[, 1:2]))))
                      , max(abs(c(range(Mean_Gammas[, 1:2])))))) +
  labs(title = "Bayes", x = expression(v[1]), y = expression(v[2])) +
  theme_bw() +
  theme(plot.title = element_text(hjust = 0.5))

print(BiplotBayes2)


BiplotBayes3 <-
  ggplot(data = Mean_Alphas, mapping = aes(x = V1, y = V2)) +
  geom_point() +
  geom_hline(yintercept = 0) +
  geom_vline(xintercept = 0) +
  geom_text(aes(label = 1:nrow(Mean_Alphas)),
             vjust = "inward", hjust = "inward") +
  geom_point(data = Mean_Gammas, mapping = aes(x = V1, y = V2)) +
  geom_segment(data = Mean_Gammas,
                aes(x = 0, y = 0, xend = V1, yend = V2),
               arrow = arrow(length = unit(0.2, "cm"))
               , alpha = 0.75, color = "red") +
  geom_text(data = Mean_Gammas,
            aes(x = V1, y = V2,
            label = paste0("E", 1:nrow(Mean_Gammas))),
            vjust = "inward", hjust = "inward") +
  scale_x_continuous(
            limits = c(-max(abs(c(range(Mean_Alphas[, 1:2], Mean_Gammas[, 1:2]))))
                      , max(abs(c(range(Mean_Alphas[, 1:2], Mean_Gammas[, 1:2])))))) +
  scale_y_continuous(
           limits = c(-max(abs(c(range(Mean_Alphas[, 1:2], Mean_Gammas[, 1:2]))))
                   , max(abs(c(range(Mean_Alphas[, 1:2], Mean_Gammas[, 1:2])))))) +
  labs(title = "Bayes", x = expression(PC[1]), y = expression(PC[2])) +
  theme_bw() +
  theme(plot.title = element_text(hjust = 0.5))

print(BiplotBayes3)

baystability documentation built on May 2, 2019, 10:24 a.m.