Linear regression: y=θ0+θ1x, where θ1=x2−(x)2xy−x⋅y, θ0=y−θ1x.
x=[26,40,35,50,45,55,28,30,52]
y=[110,140,120,145,130,150,150,125,142]
x2=[676,1600,1225,2500,2025,3025,784,900,2704]
xy=[2860,5600,4200,7250,5850,8250,4200,3750,7384]
x=91(26+40+35+50+45+55+28+30+52)=9361
y=91(110+140+120+145+130+150+150+125+142)=3403
x2=91(676+1600+1225+2500+2025+3025+784+900+2704)=915439
xy=91(2860+5600+4200+7250+5850+8250+4200+3750+7384)=316448
(x)2=81130321
x2−(x)2=915439−81130321=818630
xy−x⋅y=316448−3361⋅3403=−996139
θ1=818630:(−996139)=−778725969040
θ0=3403+7787259690409361=700853319439719571
y=700853319439719571−778725969040x
y=40.111−0.009x
Comments