In: Statistics and Probability
A study is given in which scientists examined data on mean sea surface temperatures (in degrees Celsius) and mean coral growth (in millimeters per year) over a several-year period at different locations. Here are the data:
Sea Surface Temperature 29.69 29.86 30.16 30.21 30.48 30.65 30.90
Growth 2.62 2.57 2.68 2.60 2.49 2.39 2.25
(a) Use your calculator to find the mean and standard deviation
of both sea surface temperature x and growth y
and the correlation r between x and y.
Use these basic measures to find the equation of the least-squares
line for predicting y from x. (Round your answers
to three decimal places.)
ŷ = _____ + _____x
(b) Enter the data into your software or calculator, and use the
regression function to find the least-squares line. The result
should agree with your work in part (a) up to roundoff error.
(Round your answers to three decimal places.)
ŷ =______ +_____x
(c) Say in words what the numerical value of the slope tells you. (Round your answer to three decimal places.)
Every increase of one degree Celsius means about ______ fewer mean millimeters of coral growth per year.
We will use R studio to answer the above question . Codes are marked in Bold
(a)
# x= Sea Surface Temperature, y = Growth
x<-
c(29.69,29.86,30.16,30.21,30.48,30.65,30.90)
y <- c(2.62,2.57,2.68,2.60,2.49,2.39,2.25)
# x_bar =mean of x , y_bar = mean of y
x_bar <- mean(x)
y_bar <- mean(y)
# sx = Standard deviation of x, sy = standard deviation of y
sx <- sd(x)
sy <- sd(y)
# r = correlation between x &y
r <- cor(x,y)
# slope
slope <- (r*sy)/(sx)
# intercept
intercept <- y_bar-slope*x_bar
print(round(x_bar,3))
print(round(y_bar,3))
print(round(sx,3))
print(round(sy,3))
print(round(r,3))
print(round(slope,3))
print(round(intercept,3))
Mean of x = 30.279
Mean of y = 2.514
standard deviation of x = 0.429
standard deviation of y =0.15
correlation between x & y = -0.845
Slope of y on x = -0.295
intercept = 11.456
The regression equation
y = -0.295*x + 11.456
_________________________________________________________________________________________________
(b)
# (b)
reg_equation <- lm(y~x)
summary(reg_equation)
Residuals:
1 2 3 4 5 6 7
-0.06810 -0.06790 0.13070 0.06546 0.03520 -0.01459
-0.08076
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 11.45624 2.53064 4.527 0.00624 **
x -0.29532 0.08357 -3.534 0.01667 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’
1
Residual standard error: 0.08785 on 5 degrees of
freedom
Multiple R-squared: 0.7141, Adjusted R-squared:
0.6569
F-statistic: 12.49 on 1 and 5 DF, p-value: 0.01667
Hence, the equation y = -0.295*x + 11.456
__________________________________________________________________________________________________
(c)
Every increase of one degree Celsius means about -0.295 fewer mean millimeters of coral growth per year.