r i = {{i}}
# Check design lc <- ck.f(traits[i], factors, rep, dfr) # Fit a model for assumptions plots expr <- paste(traits[i], '~', factors[1]) for (j in 2:lc$nf) expr <- paste(expr, '*', factors[j]) if (design == "crd") ff <- as.formula(expr) if (design == "rcbd") { expr <- paste(expr, '+', rep) ff <- as.formula(expr) } model <- aov(ff, dfr) # Estimate missing values trait.est <- paste0(traits[i], ".est") if (lc$nmis > 0) { dfr[, trait.est] <- mve.f(traits[i], factors, rep, design, dfr, maxp)[, trait.est] } else { dfr[, trait.est] <- dfr[, traits[i]] } # Get anova table with estimated missing values at <- suppressWarnings(aov.f(traits[i], factors, rep, design, dfr, maxp)) # CV rr <- dim(at)[1] cv <- (at[rr, 3])^0.5 / mean(dfr[, trait.est]) * 100
r traits[i]
r if (lc$nmis == 0) {"There are no missing values for this trait; the design is balanced."}
r if (lc$nmis > 0) paste0("There are some missing values (", format(lc$pmis * 100, digits = 3), "%) and they have been estimated for the descriptive statistics and ANOVA.")
for (j in 1:lc$nf) print(tapply(dfr[, trait.est], dfr[, factors[j]], mean))
# Create expression for list of factors lf.expr <- 'list(dfr[, factors[1]]' for (j in 2:lc$nf) lf.expr <- paste0(lf.expr, ', dfr[, factors[', j, ']]') lf.expr <- paste0(lf.expr, ')') # Compute means over replications tapply(dfr[, trait.est], eval(parse(text = lf.expr)), 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 combinations among the levels of the factors. The following plots help to evaluate this assumptions:
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.
at
The coefficient of variation for this experiment is r format(cv, digits = 4)
%.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.