Description Usage Arguments Value Author(s) References Examples
Performs Bayesian Estimation of the Additive Main Effects and Multiplicative Interaction Model
1 2 3 4 | bayes_ammi(.data, .y, .gen, .env, .rep, .nIter)
## Default S3 method:
bayes_ammi(.data, .y, .gen, .env, .rep, .nIter)
|
.data |
data.frame |
.y |
Response Variable |
.gen |
Genotypes Factor |
.env |
Environment Factor |
.rep |
Replication Factor |
.nIter |
Number of Iterations |
Genotype by Environment Interaction Model
Muhammad Yaseen (myaseen208@gmail.com)
Jose Crossa (j.crossa@cgiar.org)
Sergio Perez-Elizalde (sergiop@colpos.mx)
Diego Jarquin (diego.jarquin@gmail.com)
Jose Miguel Cotes
Kert Viele
Genzhou Liu
Paul L. Cornelius
Crossa, J., Perez-Elizalde, S., Jarquin, D., Cotes, J.M., Viele, K., Liu, G., and Cornelius, P.L. (2011) Bayesian Estimation of the Additive Main Effects and Multiplicative Interaction Model Crop Science, 51, 1458<e2><80><93>1469. (doi: 10.2135/cropsci2010.06.0343)
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 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | data(Maiz)
fm1 <-
bayes_ammi(
.data = Maiz
, .y = y
, .gen = entry
, .env = site
, .rep = rep
, .nIter = 20
)
names(fm1)
fm1$mu1
fm1$tau1
fm1$tao1
fm1$delta1
fm1$lambdas1
fm1$alphas1
fm1$gammas1
library(ggplot2)
Plot1Mu <-
ggplot(data = fm1$mu1, mapping = aes(x = 1:nrow(fm1$mu1), y = mu)) +
geom_line(color = "blue") +
scale_x_continuous(labels = scales::comma) +
scale_y_continuous(labels = scales::comma) +
labs(y = expression(mu), x = "Iterations") +
theme_bw()
print(Plot1Mu)
Plot2Mu <-
ggplot(data = fm1$mu1, mapping = aes(mu)) +
geom_histogram() +
scale_x_continuous(labels = scales::comma) +
scale_y_continuous(labels = scales::comma) +
labs(y = "Frequency", x = expression(mu)) +
theme_bw()
print(Plot2Mu)
Plot1Sigma2 <-
ggplot(data = fm1$tau1, mapping = aes(x = 1:nrow(fm1$tau1), y = tau)) +
geom_line(color = "blue") +
scale_x_continuous(labels = scales::comma) +
scale_y_continuous(labels = scales::comma) +
labs(y = expression(sigma^2), x = "Iterations") +
theme_bw()
print(Plot1Sigma2)
Plot2Sigma2 <-
ggplot(data = fm1$tau1, mapping = aes(tau)) +
geom_histogram() +
scale_x_continuous(labels = scales::comma) +
scale_y_continuous(labels = scales::comma) +
labs(y = "Frequency", x = expression(sigma^2)) +
theme_bw()
print(Plot2Sigma2)
# Plot of Alphas
Plot1Alpha1 <-
ggplot(data = fm1$tao1, mapping = aes(x = 1:nrow(fm1$tao1), y = tao1)) +
geom_line(color = "blue") +
scale_x_continuous(labels = scales::comma) +
scale_y_continuous(labels = scales::comma) +
labs(y = expression(alpha[1]), x = "Iterations") +
theme_bw()
print(Plot1Alpha1)
Plot2Alpha1 <-
ggplot(data = fm1$tao1, mapping = aes(tao1)) +
geom_histogram() +
scale_x_continuous(labels = scales::comma) +
scale_y_continuous(labels = scales::comma) +
labs(y = "Frequency", x = expression(alpha[1])) +
theme_bw()
print(Plot2Alpha1)
Plot1Alpha2 <-
ggplot(data = fm1$tao1, mapping = aes(x = 1:nrow(fm1$tao1), y = tao2)) +
geom_line(color = "blue") +
scale_x_continuous(labels = scales::comma) +
scale_y_continuous(labels = scales::comma) +
labs(y = expression(alpha[2]), x = "Iterations") +
theme_bw()
print(Plot1Alpha2)
Plot2Alpha2 <-
ggplot(data = fm1$tao1, mapping = aes(tao2)) +
geom_histogram() +
scale_x_continuous(labels = scales::comma) +
scale_y_continuous(labels = scales::comma) +
labs(y = "Frequency", x = expression(alpha[2])) +
theme_bw()
print(Plot2Alpha2)
# Plot of Betas
Plot1Beta1 <-
ggplot(data = fm1$delta1, mapping = aes(x = 1:nrow(fm1$delta1), y = delta1)) +
geom_line(color = "blue") +
scale_x_continuous(labels = scales::comma) +
scale_y_continuous(labels = scales::comma) +
labs(y = expression(beta[1]), x = "Iterations") +
theme_bw()
print(Plot1Beta1)
Plot2Beta1 <-
ggplot(data = fm1$delta1, mapping = aes(delta1)) +
geom_histogram() +
scale_x_continuous(labels = scales::comma) +
scale_y_continuous(labels = scales::comma) +
labs(y = "Frequency", x = expression(beta[1])) +
theme_bw()
print(Plot2Beta1)
Plot1Beta2 <-
ggplot(data = fm1$delta1, mapping = aes(x = 1:nrow(fm1$delta1), y = delta2)) +
geom_line(color = "blue") +
scale_x_continuous(labels = scales::comma) +
scale_y_continuous(labels = scales::comma) +
labs(y = expression(beta[2]), x = "Iterations") +
theme_bw()
print(Plot1Beta2)
Plot2Beta2 <-
ggplot(data = fm1$delta1, mapping = aes(delta2)) +
geom_histogram() +
scale_x_continuous(labels = scales::comma) +
scale_y_continuous(labels = scales::comma) +
labs(y = "Frequency", x = expression(beta[2])) +
theme_bw()
print(Plot2Beta2)
Plot1Beta3 <-
ggplot(data = fm1$delta1, mapping = aes(x = 1:nrow(fm1$delta1), y = delta3)) +
geom_line(color = "blue") +
scale_x_continuous(labels = scales::comma) +
scale_y_continuous(labels = scales::comma) +
labs(y = expression(beta[3]), x = "Iterations") +
theme_bw()
print(Plot1Beta3)
Plot2Beta3 <-
ggplot(data = fm1$delta1, mapping = aes(delta3)) +
geom_histogram() +
scale_x_continuous(labels = scales::comma) +
scale_y_continuous(labels = scales::comma) +
labs(y = "Frequency", x = expression(beta[3])) +
theme_bw()
print(Plot2Beta3)
BiplotAMMI <-
ggplot(data = fm1$alphas0, mapping = aes(x = alphas1, y = alphas2)) +
geom_point() +
geom_hline(yintercept = 0) +
geom_vline(xintercept = 0) +
geom_text(aes(label = 1:nrow(fm1$alphas0)),
vjust = "inward", hjust = "inward") +
geom_point(data = fm1$gammas0, mapping = aes(x = gammas1, y = gammas2)) +
geom_segment(data = fm1$gammas0,
aes(x = 0, y = 0, xend = gammas1, yend = gammas2),
arrow = arrow(length = unit(0.2, "cm"))
, alpha = 0.75, color = "red") +
geom_text(data = fm1$gammas0,
aes(x = gammas1, y = gammas2,
label = paste0("E", 1:nrow(fm1$gammas0))),
vjust = "inward", hjust = "inward") +
scale_x_continuous(
limits = c(-max(abs(c(range(fm1$alphas0[, 1:2], fm1$gammas0[, 1:2]))))
, max(abs(c(range(fm1$alphas0[, 1:2], fm1$gammas0[, 1:2])))))) +
scale_y_continuous(
limits = c(-max(abs(c(range(fm1$alphas0[, 1:2], fm1$gammas0[, 1:2]))))
, max(abs(c(range(fm1$alphas0[, 1:2], fm1$gammas0[, 1:2])))))) +
labs(title = "MCO Method", x = expression(PC[1]), y = expression(PC[2])) +
theme_bw() +
theme(plot.title = element_text(hjust = 0.5))
print(BiplotAMMI)
BiplotBayesAMMI <-
ggplot(data = fm1$alphas1, mapping = aes(x = alphas1, y = alphas2)) +
geom_point() +
geom_hline(yintercept = 0) +
geom_vline(xintercept = 0) +
geom_text(aes(label = 1:nrow(fm1$alphas1)),
vjust = "inward", hjust = "inward") +
geom_point(data = fm1$gammas1, mapping = aes(x = gammas1, y = gammas2)) +
geom_segment(data = fm1$gammas1,
aes(x = 0, y = 0, xend = gammas1, yend = gammas2),
arrow = arrow(length = unit(0.2, "cm"))
, alpha = 0.75, color = "red") +
geom_text(data = fm1$gammas1,
aes(x = gammas1, y = gammas2,
label = paste0("E", 1:nrow(fm1$gammas1))),
vjust = "inward", hjust = "inward") +
scale_x_continuous(
limits = c(-max(abs(c(range(fm1$alphas1[, 1:2], fm1$gammas1[, 1:2]))))
, max(abs(c(range(fm1$alphas1[, 1:2], fm1$gammas1[, 1:2])))))) +
scale_y_continuous(
limits = c(-max(abs(c(range(fm1$alphas1[, 1:2], fm1$gammas1[, 1:2]))))
, max(abs(c(range(fm1$alphas1[, 1:2], fm1$gammas1[, 1:2])))))) +
labs(title = "Bayesian Method", x = expression(PC[1]), y = expression(PC[2])) +
theme_bw() +
theme(plot.title = element_text(hjust = 0.5))
print(BiplotBayesAMMI)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.