Utilizando modelos mistos para análise de ensaios multi-ambientes

Author

Benjamim Maoski Fabri e João Marcos Amario de Sousa

Published

November 18, 2025

Carregando pacotes e data

library(gt)
library(asreml)
Online License checked out Tue Nov 18 21:16:24 2025
library(sf)
library(rnaturalearth)
library(rnaturalearthdata)
library(rnaturalearthhires)
library(tidyverse)
library(ggspatial)
library(geobr)
library(ggplot2)
library(dplyr)
data.local <- read.csv("data_final.csv", header = T)
data.local$lon <- as.numeric(sub(",", ".", data.local$lon))
data.local$lat <- as.numeric(sub(",", ".", data.local$lat))
data <- read.csv("data_final.csv", header = T)
data <- transform(data,
                  gen = factor(gen),
                  block = factor(block),
                  rep = factor(rep),
                  env = factor(env),
                  GY = as.numeric(sub(",", ".", yield)))

Visão Geral

A análise dos dados foi feita com base em experimentos distribuidos pelas cinco regiões do Brasil, os únicos biomas que não foram abrangidos foi o pantanal e o pampa. Devido a isso, os híbridos foram avaliados em uma ampla variedade de condições edafoclimáticas. Desta forma, faz-se necessario utilizar modelos que consigam captar a interação do genotipo por ambitene (GEI) para seleção.

mapa_locais <- data.frame(
  Env = c("E01","E02","E03","E04","E05","E06","E07","E08","E09","E10",
          "E11","E12","E13","E14","E15","E16","E17","E18","E19","E20",
          "E21","E22","E23","E24","E25","E26","E27","E28","E29","E30",
          "E31","E32","E33","E34","E35","E36","E37","E38","E39","E40",
          "E41","E42","E43","E44","E45","E46","E47"),
  Local = c("Altamira","Altamira","Belterra","Belterra","Belterra",
            "Birigui","Birigui","Birigui","Boa Vista","Campo Mourão",
            "Campo Mourão","Campo Mourão","Campo Mourão","Conquista",
            "Goiania","Goiania","Ipangassu","Londrina","Londrina","Manaus",
            "Mata Roma","Mata Roma","Mata Roma","Mata Roma","Paragominas",
            "Paragominas","Paragominas","Patos","Patos","Planaltina",
            "Planaltina","Planaltina","Ponta Grossa","Rio Branco",
            "São Raimundo","São Raimundo","São Raimundo","São Raimundo",
            "São Sebastião Paraíso","Sete Lagoas","Sete Lagoas","Sete Lagoas",
            "Sete Lagoas","Sinop","Sobral","Teresina","Vilhena"),
  stringsAsFactors = FALSE)

data.local$env <- as.character(data.local$env)
data.local2 <- left_join(data.local, mapa_locais, by = c("env" = "Env"))

ordem_locais <- unique(mapa_locais$Local)   
data.local2$Local <- factor(data.local2$Local, levels = ordem_locais)

if(!("lon" %in% names(data.local2) && "lat" %in% names(data.local2))){
  stop("As colunas 'lon' e 'lat' não foram encontradas em data.local2.")
}
pts_sf <- st_as_sf(data.local2, coords = c("lon","lat"), crs = 4326, remove = FALSE)

br <- ne_countries(country = "Brazil", scale = "medium", returnclass = "sf")
estados <- ne_states(country = "Brazil", returnclass = "sf")
biomas <- geobr::read_biomes(year = 2019)

if ("name_biome" %in% names(biomas)) {
  biomas$bioma_nome <- biomas$name_biome
} else if ("name_bioma" %in% names(biomas)) {
  biomas$bioma_nome <- biomas$name_bioma
} else if ("biome" %in% names(biomas)) {
  biomas$bioma_nome <- biomas$biome
} else {
  stop("Não encontrei a coluna com o nome do bioma em 'biomas'.")
}

biomas <- biomas[!grepl("COSTEIR", toupper(biomas$bioma_nome)), ]

