Module 3

We now know how to deal with data in R; however, before we start drawing conclusions we need to know how the data were collected and more importantly. perhaps, collect data ourselves. Generally, data is either observational (data collected where researchers don’t control the environment, but simply observe outcomes) or experimental (data collected where researchers introduce some intervention and control the environment in order to draw inference).

TASK R. A. Fisher’s work in the area of experimental design is, perhaps, the most well known in the field. The principles he devised we still abide by today. Note, however, to give a balanced view of the celebrated mathematician many of his views (on eugenics and race in particular) are detested by many. I would urge you to read up on his work in this area and come to your own conclusions.

R packages and datasets

It is assumed in all following examples of this module that the following code has been executed successfully.

packages used in this module

library(tidyverse) ## general functionality
library(edibble) ## experiment setup
library(gglm) ## nice lm() diagnostic plots
library(emmeans) ## pairwise contrasts
library(lme4) ## mixed effects models
library(lmerTest) ## mixed effects models
library(predictmeans) ## pairwise comparisons

datasets used in this module

base_url <- "https://raw.githubusercontent.com/STATS-UOA/databunker/master/data/"
  1. rats
rats <- read_csv(paste(base_url, "crd_rats_data.csv", sep = ""))
rats$Surgery <- as_factor(rats$Surgery)
  1. factorial
factorial <- read_csv(paste(base_url, "factorial_expt.csv", sep = ""))
  1. rcbd
rcbd <- read_csv(paste(base_url, "rcbd.csv", sep = ""))
  1. split_plot
split_plot <- read_csv(paste(base_url, "split_plot.csv", sep = ""))
  1. liver
liver <- read_csv(paste(base_url, "repeated_measures_liver.csv", sep = ""))