Uso de GGE

carregar pacote

require(gsheet)

Dados para os exemplos, baixados de documento online compartilhado.

url <- 'https://docs.google.com/spreadsheets/d/10fU37FA-z-sQNloj8tbhyeqCsgbV-cXkaM4Rbi84kWU/edit?usp=sharing'
dados <- gsheet2tbl(url)

Exemplo de chamada de dados do computador

  dados=read.table("C:/Rafael/Documentos/Experimentos/AprendizadoR/exemplos/GGE.txt", header = T, dec=".", sep="    ")

Análises descritivas

overall.mean<-mean(dados$produtividade)
overall.mean
## [1] 118.9776
envir.mean<-tapply(dados$produtividade,dados$ano,mean)
envir.mean
##        1        2        3 
## 128.5829 118.5729 109.7771
var.mean<-tapply(dados$produtividade,dados$genotipo,mean)
var.mean
##         1         2         3         4         5         6         7 
## 100.79444 100.70333  99.83667 102.46556 109.04444 121.54111 122.65556 
##         8         9        10        11        12        13        14 
## 123.58667 125.65222 124.58111 126.21778 131.62778 130.55333 132.72000 
##        15 
## 132.68444
int.mean<-tapply(dados$produtividade,list(dados$genotipo,dados$ano),mean)
int.mean
##           1         2         3
## 1  107.3867  97.25333  97.74333
## 2  114.8633  94.37000  92.87667
## 3  116.7633  92.25667  90.49000
## 4  100.6400 103.85333 102.90333
## 5  124.4167 105.62333  97.09333
## 6  134.7967 121.41000 108.41667
## 7  134.8500 127.49000 105.62667
## 8  135.5433 127.13333 108.08333
## 9  136.4167 124.36667 116.17333
## 10 136.7967 130.55667 106.39000
## 11 135.1067 122.44000 121.10667
## 12 140.6767 128.11667 126.09000
## 13 135.5100 131.27333 124.87667
## 14 132.9467 134.95667 130.25667
## 15 142.0300 137.49333 118.53000
envir.num<-length(envir.mean)
envir.num
## [1] 3
var.num<-length(var.mean)
var.num
## [1] 15

Anova - Modelo aditivo

  • fatores
genotipo<-factor(dados$genotipo)
ano<-factor(dados$ano)
bloco<-factor(dados$bloco)
  • modelo
add.anova<-aov(dados$produtividade~ano+bloco%in%ano+genotipo+ano:genotipo)
add.anova.residual.SS<-deviance(add.anova)
add.anova.residual.DF<-add.anova$df.residual
add.anova.residual.MS<-add.anova.residual.SS/add.anova.residual.DF
anova.table<-summary(add.anova)
anova.table
##              Df Sum Sq Mean Sq F value  Pr(>F)    
## ano           2   7968    3984 234.571 < 2e-16 ***
## genotipo     14  20185    1442  84.885 < 2e-16 ***
## ano:bloco     6     87      14   0.850   0.535    
## ano:genotipo 28   3274     117   6.884 2.7e-12 ***
## Residuals    84   1427      17                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Tabela com os efeitos do genótipo X ambiente

row.names(anova.table[[1]])<-c("Environments","Genotypes","Bloco(ano)","Environments x Genotypes", "Residuals")
ge.anova<-aov(dados$produtividade~ano+ano:genotipo)
ge.anova
## Call:
##    aov(formula = dados$produtividade ~ ano + ano:genotipo)
## 
## Terms:
##                       ano ano:genotipo Residuals
## Sum of Squares   7968.346    23458.702  1513.317
## Deg. of Freedom         2           42        90
## 
## Residual standard error: 4.100564
## Estimated effects may be unbalanced
ge.eff<-model.tables(ge.anova,type="effects",cterms="ano:genotipo")$tables$"ano:genotipo"
ge.eff
##    genotipo
## ano 1          2          3          4          5          6         
##   1 -21.196222 -13.719556 -11.819556 -27.942889  -4.166222   6.213778
##   2 -21.319556 -24.202889 -26.316222 -14.719556 -12.949556   2.837111
##   3 -12.033778 -16.900444 -19.287111  -6.873778 -12.683778  -1.360444
##    genotipo
## ano 7          8          9          10         11         12        
##   1   6.267111   6.960444   7.833778   8.213778   6.523778  12.093778
##   2   8.917111   8.560444   5.793778  11.983778   3.867111   9.543778
##   3  -4.150444  -1.693778   6.396222  -3.387111  11.329556  16.312889
##    genotipo
## ano 13         14         15        
##   1   6.927111   4.363778  13.447111
##   2  12.700444  16.383778  18.920444
##   3  15.099556  20.479556   8.752889
Decomposição de valores singulares
dec <- svd(ge.eff, nu = 2, nv = 2)
if (2 > 1){ 
D <- diag(dec$d[1:2]) 
} else {
D <- dec$d[1:2]
}
E<-dec$u%*%sqrt(D)
G<-dec$v%*%sqrt(D)
Ecolnumb<-c(1:2)
Ecolnames<-paste("2",Ecolnumb,sep="")
dimnames(E)<-list(levels(ano),Ecolnames)
dimnames(G)<-list(levels(genotipo),Ecolnames)

Valores de significância dos componentes principais