biomas$bioma_padronizado <- NA
biomas$bioma_padronizado[grepl("AMAZON", toupper(biomas$bioma_nome))] <- "Amazônia"
biomas$bioma_padronizado[grepl("CERRAD", toupper(biomas$bioma_nome))] <- "Cerrado"
biomas$bioma_padronizado[grepl("PANTAN", toupper(biomas$bioma_nome))] <- "Pantanal"
biomas$bioma_padronizado[grepl("MATA", toupper(biomas$bioma_nome)) |
                           grepl("ATLANT", toupper(biomas$bioma_nome))] <- "Mata Atlântica"
biomas$bioma_padronizado[grepl("CAATIN", toupper(biomas$bioma_nome)) |
                           grepl("CAATINGA", toupper(biomas$bioma_nome))] <- "Caatinga"
biomas$bioma_padronizado[grepl("PAMPA", toupper(biomas$bioma_nome))] <- "Pampa"
biomas$bioma_padronizado[is.na(biomas$bioma_padronizado)] <- biomas$bioma_nome[is.na(biomas$bioma_padronizado)]

crs_target <- 4326
br <- st_transform(br, crs = crs_target)
estados <- st_transform(estados, crs = crs_target)
pts_sf <- st_transform(pts_sf, crs = crs_target)
biomas <- st_transform(biomas, crs = crs_target)

cores_biomas <- c(
  "Amazônia"       = "#2ca25f",
  "Cerrado"        = "#fb6a4a",
  "Pantanal"       = "#fdae6b",
  "Mata Atlântica" = "#a1d99b",
  "Caatinga"       = "#2b8cbe",
  "Pampa"          = "#ffe066"
)
mapa <- ggplot() +
  geom_sf(data = biomas, aes(fill = bioma_padronizado), color = NA, alpha = 0.9, inherit.aes = FALSE) +
  geom_sf(data = br, inherit.aes = FALSE, fill = NA, color = "gray50", size = 0.2) +
  geom_sf(data = estados, inherit.aes = FALSE, fill = NA, color = "gray70", size = 0.2) +
  geom_sf(data = pts_sf, inherit.aes = FALSE, aes(color = Local), size = 3, alpha = 0.95) +   # <- aqui
  scale_fill_manual(name = "Biomas", values = cores_biomas, na.value = "grey80") +
  scale_color_viridis_d(name = "Locais (municípios)") +   # legenda já mostrará os nomes em 'Local'
  labs(title = "Locais de Experimentação",
       x = "Longitude", y = "Latitude") +
  theme_minimal() +
  theme(plot.title = element_text(hjust = 0.5),
        legend.position = "right",
        legend.title = element_text(size = 10),
        legend.text = element_text(size = 8)) +
  annotation_north_arrow(location = "bl", which_north = "true", style = north_arrow_nautical())

Mapa dos Ambientes Experimentados

Análises individuais

As análises de cada ambiente foram feitas no software R (R Core Team 2022), utilizando modelos lineares mistos (Henderson 1949, 1950) com o pacote ASRelm-R package (Butler 2021). Os componentes residuais foram estimados utilizando o teste de máxima verossimilhança (LRT-test) (Patterson e Thompson 1971).

Modelo utilizado:

\[ \mathbf{y} = \mathbf{X}\boldsymbol{\beta} + \mathbf{Zg} + \boldsymbol{\varepsilon} \] \(\mathbf{y}\) é o vetor fenotipico, \(\boldsymbol{\beta}\) é o vetor de efeitos fixos repetição e bloco com incidência na matriz \(\mathbf{X}\), \(\mathbf{g}\) é o vetor de efeito aleatorio de genotipo com incidência na matriz \(\mathbf{Z}\), \(\boldsymbol{\varepsilon}\) é o vetor residual.

O teste de significânia para efeitos aleatorios foi o LRT, expresso pela fórmula:

\[ LRT = 2 \ln(L_c) - 2 \ln(L_t) \] \(\ln(L_c)\) é o modelo log-verossimilhança do modelo completo, \(\ln(L_t)\) é o modelo log-verossimilhança do modelo reduzido. \(L\) é o ponto de máxima verossimilhança da função.

