r i = {{i}}
lc <- check.met(traits[i], geno, env, rep, data) if (lc$c3 == 0) data$est <- mvemet(traits[i], geno, env, rep, data, maxp)[, 5] else data$est <- data[, traits[i]]
r traits[i]
r if(lc$c3 == 1) {"There are no missing values for this trait; the design es balanced."}
r if(lc$c3 == 0) paste("There are some missing values (", format(lc$pmis * 100, digits = 3), "%) and they have been estimated for the descriptive statistics, ANOVA, regression stability analysis and Tai sections.")
tapply(data$est, data[, geno], mean)
tapply(data$est, data[, env], mean)
tapply(data$est, list(data[, geno], data[, env]), mean)
As it was stated in section 1, it is supposed that the error has a normal distribution with the same variance for all the genotypes and evironments. The following plots help to evaluate this assumptions:
model <- aov(data[, traits[i]] ~ data[, geno] + data[, env] + data[, rep] %in% data[, env] + data[, geno]:data[, env]) par(mfrow = c(1, 2)) suppressWarnings(plot(model, which = 1)) suppressWarnings(plot(model, which = 2))
Funnel shapes for the first plot may suggest heterogeneity of variances while departures from the theoretical normal line are symptoms of lack of normality.
For this analysis it is assumed that genotypes and environments have fixed effects and that the blocks are random.
at <- suppressWarnings(aovmet(traits[i], geno, env, rep, data, maxp)) at
The coefficient of variation for this experiment is r format(agricolae::cv.model(model), digits = 4)
%.
The p-values for the model are:
r format(at[1, 5], digits = 4)
for genotypes r if(at[1, 5] < 0.05) {"which is significant at the 5% level."} else {"which is not significant at the 5% level."}
r format(at[2, 5], digits = 4)
for environments r if(at[2, 5] < 0.05) {"which is significant at the 5% level."} else {"which is not significant at the 5% level."}
r format(at[4, 5], digits = 4)
for the genotypes by environments interaction r if(at[4, 5] < 0.05) {"which is significant at the 5% level."} else {"which is not significant at the 5% level."}
Under the assumption that all the factors (genotypes, environments, and blocks) have random effects, below it is shown the variance components estimation. Here the model is estimated by REML (Restricted Maximum Likelihood) and the original data without the estimation of missing values is used.
y <- data[, traits[i]] fg <- data[, geno] fe <- data[, env] fr <- data[, rep] ff <- as.formula(y ~ (1|fg) + (1|fg:fe) + (1|fe/fr)) model.reml <- lme4::lmer(ff) vc <- data.frame(lme4::VarCorr(model.reml)) vg <- vc[vc[, 1] == "fg", 4] vgxe <- vc[vc[, 1] == "fg:fe", 4] vr <- vc[vc[, 1] == "Residual", 4] vc[vc[, 1] == "fg", 1] <- geno vc[vc[, 1] == "fe", 1] <- env vc[vc[, 1] == "fg:fe", 1] <- paste(geno, ":", env, sep = "") vc[vc[, 1] == "fr:fe", 1] <- paste(rep, "(", env, ")", sep = "") rownames(vc) <- vc[, 1] vc <- vc[, c(4, 5)] colnames(vc) <- c("Variance", "Std.Dev.") h2 <- vg / (vg + vgxe / lc$ne + vr / lc$ne / lc$nr) * 100 vc
With these variance estimates, the broad sense heritability results r paste(format(h2, digits = 4), "%", sep = "")
.
r if(at[4, 5] > 0.05) {"Because interaction is non significant a stability analysis is not presented."}
r if(at[4, 5] < 0.05) {"Because interaction is significant a stability analysis is presented."}
r if(at[4, 5] < 0.05) {paste("### ", {{i+1}}, ".3.1. AMMI", sep = "")}
r if(at[4, 5] < 0.05) {"#### AMMI biplots"}
if(at[4, 5] < 0.05) { ammimodel <- suppressWarnings(ammi(traits[i], geno, env, rep, data)) plot(ammimodel, biplot = 1) }
if(at[4, 5] < 0.05) { plot(ammimodel, biplot = 2) }
r if(at[4, 5] < 0.05) {"#### Interaction effects"}
if(at[4, 5] < 0.05) ammimodel$Interaction_effects
r if(at[4, 5] < 0.05) {"#### PC-values for genotypes"}
if(at[4, 5] < 0.05) ammimodel$PC_values_genotypes
r if(at[4, 5] < 0.05) {"#### PC-values for environments"}
if(at[4, 5] < 0.05) ammimodel$PC_values_environments
r if(at[4, 5] < 0.05) {"#### PC contributions"}
if(at[4, 5] < 0.05) ammimodel$Contribution_PCs
r if(at[4, 5] < 0.05) {paste("### ", {{i+1}}, ".3.2. GGE", sep = "")}
r if(at[4, 5] < 0.05) {"#### GGE biplots"}
if(at[4, 5] < 0.05) { ggemodel <- suppressWarnings(ammi(traits[i], geno, env, rep, data, method = "GGE")) plot(ggemodel, biplot = 1) }
if(at[4, 5] < 0.05) { plot(ggemodel, biplot = 2) }
r if(at[4, 5] < 0.05) {"#### PC-values for genotypes"}
if(at[4, 5] < 0.05) ggemodel$PC_values_genotypes
r if(at[4, 5] < 0.05) {"#### PC-values for environments"}
if(at[4, 5] < 0.05) ggemodel$PC_values_environments
r if(at[4, 5] < 0.05) {"#### PC contributions"}
if(at[4, 5] < 0.05) ggemodel$Contribution_PCs
r if(at[4, 5] < 0.05) {paste("### ", {{i+1}}, ".3.3. Regression Stability Analysis", sep = "")}
if(at[4, 5] < 0.05) { rsamodel <- suppressWarnings(rsa(traits[i], geno, env, rep, data)) }
r if(at[4, 5] < 0.05) {"#### ANOVA"}
if(at[4, 5] < 0.05) rsamodel$ANOVA
r if(at[4, 5] < 0.05) {"#### Stability measures for genotypes"}
if(at[4, 5] < 0.05) rsamodel$Stability_for_genotypes
r if(at[4, 5] < 0.05) {"Here: \n
- a is the linear regression intercept, \n
- b is the linear regression slope, \n
- se is the slope standard error, \n
- MSe is the error mean square, \n
- MSentry is the variance of the means, and \n
- MSinter is the variance of the interaction effects. \n
The same is shown in the next section for each environment."}
r if(at[4, 5] < 0.05) {"#### Stability measures for environments"}
if(at[4, 5] < 0.05) rsamodel$Stability_for_environments
r if(at[4, 5] < 0.05) {paste("### ", {{i+1}}, ".3.4. Tai stability analysis", sep = "")}
r if(at[4, 5] < 0.05) {"#### Tai plot"}
if(at[4, 5] < 0.05) { taimodel <- suppressWarnings(tai(traits[i], geno, env, rep, data)) plot(taimodel) }
r if(at[4, 5] < 0.05) {"#### Tai alpha and lambda values"}
if(at[4, 5] < 0.05) taimodel$Tai_values
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.