/Design_of_Experiments

A living reference for designing experiments in R

Primary LanguageR

Design of Experiments in R

Introduction

This repository is designed to be a refrence for myself and others for using R in the design of experiments. It is a living document to store code snippets and reminders of how to achieve outcomes given inputs and constraints.

This repository is heavily influenced by “Statistical Methods for Mineral Engineers” by the incredibly influential Prof. TJ Napier-Munn and the CRAN Task View “Design of Experiments (DoE) & Analysis of Experimental Data” by Ulrike Groemping.

High Level Notes

  • Use blocking to account for factors that probably have an effect but aren’t interesting.
    • Date
    • Batch of materials
    • Person performing experiments
    • Equipment the test is performed on
  • Pay attention to the resolution of the study. Stay within III-V most of the time.
    • I : Not Useful
    • II : Not useful, can’t distinguish main effects
    • III: Useful, estimate main effects but can’t distinguish two-factor interactions
    • IV : Useful, can estimate main and two-factor effects but two factor interactions can be confounded
    • V : Useful, can estimate main, two-factor, two-factor interactions and three factor interactions
    • VI : Rarely useful, overkill, estimate all above factors unless there is other three-factor interactions

Fractional Factorial Designs with 2-Level Factors

  • Used When you have On-Off style interactions or High-Low effects.

Below is an example of a flotation test to measure bubble size given three parameters and three replications. The experiment is of a resolution “III” and will not be able to identify two-factor interactions.

pacman::p_load(tidyverse, FrF2)

example1 = FrF2(factor.names = c("frother","collector","salinity"),
                resolution = 3,
                replications = 3)
example1_runorder = attr(example1,"run.order")

example1 %>% bind_cols(example1_runorder) %>% knitr::kable(format = "markdown")
frother collector salinity run.no.in.std.order run.no run.no.std.rp
1 1 1 4 1 4.1
-1 -1 1 1 2 1.1
1 -1 -1 2 3 2.1
-1 1 -1 3 4 3.1
-1 -1 1 1 5 1.2
1 -1 -1 2 6 2.2
1 1 1 4 7 4.2
-1 1 -1 3 8 3.2
-1 -1 1 1 9 1.3
-1 1 -1 3 10 3.3
1 1 1 4 11 4.3
1 -1 -1 2 12 2.3