Ad Code

R Script for AMMI Model


install.packages(metan) 
install.packages(devtools) 
install.packages(ggplot2) 
install.packages(kableExtra) # used in this material to make tables 
install.packages(cowplot) # used in this material to arrange the graphics 
install.packages(magrittr) # To use the forward-pipe operator %>% 

library(metan) 
library(devtools) 
library(ggplot2) 
library(kableExtra) # used in this material to make tables 
library(cowplot) # used in this material to arrange the graphics 
library(magrittr) # To use the forward-pipe operator %>% 

ammiout <- performs_ammi(stability, ENV, GEN, REP, C1) 
ammiout 

ammianova <- ammiout$C1$ANOVA 
ammianova 

ammipca <- ammiout$C1$PCA 
ammipca 

ammimeans <- ammiout$C1$MeansGxE 
ammimeans 

sheets <- list(
  "ammianova" = ammianova,
  "ammipca" = ammipca,
  "ammimeans" = ammimeans
) 
write_xlsx(sheets, "ammistabilitytp.xlsx") 

AMMI_model <- performs_ammi(stability, ENV, GEN, REP, C1) 
print(AMMI_model, digits = 2) 

############################################# 
plot_scores(
  AMMI_model,
  col.gen = "blue",
  col.env = "red",
  col.segm.env = "red",
  plot_theme = theme_metan_minimal()
) 

################################################ 
plot_scores(
  AMMI_model,
  type = 2,
  col.gen = "blue",
  col.env = "red",
  polygon = TRUE,
  col.segm.env = "red",
  axis.expand = 1,
  plot_theme = theme_metan(grid = "both")
) + theme_bw() 

install.packages("ammistability", dependencies = TRUE) 
library(ammistability) 
library(agricolae) 

model <- with(stability, AMMI(ENV, GEN, REP, C1, console = FALSE)) 
model$ANOVA 
model$analysis 
model$biplot 

model <- with(stability, AMMI(ENV, GEN, REP, C1, console = FALSE)) 
ammistability(
  model,
  AMGE = TRUE,
  ASI = FALSE,
  ASV = TRUE,
  ASTAB = FALSE,
  AVAMGE = FALSE,
  DA = FALSE,
  DZ = FALSE,
  EV = TRUE,
  FA = FALSE,
  MASI = FALSE,
  MASV = TRUE,
  SIPC = TRUE,
  ZA = FALSE
) 

################################################# 
################################################# 
################################################# 
################################################# 

**ammi based on weighted average of absolute scores** 

waasammi <- waas(stability, ENV, GEN, REP, C1) 
waasammi 

waasanova <- waasammi$C1$ANOVA 
waasanova 

waasmodel <- waasammi$C1$model 
waasmodel 

sheets <- list(
  "waasanova" = waasanova,
  "waasmodel" = waasmodel
) 
write_xlsx(sheets, "waasammi.xlsx") 

wassplot1 <- plot_scores(waasammi, type = 3) 
wassplot1

Post a Comment

0 Comments

Close Menu