E10 <- droplevels(subset(data, env == "E10"))
str(E10)
'data.frame':   72 obs. of  22 variables:
 $ X.1         : int  649 650 651 652 653 654 655 656 657 658 ...
 $ X           : int  649 650 651 652 653 654 655 656 657 658 ...
 $ ID          : int  17537 17538 17539 17540 17541 17542 17543 17544 17545 17546 ...
 $ Year        : int  2010 2010 2010 2010 2010 2010 2010 2010 2010 2010 ...
 $ plant       : chr  "2010-11-01" "2010-11-01" "2010-11-01" "2010-11-01" ...
 $ harv        : chr  "2011-04-06" "2011-04-06" "2011-04-06" "2011-04-06" ...
 $ Trial       : logi  FALSE FALSE FALSE FALSE FALSE FALSE ...
 $ Set         : chr  "TC2" "TC2" "TC2" "TC2" ...
 $ Region      : chr  "TR" "TR" "TR" "TR" ...
 $ env         : Factor w/ 1 level "E10": 1 1 1 1 1 1 1 1 1 1 ...
 $ Location    : chr  "CAMPO_MOURAO" "CAMPO_MOURAO" "CAMPO_MOURAO" "CAMPO_MOURAO" ...
 $ lat         : chr  "-24,0434" "-24,0434" "-24,0434" "-24,0434" ...
 $ lon         : chr  "-52,2225" "-52,2225" "-52,2225" "-52,2225" ...
 $ Season      : chr  "S1" "S1" "S1" "S1" ...
 $ rep         : Factor w/ 2 levels "1","2": 1 1 1 1 1 1 1 1 1 1 ...
 $ block       : Factor w/ 12 levels "1","2","3","4",..: 5 1 2 1 6 4 5 3 4 6 ...
 $ gen         : Factor w/ 36 levels "AG7088","F_16_23",..: 31 29 8 6 22 12 23 13 19 25 ...
 $ Pedigree_NEW: chr  "[ NB5318_4.2_1_1S5 ] X [ L3 ]" "[ (228_3x45611)x228_3)_2_4)x228_3)_1_1S2 ] X [ L3 ]" "[ (531636X521549) ] X [ (521237x521236) ]" "[ (542161X521237) ] X [ (530921x521280) ]" ...
 $ yield       : chr  "9,4" "11,69" "12,83" "11,84" ...
 $ Tester      : chr  "" "L3" "" "" ...
 $ Type        : chr  "" "HS" "" "" ...
 $ GY          : num  9.4 11.7 12.8 11.8 11.6 ...
mod10 <- asreml(fixed = GY ~ rep + block,
                random = ~ gen,
                data = E10)
ASReml Version 4.2 18/11/2025 21:16:35
          LogLik        Sigma2     DF     wall
 1     -69.83209      2.404957     60   21:16:35
 2     -64.99932      1.499783     60   21:16:35
 3     -62.06769     0.9953132     60   21:16:35
 4     -61.30309     0.8021010     60   21:16:35
 5     -61.22522     0.7382731     60   21:16:35
 6     -61.22517     0.7366210     60   21:16:35
mod.red10 <- asreml(fixed = GY ~ rep + block,
                    data = E10)
ASReml Version 4.2 18/11/2025 21:16:35
          LogLik        Sigma2     DF     wall
 1     -71.60645      2.796951     60   21:16:35
test.lrt10 <- lrt.asreml(mod10,mod.red10)  


tab.var10 <- summary(mod10)$varcomp
VarRe10 <- tab.var10["units!R", "component"]
VarG10 <- tab.var10["gen", "component"]     


Des10 <- sqrt(VarRe10)      
mean_010 <- mean(E10$GY, na.rm = TRUE) 
CV10 <- (Des10/mean_010)*100 


Her10 <- tab.var10["gen", "component"]/(VarG10 + VarRe10/2) 

