1 / 3

Method of Least Squares (Least Squares Regression):

6. Method of Least Squares:. (pp. 1001). Method of Least Squares (Least Squares Regression):. Examp 6.1:. : Sum of squares of errors. y=a+bx. a=1.188 b=0.484. y=1.188+0.484x. mls.txt. 3 -5,-2 2,4 7,3.5. Sub mlsquares_Click () ' Change File mls.txt for different problems ' y=a+b*x

kyla-price
Download Presentation

Method of Least Squares (Least Squares Regression):

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 6. Method of Least Squares: (pp. 1001) Method of Least Squares (Least Squares Regression): Examp 6.1: : Sum of squares of errors y=a+bx a=1.188 b=0.484 y=1.188+0.484x

  2. mls.txt 3 -5,-2 2,4 7,3.5 Sub mlsquares_Click () ' Change File mls.txt for different problems ' y=a+b*x fl = fl0 + "mls.txt": Open fl For Input As 1 Input #1, n: ReDim x(n), y(n) For i = 1 To n: Input #1, x(i), y(i): Next i Close #1 Call cls1: Print n: Print For i = 1 To n: Print x(i), y(i): Next i: Print a11 = n: a12 = 0: a22 = 0: b1 = 0: b2 = 0 For j = 1 To n a12 = a12 + x(j) a22 = a22 + x(j) ^ 2 b1 = b1 + y(j) b2 = b2 + x(j) * y(j) Next j a21 = a12 det = (a11 * a22 - a12 * a21) a = (a22 * b1 - a12 * b2) / det b = (-a21 * b1 + a11 * b2) / det Print : Print " A, B : ", a, b End Sub

  3. Examp 6.2: y=200.13 + 8.82x y=a+bx

More Related