svalues<-dec$d
PC.n<-c(1:length(svalues))
PC.SS<-svalues^2
percSS<-PC.SS/sum(PC.SS)*100
GGE.table <-data.frame("PC"=PC.n,"Singular_value"=svalues,"PC_SS"=PC.SS, "Perc_of_Total_SS"=percSS)
GGE.table
##   PC Singular_value     PC_SS Perc_of_Total_SS
## 1  1       82.80453 6856.5907        87.685040
## 2  2       26.81156  718.8600         9.193092
## 3  3       15.62423  244.1166         3.121868
numblock<-length(levels(rep))
GGE.SS<-(t(as.vector(ge.eff))%*%as.vector(ge.eff))*numblock

Plotar GGE Biplot

plot(1,type='n',xlim=range(c(E[,1],G[,1])),ylim=range(c(E[,2],G[,2])),xlab="PC 1",ylab="PC 2")
points(E[,1],E[,2],"n",col="red",lwd=5)
text(E[,1],E[,2],labels=row.names(E),adj=c(0.5,0.5),col="red")
points(G[,1],G[,2], "n", col="blue",lwd=5)
text(G[,1],G[,2],labels=row.names(G),adj=c(0.5,0.5),col="blue")
abline(h=0)
abline(v=0)

Resultados

list(Genotype_means=var.mean, Environment_means=envir.mean, Interaction_means=int.mean, 
GE_effect=ge.eff, Additive_ANOVA=anova.table, "GGE_Sum of Squares"=GGE.SS, 
GGE_summary = GGE.table, Environment_scores=E, "Genotype_scores"=G)
## $Genotype_means
##         1         2         3         4         5         6         7 
## 100.79444 100.70333  99.83667 102.46556 109.04444 121.54111 122.65556 
##         8         9        10        11        12        13        14 
## 123.58667 125.65222 124.58111 126.21778 131.62778 130.55333 132.72000 
##        15 
## 132.68444 
## 
## $Environment_means
##        1        2        3 
## 128.5829 118.5729 109.7771 
## 
## $Interaction_means
##           1         2         3
## 1  107.3867  97.25333  97.74333
## 2  114.8633  94.37000  92.87667
## 3  116.7633  92.25667  90.49000
## 4  100.6400 103.85333 102.90333
## 5  124.4167 105.62333  97.09333
## 6  134.7967 121.41000 108.41667
## 7  134.8500 127.49000 105.62667
## 8  135.5433 127.13333 108.08333
## 9  136.4167 124.36667 116.17333
## 10 136.7967 130.55667 106.39000
## 11 135.1067 122.44000 121.10667
## 12 140.6767 128.11667 126.09000
## 13 135.5100 131.27333 124.87667
## 14 132.9467 134.95667 130.25667
## 15 142.0300 137.49333 118.53000
## 
## $GE_effect
##    genotipo
## ano 1          2          3          4          5          6         
##   1 -21.196222 -13.719556 -11.819556 -27.942889  -4.166222   6.213778
##   2 -21.319556 -24.202889 -26.316222 -14.719556 -12.949556   2.837111
##   3 -12.033778 -16.900444 -19.287111  -6.873778 -12.683778  -1.360444
##    genotipo
## ano 7          8          9          10         11         12        
##   1   6.267111   6.960444   7.833778   8.213778   6.523778  12.093778
##   2   8.917111   8.560444   5.793778  11.983778   3.867111   9.543778
##   3  -4.150444  -1.693778   6.396222  -3.387111  11.329556  16.312889
##    genotipo
## ano 13         14         15        
##   1   6.927111   4.363778  13.447111
##   2  12.700444  16.383778  18.920444
##   3  15.099556  20.479556   8.752889
## 
## $Additive_ANOVA
##                          Df Sum Sq Mean Sq F value  Pr(>F)    
## Environments              2   7968    3984 234.571 < 2e-16 ***
## Genotypes                14  20185    1442  84.885 < 2e-16 ***
## Bloco(ano)                6     87      14   0.850   0.535    
## Environments x Genotypes 28   3274     117   6.884 2.7e-12 ***
## Residuals                84   1427      17                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## $`GGE_Sum of Squares`
##      [,1]
## [1,]    0
## 
## $GGE_summary
##   PC Singular_value     PC_SS Perc_of_Total_SS
## 1  1       82.80453 6856.5907        87.685040
## 2  2       26.81156  718.8600         9.193092
## 3  3       15.62423  244.1166         3.121868
## 
## $Environment_scores
##          21         22
## 1 -4.771540  3.4022180
## 2 -6.234129  0.2701354
## 3 -4.601366 -3.8940343
## 
## $Genotype_scores
##            21         22
## 1   3.4952109 -1.1567170
## 2   3.5518886  0.4697948
## 3   3.7341346  1.0362329
## 4   3.1003495 -2.6957527
## 5   1.9198370  1.1830170
## 6  -0.4960635  1.0146610
## 7  -0.8018459  1.4878982
## 8  -0.9514608  1.2154851
## 9  -1.2430443  0.1234622
## 10 -1.1873197  1.6549513
## 11 -1.2966437 -0.7786834
## 12 -2.3219099 -0.7384563
## 13 -2.1944183 -1.1860481
## 14 -2.6229780 -2.2555838
## 15 -2.6857367  0.6257388

Rafael Henrique Pertille