Exam # 5

Arielle Mundy

date()
## [1] "Wed Dec 05 19:58:07 2012"

Due Date: December 7, 2012, 2pm
Total Points: 30; Points are given in parentheses.

(1) Use the FLprecip.txt file on my website http://myweb.fsu.edu/jelsner/ and peform a t-test to determine if Florida is significantly drier during May compared with August. (10)

FLp = read.table("http://myweb.fsu.edu/jelsner/FLprecip.txt", header = TRUE)
t.test(FLp$May, FLp$Aug)
## 
##  Welch Two Sample t-test
## 
## data:  FLp$May and FLp$Aug 
## t = -12.21, df = 219.2, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0 
## 95 percent confidence interval:
##  -3.882 -2.802 
## sample estimates:
## mean of x mean of y 
##     3.857     7.199

Florida is significantly drier in May than August with average rainfall at 3.8 inches and August with 7.19 inches. This is proven by the small p-value.

(2) Suppose 15 randomly chosen people of varying ages are tested for maximum heart rate and the following data are found.

Age = c(18, 23, 25, 35, 65, 54, 34, 56, 72, 19, 23, 42, 18, 39, 37)
HR = c(202, 186, 187, 180, 156, 169, 174, 172, 153, 199, 193, 174, 198, 183, 
    178)

The age is in years and the heart rate is in beats per minute.

(a) Determine the intercept and slope of a regression model of heart rate on age. (10)

require(ggplot2)
## Loading required package: ggplot2
p = ggplot(data.frame(Age, HR), aes(Age, HR))
p = p + geom_point(size = 4)
p = p + geom_smooth(method = lm, se = FALSE, col = "red")
p

plot of chunk unnamed-chunk-3

model = lm(HR ~ Age)
model
## 
## Call:
## lm(formula = HR ~ Age)
## 
## Coefficients:
## (Intercept)          Age  
##     210.048       -0.798

y = 210.048 - 0.798x

(b) Predict the average heart rate of a 50-year old. (10)

predict(model, data.frame(Age = 50))
##     1 
## 170.2

The average heart rate of a 50-year old is 170.2.