date()
## [1] "Sun Dec 02 17:38:45 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 compared to August because p<0.1.
(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)
require(ggplot2)
## Loading required package: ggplot2
p = ggplot(data.frame(Age, HR), aes(Age, HR)) + geom_point(size = 4)
p = p + geom_smooth(method = lm, se = FALSE, col = "red")
p
model = lm(HR ~ Age)
model
##
## Call:
## lm(formula = HR ~ Age)
##
## Coefficients:
## (Intercept) Age
## 210.048 -0.798
predict(model, data.frame(Age = 50))
## 1
## 170.2
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)
The intercept is 210.0485 and the slope is -0.7977.
(b) Predict the average heart rate of a 50-year old. (10)
Prediction of heart rate at age 50 is 170.1621.