Homework 1

Enter your name and EID here

This homework is due on Jan. 23, 2018 at 7:00pm. Please submit as a pdf file on Canvas.

This homework uses the Alfalfa data set. This data set contains the height of alfalfa sprouts after four days (Ht4) grown indoors in different acidic environments (Acid). There are three different amounts of acid observed in the data set: none (water), moderate (1.5HCl), and strong (3.0HCl). Each treatment was performed on 5 plants. The data set also contains information on the amount of daylight the plants received (Row). This column contains values a through e, where a indicates the row farthest from the window and e indicates the row closest to the window.

Alfalfa <- read.csv("http://wilkelab.org/classes/SDS348/data_sets/Alfalfa.csv")
head(Alfalfa)
##    Ht4   Acid Row
## 1 1.45  water   a
## 2 2.79  water   b
## 3 1.93  water   c
## 4 2.33  water   d
## 5 4.85  water   e
## 6 1.00 1.5HCl   a

Problem 1: (4 pts) We are interested in testing the effects of acidic environement on plant growth. Since there are three different amounts of acidity in the data set, and therefore three groups of acid measurements, 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.

alfalfa.mod <- lm(Ht4 ~ Acid, data = Alfalfa)
anova(alfalfa.mod)
## Analysis of Variance Table
## 
## Response: Ht4
##           Df  Sum Sq Mean Sq F value  Pr(>F)  
## Acid       2  6.8516  3.4258  4.0087 0.04641 *
## Residuals 12 10.2550  0.8546                  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

The growth means of plants under different acid treatments appear to be not equal, i.e., at least one of the acidic environments appears to affect the growth of plants.

Problem 2: (3 pts) Create a boxplot of the plant growth, separated by acid amounts. Based on this plot, is the mean height of alfalfa grown in 3.0HCl the same or different from the mean height of alfalfa grown in water? Explain your answer.

boxplot(Ht4 ~ Acid, data = Alfalfa)

The heights of alfalfa grown in water are higher than the heights of alfalfa grown in 3.0HCl. Thus, the height means are expected to be different.

Problem 3: (3 pts) Use a t test to determine if the mean height of plants grown in 3.0HCl is the same or different from the mean height of plants grown in water. Interperet and explain your results in 1-2 sentences.

t.test(Alfalfa$Ht4[Alfalfa$Acid == 'water'], Alfalfa$Ht4[Alfalfa$Acid == '3.0HCl'])
## 
##  Welch Two Sample t-test
## 
## data:  Alfalfa$Ht4[Alfalfa$Acid == "water"] and Alfalfa$Ht4[Alfalfa$Acid == "3.0HCl"]
## t = 2.5623, df = 4.8504, p-value = 0.05196
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.01997201  3.19197201
## sample estimates:
## mean of x mean of y 
##     2.670     1.084

The mean height of 3.0HCl is not significantly smaller than the mean height of water, i.e., strong amount of acid does not appear to reduce the height of alfalfa plants.