r i = {{i}}
r traits[i]
lc <- ck.crd(traits[i], geno, dfr) model <- aov(dfr[, traits[i]] ~ dfr[, geno]) model$terms[[2]] <- traits[i] at <- anova(model) rownames(at)[1] <- geno
You have fitted a linear model for a CRD. The ANOVA table for your model is:
at
The coefficient of variation for this experiment is r format(agricolae::cv.model(model), digits = 4)
%.
The p-value for genotypes is r format(at[1, 5], digits = 4)
r if(at[1, 5] < 0.05) {"which is significant at the 5% level."} else {"which is not significant at the 5% level."}
Don't forget the assumptions of the model. It is supposed that the errors are independent with a normal distribution and with the same variance for all the genotypes. The following residuals plots must help you evaluate this:
par(mfrow = c(1, 2)) plot(model, which = 1) plot(model, which = 2)
Any trend in the residuals in the left plot would violate the assumption of independence while a trend in the variability of the residuals --for instance a funnel shape-- suggests heterogeneity of variances. Departures from the theoretical normal line on the right plot are symptoms of lack of normality.
r if (at[1, 5] < 0.05) {"Below are the sorted means for each genotype with letters indicating if there are significant differences using the multiple comparisons method of Tukey at the 5% level."} else {"The means of your genotypes are:"}
if (at[1, 5] < 0.05) { agricolae::HSD.test(dfr[, traits[i]], dfr[, geno], at[2, 1], at[2, 3])$groups } else { tapply(dfr[, traits[i]], dfr[, geno], mean, na.rm = TRUE) }
r if (lc$ng < 10) {"It is always good to have some visualization of the data. Because the number of genotypes in your experiment is not so big, we can plot the data for each genotypes:"}
if (lc$ng < 10) msdplot(traits[i], geno, dfr, conf = 1, xlab = 'Genotype', ylab = traits[i], pch = 4)
Below are the variance components for this model, under the assumption that genotypes are random. Here the model is fitted using REML.
y <- dfr[, traits[i]] g <- dfr[, geno] ff <- as.formula(y ~ (1|g)) model <- lme4::lmer(ff) vc <- data.frame(lme4::VarCorr(model)) vc[1, 1] <- geno rownames(vc) <- vc[, 1] vc <- vc[, c(4, 5)] colnames(vc) <- c("Variance", "Std.Dev.") vc
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.