Objectives and Concepts

  • Practice a complete analysis of differences between 2 groups:
  • State hypotheses
  • Check assumptions
  • Conduct a 2-sample test.

Data

Locate and download the flour_beetles.csv file and save it in your class project data subdirectory.

This data set consists of counts of flour beetles at two different farms (adapted from Gardener)

Instructions

  1. Self-select your group in Moodle
  2. Create a new RMarkdown document.
  3. Create a new code chunk: use here() and read.csv() to read in the data to a data.frame object.
  4. Create a chunk and code to perform a numerical exploration:
    • Calculate the mean and standard deviations for the observations at Woad and Glebe farms.
    • Perform a Shapiro test on the count data for both farms.
    • NOTE: you’ll need to do some logical subsetting to perform these operations.
  5. Use a new code chunk to perform a graphical exploration:
    • Create histograms of the observations at Woad and Glebe farms.
    • Create a conditional boxplot of the observations at Woad and Glebe farms.
  6. Perform a 2-sample t-test.
Click to show/hide logical subset hint

You can use the following code to subset the flour beetles:

dat_woad = subset(beetles, farm == "Woad")
dat_glebe = subset(beetles, farm == "Glebe")

Report

Figures

Your group report needs to include the figures:

  • Q1 (1 pt.): Graphical exploration: a conditional boxplot
  • Q2 (1 pt.): Graphical exploration: histogram of Woad Farm observations
  • Q3 (1 pt.): Graphical exploration: histogram of Glebe Farm observations
    • The two histograms can be on a two-panel plot (check the multi-panel in-class activity for a refresher).

Questions

Respond to the following questions in your group report:

  • Q4 (2 pts.): Based on the Shapiro tests and your graphical exploration, do you think the data (within farms) are normally distributed? Explain your reasoning.
  • Q5 (2 pts.): 2. Which test is more appropriate for the data (t-test or Wilcox)? Explain your reasoning.
  • Q6 (1 pt.): 3. What was the p-value from the t-test?
  • Q7 (2 pts.): 4. Based on the graphical exploration and statistical tests, do you think there are significantly different counts of flour beetles at the two farms? Explain your reasoning.