Enter your name and EID here
This homework is due on Jan. 27, 2020 at 12:00pm. Please submit as a pdf file on Canvas.
This homework uses the InsectSprays
data set available in R. This data set contains counts of insects in agricultural experimental units (count
) treated with different insecticides (spray
). There are six different types of insect sprays tested in the data set (labeled A-F), each with 12 observations.
head(InsectSprays)
## count spray
## 1 10 A
## 2 7 A
## 3 20 A
## 4 14 A
## 5 14 A
## 6 12 A
Question 1: (4 pts) We are interested in testing the effect of insect spray type on the number of insects observed. Since there are six different types of insect sprays in the data set, and therefore six groups of insect counts, we will use an analysis of variance (ANOVA) test. Conduct an ANOVA test and interpret your results in 1-2 sentences. HINT: You will first need to create a linear model object using the lm()
function before you can use the anova()
function.
# your R code goes here
Your answer goes here. 1-2 sentences only.
Question 2: (3 pts) Create a boxplot of the insect count data, separated by spray type. Based on this plot, is the mean insect count of Spray B the same or different from that of Spray D? Explain your answer.
# your R code goes here
Your answer goes here. 1-2 sentences only.
Question 3: (3 pts) Use a t test to determine if the mean insect count of Spray B is the same or different from that of Spray D. Interperet and explain your results in 1-2 sentences.
# your R code goes here
Your answer goes here. 1-2 sentences only.