All Questions Topic List
Others Questions
Previous in All Question Next in All Question
Previous in Others Next in Others
Question Number 5117 by FilupSmith last updated on 14/Apr/16
Ihaveaquestion.IamunsurehowthisisdonebecauseIhaveneverlearntit.Howdoyoudeterminethelineofbestfit?
Commented by Yozzii last updated on 14/Apr/16
Leastsquaresmethodisoneway.Givenasetofnpoints(xi,yi),supposethatthelineofbestfithastheformy=mx+c.Then,foreachxi,wegettheresultyj=mxi+c.Theleastsquaresmethodrequiresthatfortheregressionlineyonx,thequantityQmustbeminimisedwhereQ=∑ni=1(yi−yj)2=∑ni=1(yi−mxi−c)2Thismeansthatweaimtominimisethesquareddistancesbetweenagivenyiandthepointonthelineyjcorrespondingtoxi.Qisafunctionoftwovariablesmandcsinceweassumethat(xi,yi)areknown.Wecanthenemploytechniquesofmultivariablecalculustofindmandc.SinceQisofaquadraticformitsstationaryvalueisaminimumone;in3Dspace,thelocusofpoints(m,c,Q)isabowlsurfacewhereQ⩾0.⇒∂Q∂m=∑ni=1(−2xi)(yi−mxi−c)∂Q∂m=2m(∑ni=1xi2)+2c(∑ni=1xi)−2(∑ni=1xiyi)and∂Q∂c=∑ni=1(−2)(yi−mxi−c)∂Q∂c=2m(∑ni=1xi)+2c(∑ni=11)−2∑ni=1yior∂Q∂c=2m(∑ni=1xi)+2cn−2(∑ni=1yi)Atthestationarypoint,∂Q∂m=0and∂Q∂c=0.Yougetthefollowingresultformfromthesetwoequationsbyeliminatingc.m=n∑ni=1xiyi−(∑ni=1xi)(∑ni=1yi)n∑ni=1xi2−(∑ni=1xi)2Itcanshownthat(x−,y−)=(∑ni=1xin,∑ni=1yin)liesonthelineofbestfit,soccanbefoundfromc=y−−mx−.Theresultofy=mx+cistheleastsquareslineofbestfit.(x−,y−)isthecentroidofallthepoints(xi,yi).mhasanotherform.m=∑ni=1xiyi−nx−y−∑ni=1xi2−n(x−)2.
Terms of Service
Privacy Policy
Contact: info@tinkutara.com