The scatter diagram for the data set below is shown. (a) given that x=4.5, sx =3.2710854,y=sy =2,4094951, and r=-09680697 determibe the least-squares regression line (b) Graph the least-squares regression line on scatter diagram x 0 2 4 5 7 9 y 7.8 5.2 4.7 4.7 2.9 1.6 (a) y= blankx + blank (round to four decimals as needed) |
Using R, we have
CODE:
x <- c(0,2,4,5,7,9)
y <- c(7.8,5.2,4.7,4.7,2.9,1.6)
a <- lm(y~x)
mean(x)
mean(y)
sd(x)
sd(y)
cor(x,y)
a
plot(x,y)
lines(x,fitted(a))
OUTPUT:
> x <- c(0,2,4,5,7,9)
> y <- c(7.8,5.2,4.7,4.7,2.9,1.6)
> a <- lm(y~x)
> mean(x)
[1] 4.5
> mean(y)
[1] 4.483333
> sd(x)
[1] 3.271085
> sd(y)
[1] 2.117939
> cor(x,y)
[1] -0.9714259
> a
Call:
lm(formula = y ~ x)
Coefficients:
(Intercept) x
7.314 -0.629
> plot(x,y)
> lines(x,fitted(a))
So, the regresssion lie is ,
Y = 7.314 - 0.629 - X
Note: The standard deviation and correlation coefficient you have provided is slightly wrong. Please check it through my answer.
Get Answers For Free
Most questions answered within 1 hours.