knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "75%" )
plotdesignr provides a novel way to design agronomic field experiments with a focus on maximizing statistical power. Field research is time consuming, resource intensive, and can only be done once per year in many growing regions. Because of these constraints, it is important that every experiment is designed in a way that gives it the greatest chance of producing meaningful results.
You can install the development version from GitHub with:
# install.packages("devtools") devtools::install_github("smmueller/plotdesignr")
A more detailed workflow can be found here.
Three years of corn yield data for a field in 2014, 2016, and 2018 are loaded. The point yield observations are aggregated into a common grid of hexagonal polygons to enable comparison across years.
input_config <- read_yaml('docs/example_workflow_config.yml') cluster_df <- make_cluster_data(config = input_config, plot = TRUE)
knitr::include_graphics('docs/plotdesignr_overview_files/figure-html/create-cluster-df-1.png')
The three years of yield data are clustered using both the yield values and the distance between yield polygons with help from the ClustGeo
package. The combined weighting of yield similarity and geographic continuity allows for creating clusters large enough to fit a block of the experiment inside.
explore_best_mix(processed_data = cluster_df, cluster_number = 3, range = seq(0, 0.5, 0.1), plot = TRUE, output_path = input_config$output_path)
knitr::include_graphics('docs/example_workflow_plots/mixing_parameter_map_3_clusters.png')
For this example, three clusters and a mixing parameter of 0.1 is selected (criteria for choosing cluster number not shown). Several criteria, as well as knowledge about the field, must be considered to create meaningful clusters.
# finalize cluster number and mixing parameter choice clustered <- finalize_clusters(processed_data = cluster_df, cluster_number = 3, mixing_parameter = 0.1)
One of the most powerful features of plotdesignr
is the ability to interactively create and simulate various experimental designs. Once the clusters have been chosen, simply click on the map to design new experiments. The goal it to place experiment blocks inside of areas of the same cluster because those areas represent homogeneous yield environments. See the conceptual introduction for more details.
{width=50%}
Experiments may either have disconnected blocks (shown here with three clusters and two different choices of "mixing parameter") or they may be "traditional" experiments with connected blocks in various arrangements. Design names (used in the final figure) from right to left: disconnected_01
, disconnected_04
, traditional_square
, and traditional_long
.
knitr::include_graphics(c('docs/saved_experiments/disconnected_01.png', 'docs/saved_experiments/disconnected_04.png'))
knitr::include_graphics(c('docs/saved_experiments/traditional_square.png', 'docs/saved_experiments/traditional_long.png'))
The alternative designs are evaluated for statistical power at various effect sizes using the historical yield data and the simr
package. The results below show that, on average, the design disconnected_01
has greater statistical power for the same effect size while disconnected_04
and traditional_square
have the lowest power. This is made most clear in 2014 and 2018. The interpretation is that for the same level of effect size between treatments, statistical tests are more likely to detect significant differences, when they are present, using the design disconnected_01
compared to traditional_square
.
knitr::include_graphics('docs/plotdesignr_overview_files/figure-html/power-plots-1.png')
This demonstration highlights the influence of experimental design on statistical power in field experiments and provides a framework for identifying and testing potential designs. Future work will be focused on improving recommendations for best practices in:
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.