Assignment#4: A) Draw The Scatter Plot of The Data, If You Can Plot Via R Would Also Be Acceptable
Assignment#4: A) Draw The Scatter Plot of The Data, If You Can Plot Via R Would Also Be Acceptable
4/25/2020
---------------------------------------------------------------------------------------------------------------------
a) Draw the scatter plot of the data, if you can plot via R would also be
acceptable.
attach(xyData)
plot(Area_Sq_Feet,Price_Dollars_1000,main = "Scatter Plot: Area and Selling
Price")
1
6
Normal equations by least 1 9 10 square fit method are given
below; 0 0 00
0 0 00
0 169 0 0
To form above two equations, we need the
following; 1
9
1 0 12
Sum of x, Sum of y, Sum of xy, Sum of x-square
1 3 10
0 0 00
Here: 0 173 0 0
2
4
1 9 19
4 2 60
0 0 00
0 178 0 0
2
9
1 7 25
6 6 60
0 0 00
0 186 0 0
3
5
1 4 32
8 6 40
0 0 00
0 197 0 0
3
8
1 5 36
9 7 10
0 0 00
0 203 0 0
3
9
1 5 36
Formulate above (1) and (2) Normal equations;
By solving (1) and (2), we get unknown parameters 'a' and 'b'.
(1) x 18300
(2) x 11
we get:
''a'' ''b''
Coefficient Coefficient RHS
1st
Equation 201300 334890000 40552800
2nd
Equation 201300 355190000 41837400
b = 0.0633
a = 96.15
d) Find sum of square error (SSE): ∑ (Y − Ŷ )
Area
Sq.Feet
(x) Price (y) xy x-square Y-hat (Y - Y-hat)
∑ (Y − Ŷ) = -0.04
e) Predict the price which you have an 1850 square feet area plot.
To predicted value of Y when X=1850, we need to find the regression equation:
Y=a1+b1X+b2X^2
Observati
ons X Y X^2 X^3 X^4 XY X^2*Y
Solving we get,
b2 = 1523/18260000=0.0000834
b1 = -215397/1059080=-0.20338
a = 7809958/26477 = 294.9714
g) In this case, what will be the impact, when you fit a linear regression
instead of polynomial? Justify your answer in points.
-
607.433 18595.1 19.8425
6 1800 197 136.364 -4.4545 438 405 7025
So b=r.sy/sx
=0.9156
Sy=SD(y) =√(∑(y-ybar)^2/(n-1) =√(8814.7273/10)=29.6896
Sx= SD (x)=√(∑(x-xbar)^2/(n-1)=√(1845454.545/10)=429.5875
b=0.9156*429.5875/29.6896=0.06327
a=ybar-b*xbar=201.4545-0.06327*1663.636=96.1963
Y=96.1963+0.06327*X
The predicted value of Y for X=1850 in the linear regression is:
Y=96.1963+0.06327*1850=213.2458=213 approximately (in $1000)