Ad Code

R Script for AMMI BLUP OR GGE BLUP


library(metan) 

**Inspection: 
inspect <-  
inspect(stability, 
        verbose = FALSE, 
        plot = TRUE) 
print_table(inspect) 

**Analysis of single experiments using mixed-models: 
gen_mod <- gamem(stability, GEN, REP, 
                 resp = c(C1, C2, C3, C4, C5)) 
get_model_data(gen_mod, "details") %>% print_table() 

**Likelihood ratio test for genotype effect: 
get_model_data(gen_mod, "lrt") %>% print_table() 

**Variance components and genetic parameters: 
get_model_data(gen_mod, "genpar") %>% print_table() 

**Predicted means 
get_model_data(gen_mod, "blupg") %>% print_table() 

**The BLUP model for MET trials 
mixed_mod <-  
  gamem_met(stabilty, 
            env = ENV, 
            gen = GEN, 
            rep = REP,   
            resp = everything(), 
            random = "gen", 
            verbose = TRUE) 

**Diagnostic plot for residuals 
plot(mixed_mod) 

**The normality of the random effects of genotype and interaction effects 
plot(mixed_mod, type = "re") 

**Printing the model outputs 
*Likelihood Ratio Tests 
data <- get_model_data(mixed_mod, "lrt") 
print_table(data) 

**Variance components and genetic parameters 
data <- get_model_data(mixed_mod) 
print_table(data) 

**BLUP for genotypes 
print_table(mixed_mod$C1$BLUPgen) 

**The function get_model_data() may be used to easily get the data from a model fitted with 
the function gamem_met(), especially when more than one variables are used. The following 
code return the predicted mean of each genotype for five variables of the data 
get_model_data(mixed_mod, what = "blupg") 

**Plotting the BLUP for genotypes 
library(ggplot2) 
a <- plot_blup(mixed_mod) 
b <- plot_blup(mixed_mod,  
               col.shape  =  c("gray20", "gray80"), 
               plot_theme = theme_metan(grid = "y")) + 
  coord_flip() 
arrange_ggplot(a, b, tag_levels = "a") 

**BLUP for genotypes X environment combination 
print_table(mixed_mod$C1$BLUPint) 

data <- get_model_data(mixed_mod, "details") 
print_table(data)  

(Nenv, the number of environments in the analysis; 
Ngen the number of genotypes in the analysis; 
mresp The value attributed to the highest value of the response variable after rescaling it; 
wresp The weight of the response variable for estimating the WAASBY index. 
Mean the grand mean; 
SE the standard error of the mean; 
SD the standard deviation. 
CV the coefficient of variation of the phenotypic means, estimating WAASB, 
Min the minimum value observed (returning the genotype and environment), 
Max the maximum value observed (returning the genotype and environment); 
MinENV the environment with the lower mean, 
MaxENV the environment with the larger mean observed, 
MinGEN the genotype with the lower mean, 
MaxGEN the genotype with the larger) 

**The WAASB object 
waasb_model <-  
  waasb(stability, 
        env = ENV, 
        gen = GEN, 
        rep = REP, 
        resp = everything(), 
        random = "gen", 
        verbose = TRUE) 

data <- waasb_model$C1$model 
print_table(data) 

**Eigenvalues of the BLUP_GEI matrix 
data <- waasb_model$C1$PCA 
print_table(data) 
plot_eigen(waasb_model, size.lab = 14, size.tex.lab = 14) 

**Phenotypic means 
data <- waasb_model$C1$MeansGxE 
print_table(data) 

**biplot type 1: GY x PC1 
c <- plot_scores(waasb_model, type = 1) 
d <- plot_scores(waasb_model, 
                 type = 1, 
                 col.gen = "black", 
                 col.env = "red", 
                 col.segm.env = "red", 
                 axis.expand = 1.5) 
arrange_ggplot(c, d, tag_levels = list(c("c", "d"))) 

**Simultaneous selection for mean performance and stability 
i <- plot_waasby(waasb_model) 
j <- plot_waasby(waasb_model, col.shape = c("gray20", "gray80")) 
arrange_ggplot(i, j, tag_levels = list(c("e", "f"))) 

**Others BLUP-based stability indexes 
Res_ind <-  
stability %>% 
gamem_met(ENV, GEN, REP, C1, verbose = FALSE) %>%  
blup_indexes() 
print_table(Res_ind$C1) 

**FAI-BLUP selection index 
stability %>% 
gamem(GEN, REP, everything()) %>% 
fai_blup() %>% 
plot()

Post a Comment

0 Comments

Close Menu