Sol 114
Sol 114
Sol 114
19 2014
(4)
1. Find the equation of the line which passes through the points (1,1) and
(3,5).
slope = rise/run, so slope = (5-1)/(3-1) = 2
y-intercept is -1, because a decrease in 1 in the horizontal direction
leads to a change of 2 in the vertical direction
sh is
ar stu
ed d
vi y re
aC s
o
ou urc
rs e
eH w
er as
o.
co
m
(4)
2. Suppose you are given three data points (1,4), (2,6) and (3,7) and the
line y = 2 + 3x. Give the three residuals and their sum of squares.
2 + 3x
5
8
11
e = y (2 + 3x)
-1
-2
-4
e2
1
4
16
Th
(2)
(2)
xi yi
xi
yi /n = 100 20(10)/20 = 90
(2)
yi =
(32+1.8)yi = 20(32)+1.8
yi = 640+1.8(10) = 658
https://www.coursehero.com/file/10709401/sol114/
Therefore yi y = 1.8(yi y)
P
P
So Sxy = (xi = x)(yi y ) = (xi = x)1.8(yi y) =
1.8Sxy = 1.8(90) = 162
(6)
sh is
ar stu
ed d
vi y re
aC s
o
ou urc
rs e
eH w
er as
o.
co
m
S
= 700 + 1001 + 1000
0
and
S
= 740 + 1000 + 1081
1
Th
or
2 1 = 185 175
or
1 = 10/2 = 5
https://www.coursehero.com/file/10709401/sol114/
700 1
= 7 1
100
and
D = 50M 2 + 3500 7401 + 5412
sh is
ar stu
ed d
vi y re
aC s
o
ou urc
rs e
eH w
er as
o.
co
m
S = 4(1 m)2 + d
or
m=5
Th
(4)
(a) Plot Tasks versus Creativity and comment on the form and strength
of the association. Be sure to label the axes.
3
https://www.coursehero.com/file/10709401/sol114/
CREATIVITY(X)
28
35
37
50
69
84
40
65
29
42
51
45
31
TASKS(Y)
4.5
3.9
3.9
6.1
4.3
8.8
2.1
5.5
5.7
3.0
7.1
7.3
3.3
tasks
sh is
ar stu
ed d
vi y re
aC s
o
ou urc
rs e
eH w
er as
o.
co
m
STUDENT
AE
FR
HT
IO
DP
YR
QD
SW
DF
ER
RR
TG
EF
Th
30
(8)
40
50
60
70
80
creativity
https://www.coursehero.com/file/10709401/sol114/
Th
sh is
ar stu
ed d
vi y re
aC s
o
ou urc
rs e
eH w
er as
o.
co
m
function(creativity, tasks){
plot(creativity,tasks)
ssxx=crossprod(creativity-mean(creativity))
ssxy=crossprod(creativity-mean(creativity),tasks-mean(tasks))
ssyy=crossprod(tasks-mean(tasks))
xbar=mean(creativity)
ybar=mean(tasks)
r = ssxy/sqrt(ssxx*ssyy)
b1hat=ssxy/ssxx
b0hat=ybar-b1hat*xbar
postscript("tcplot",horizontal=F)
plot(creativity,tasks)
abline(b0hat,b1hat)
yhat = b0hat+b1hat*creativity
e=tasks-yhat
esum=sum(e)
rex=cor(e,creativity)
dev.off()
postscript("res.creat",horizontal=F)
plot(creativity,e)
abline(0,0)
dev.off()
ssres=ssyy-ssxy^2/ssxx
tss=ssyy
ssreg=ssxy^2/ssxx
R2=ssreg/tss
return(list(ssxx=ssxx,ssxy=ssxy,ssyy=ssyy,ybar=ybar,xbar=xbar,r=r,
b0hat=b0hat,b1hat=b1hat,e=e,esum=esum,rex=rex,ssres=ssres,tss=tss,
ssreg=ssreg,R2=R2))
}
$ssxx
[,1]
[1,] 3463.077
$ssxy
[,1]
[1,] 220.0923
https://www.coursehero.com/file/10709401/sol114/
$ssyy
[,1]
[1,] 44.53077
$ybar
[1] 5.038462
$xbar
[1] 46.61538
(c) Use these data summaries to calculate the correlation coefficient.
Does the value agree with your visual assessment in (a)?
sh is
ar stu
ed d
vi y re
aC s
o
ou urc
rs e
eH w
er as
o.
co
m
(2)
$r
[,1]
[1,] 0.5604588
(2)
(d) Use these summaries to calculate the least squares values for the
intercept and slope.
b0hat
[,1]
[1,] 2.075869
$b1hat
[,1]
[1,] 0.06355398
Th
(1)
(3)
$e
[1] 0.6446202 -0.4002577 -0.5273656 0.8464327 -2.1610928
[7] -2.5180275 -0.7068769 1.7810662 -1.7451355 1.7828787
[13] -0.7460418
6
https://www.coursehero.com/file/10709401/sol114/
1.3855975
2.3642026
$esum
[1] 8.881784e-16
$rex
[1] -2.420007e-16
The sum of the residuals and their correlation with tasks are
essentially zero.
(g) Plot the residuals versus X. Do the residuals look random?
sh is
ar stu
ed d
vi y re
aC s
o
ou urc
rs e
eH w
er as
o.
co
m
(2)
30
40
50
60
70
80
creativity
(6)
(h) Obtain the residual, regression and total sums of squares, using the
data summaries.
Th
$ssres
[,1]
[1,] 30.54303
$tss
[,1]
[1,] 44.53077
$ssreg
[,1]
https://www.coursehero.com/file/10709401/sol114/
[1,] 13.98774
(2)
Th
sh is
ar stu
ed d
vi y re
aC s
o
ou urc
rs e
eH w
er as
o.
co
m
[,1]
[1,] 0.3141141
https://www.coursehero.com/file/10709401/sol114/