tabela_E10 <- data.frame(
  Env  = "E10",
  VarG = VarG10,
  VarRe = VarRe10,
  GY = mean_010,
  CV = CV10,
  H2 = Her10) 

Exeplo de tabela feita para cada ambiente

  Env     VarG    VarRe       GY      CV        H2
1 E10 1.974597 0.736621 11.11722 7.72015 0.8427977

Compilação dos parâmentros genéticos e estátisticos de todos os ambientes

Resultados por Ambiente
Env VarG VarRe GY CV H2 LRT.Test
E01 1.03 0.68 10.20 8.10 0.75 *
E02 0.37 0.97 7.06 13.93 0.43 N-sig
E03 1.71 0.86 7.70 12.04 0.80 *
E04 2.19 1.39 7.06 16.74 0.76 *
E05 0.47 0.72 6.11 13.88 0.57 *
E06 1.00 1.33 7.92 14.58 0.60 *
E07 1.34 1.02 5.47 18.50 0.72 *
E08 0.80 1.15 5.27 20.32 0.58 *
E09 0.54 0.33 3.72 15.53 0.77 *
E10 1.97 0.74 11.12 7.72 0.84 *
E11 0.00 1.65 10.76 11.95 0.00 N-sig
E12 0.00 2.14 11.25 12.99 0.00 N-sig
E13 0.70 0.54 11.79 6.23 0.72 *
E14 2.10 2.05 11.83 12.09 0.67 *
E15 0.55 0.82 8.81 10.31 0.57 *
E16 0.25 1.20 6.51 16.83 0.29 N-sig
E17 0.97 1.15 8.08 13.28 0.63 *
E18 1.81 1.71 8.98 14.57 0.68 *
E19 1.00 1.01 8.26 12.18 0.66 *
E20 1.22 0.77 5.91 14.83 0.76 *
E21 0.20 0.69 9.21 9.00 0.37 N-sig
E22 0.47 0.40 7.29 8.71 0.70 *
E23 0.64 0.13 6.73 5.41 0.91 *
E24 0.55 0.30 8.24 6.59 0.79 *
E25 0.94 0.62 5.30 14.88 0.75 *
E26 2.08 0.95 5.17 18.89 0.81 *
E27 0.39 0.53 6.52 11.18 0.60 *
E28 0.25 1.07 11.02 9.38 0.32 N-sig
E29 0.43 0.64 12.40 6.45 0.57 *
E30 2.23 0.41 11.19 5.69 0.92 *
E31 0.55 0.95 12.26 7.95 0.54 *
E32 1.04 1.14 13.23 8.08 0.64 *
E33 3.76 1.86 11.52 11.84 0.80 *
E34 0.50 0.44 6.89 9.60 0.70 *
E35 0.35 0.93 9.21 10.48 0.43 N-sig
E36 0.90 0.19 8.91 4.84 0.91 *
E37 0.78 0.74 8.11 10.64 0.68 *
E38 0.41 0.74 9.13 9.45 0.53 *
E39 3.11 0.88 11.05 8.50 0.88 *
E40 1.77 0.51 9.13 7.86 0.87 *
E41 0.64 2.52 10.30 15.40 0.34 N-sig
E42 1.04 0.99 11.24 8.84 0.68 *
E43 0.79 1.58 9.38 13.39 0.50 *
E44 0.82 0.96 8.36 11.69 0.63 *
E45 0.03 0.89 4.43 21.33 0.06 N-sig
E46 1.42 1.39 10.90 10.80 0.67 *
E47 0.54 0.26 7.31 6.99 0.81 *

O ambiente 32 teve a maior média de produtividade (GY) 13.230 kg/ha, o ambiente 09 teve a menor média de produtividade 3.720 kg/ha. O coeficiente de variação (CV) foi entre 4,48% e 21,33%. A herdabilidade (H2) nos ambientes significativos foi entre 0,5 e 0,92. “VarG” é a variância genotipica, “VarRe” é a variância residual, ambas calculadas pelo modelo descrito acima.

Mapa com os ambientes não significativos

Estes locais foram mantidos para aumentar o número de locais em que os híbridos foram avaliados.