Least Square Regression

Embed Size (px)

Citation preview

  • 8/3/2019 Least Square Regression

    1/13

  • 8/3/2019 Least Square Regression

    2/13

    09 ME [126,127,129,X-06 &09 ME [126,127,129,X-06 &

    X-94]X-94]

    Presentation On Least SquarePresentation On Least SquareLinear RegressionLinear Regression

    Concerned Teacher: SirConcerned Teacher: SirZeeshan Ali MemonZeeshan Ali Memon

  • 8/3/2019 Least Square Regression

    3/13

    LEAST SQUARE LINEARLEAST SQU

    ARE LINEAR

    REGRESSIONREGRESSION

    LINEAR REGRESSIONLINEAR REGRESSION

    GRAPHICAL REPRESENTATIONGRAPHICAL REPRESENTATION

    LEAST SQUARE METHODLEAST SQ

    UARE METHOD

    LEAST SQUARE REGRESSION ANALYSISLEAST SQ

    UARE REGRESSION ANALYSIS

    EXAMPLEEXAMPLE

    APPLICATIONSAPPLICATIONS

  • 8/3/2019 Least Square Regression

    4/13

    LINEAR REGRESSIONINEAR REGRESSION In statistics,In statistics, l inear regressioninear regression is an approachis an approach

    to modeling the relationshipto modeling the relationshipbetweenbetweena scalara scalarvariablevariableyy and one or more variablesand one or more variablesdenoteddenotedbyby

    XX.. NoteNotethat one variable is dependent on thethat one variable is dependent on theother.other.

    In linear regression, data is modeled using linearIn linear regression, data is modeled using linearfunctions, and unknown model parameters arefunctions, and unknown model parameters areestimated from the data.estimated from the data.Such models areSuch models arecalledcalledl inear modelsinear models ..

  • 8/3/2019 Least Square Regression

    5/13

    GRAPHICAL REPRESENTATIONRAPHICAL REPRESENTATION

  • 8/3/2019 Least Square Regression

    6/13

    The red line in the graphThe red line in the graph

    is known asis known as regressionegression l ineine joining the pointsjoining the pointswhich are best fit forwhich are best fit for

    the data given.the data given.

    Taking a simple example,Taking a simple example, Y=aXY=aXis a simple linear equationis a simple linear equation

    wherewhere YY is dependent onis dependent on X.X. By using given values ofBy using given values of XX,,putting them in the equation ,getting different values ofputting them in the equation ,getting different values of YY,,

    we get different points in the graph. Of them the best fitwe get different points in the graph. Of them the best fit

    points are those which make a straight line as shown in thepoints are those which make a straight line as shown in the

    graph above.graph above.

  • 8/3/2019 Least Square Regression

    7/13

    LEAST SQUARE METHODEAST SQUARE METHOD The least-squares method was first described byThe least-squares method was first described byCarl Friedrich Gaussarl Friedrich Gauss around 1794. Thearound 1794. The

    method of least squares is a standard approach tomethod of least squares is a standard approach tothe approximate solution of over determinedthe approximate solution of over determinedsystems, i.e. sets of equations in which there aresystems, i.e. sets of equations in which there aremore equations than unknowns.more equations than unknowns.

    The most important application is in data fitting.The most important application is in data fitting.It is often used for regression analysis.It is often used for regression analysis.

  • 8/3/2019 Least Square Regression

    8/13

    LEAST SQUARE REGRESSIONEAST SQUARE REGRESSIONANALYSISNALYSIS

    Consider a straight line equation y = a + bx. WhereConsider a straight line equation y = a + bx. Where aa andandbbare coefficients representing the intercept and the slopeare coefficients representing the intercept and the sloperespectively.respectively.

    From above equation a = y bx .....(i)From above equation a = y bx .....(i)

    b = (nb = (n xy - x yxy - x y)) [n x [n x22 ((x)x)22]. This is a least]. This is a leastsquare linear equation for a straight line.square linear equation for a straight line.

    Then using the value ofThen using the value of bb in (i) we getin (i) we get a.a.

    Finally usingFinally using aa andandbb in the main equation we get the leastin the main equation we get the leastsquares fit.squares fit.

  • 8/3/2019 Least Square Regression

    9/13

    EXAMPLEXAMPLE The following data was obtained in a PhysicsThe following data was obtained in a Physics

    experiment and plotted. Determine if a straightexperiment and plotted. Determine if a straight

    line is a good model for this data and if so,line is a good model for this data and if so,

    determine the line of best fit.determine the line of best fit.

    Time (s)Time (s) Distance (cm)Distance (cm)

    11 22

    33 55

    55 88

    77 1111

    99 1515

  • 8/3/2019 Least Square Regression

    10/13

    When this data is plotted as a graph, it appears that aWhen this data is plotted as a graph, it appears that astraight line is the best model:straight line is the best model:

    The next step is to calculate 'a' and 'b', which areThe next step is to calculate 'a' and 'b', which arecalculated to becalculated to bea= 1.6 s and b=0.2 cm bya= 1.6 s and b=0.2 cm by least square equations.east square equations.

    Therefore the e uation of the line of best fit is d=1.6t+0.2.Therefore, the e uation of the line of best fit is d=1.6t+0.2.

  • 8/3/2019 Least Square Regression

    11/13

  • 8/3/2019 Least Square Regression

    12/13

    APPLICATIONSPPLICATIONS If the goal is prediction, or forecasting, linear regressionIf the goal is prediction, or forecasting, linear regression

    can be used to fit a predictive model to an observed datacan be used to fit a predictive model to an observed dataset ofset ofyyandand XXvalues. After developing such a model, ifvalues. After developing such a model, if

    an additional value ofan additional value ofXXis then given without itsis then given without itsaccompanying value ofaccompanying value ofyy, the fitted model can be used, the fitted model can be usedto make a prediction of the value ofto make a prediction of the value ofyy..

    Given a variableGiven a variable yyand a number of variablesand a number of variables XX11, ... ,, ... ,XXpp that may be related tothat may be related to yy, linear regression analysis, linear regression analysiscan be applied to quantify the strength of thecan be applied to quantify the strength of therelationship betweenrelationship between yyand theand the XXjj, to assess which, to assess which XXjj

    may have no relationship withmay have no relationship with yyat all.at all.

  • 8/3/2019 Least Square Regression

    13/13

    THE ENDTHE END

    Thanks for yourThanks for your

    concentration.concentration.