home *** CD-ROM | disk | FTP | other *** search
- Hi!
- This program is a superset of others like QUADREG or CUBICREG
- by Peter L.A. Oakes. It will fit almost any regression to the
- given data.
-
- -> OK, some examples:
-
- 1) A quadratic regression
-
- Data: (0,14.8) (10,13.9) (20,13.4) (30,13.5) (40,15.5) (46,18.3)
- Functions: Y1=1 (add them to the Y= menu)
- Y2=X
- Y3=X^2
- NUM.FUNCTIONS: 3
- Result: [ 15.10365385 ]
- [ -.2246085165]
- [ .0061710165 ]
-
- So it is: Y = 15.10365385 - 0.2246085165X + 0.0061710165X^2
- (from QUADREG file)
-
- 2) periodic data
-
- Data: (-2,-0.07) (-1.5,-0.53) (-0.5,0.10) (0,1.05) (0.5,2)
- Functions: Y1=1
- Y2=sin X
- Y3=cos X
- NUM.FUNCTIONS: 3
- Result: [ 1.514274536 ]
- [ 1.992831885 ]
- [ -.5068796265]
-
- That's it: Y = 1.514274536 + 1.992831885*sin(X) - 0.5068796265*cos(X)
- or ~ Y = 1.5 + 2sin(X) - 0.5cos(x)
-
- -> Notes:
-
- Be carefull with [B]T , [A]-1, Y1, Y2, Y3 and Y4 (see notes)
-
- -> Program
-
- :NAME: MINQUAD
- :ClrHome
- :Disp "NUM. FUNCTIONS:" <- from 2 to 4
- :Input F
- :F->Arow
- :F->Acol
- :F->Brow
- :F->Bcol
- :F->Crow
- :1->Ccol
- :0->[A]
- :0->[C]
- :1->N
- :Lbl 1
- :1->[B]
- :{x}(N)->X
- :{y}(N)->Y
- :1->C
- :Lbl 2
- :*Row(Y1,[B],1)->[B]
- :*Row(Y2,[B],2)->[B]
- :If F>2
- :*Row(Y3,[B],3)->[B]
- :If F>3
- :*Row(Y4,[B],4)->[B]
- :[B]T->[B] <- TRANSP([B]) -> [B]
- :IS>(C,2)
- :Goto 2
- :YY1+[C](1,1)->[C](1,1) <- Y * Ysub1 + ...
- :YY2+[C](2,1)->[C](2,1)
- :If F>2
- :YY3+[C](3,1)->[C](3,1)
- :If F>3
- :YY4+[C](4,1)->[C](4,1)
- :[B]+[A]->[A]
- :IS>(N,Dim{x})
- :Goto 1
- :[A]-1[C]->[A] <- INV([A]) * [C] -> [A]
- :ClrHome
- :Disp "COEFICIENTS:"
- :Disp [A]
- :End
-
- -> Any comments to xosem@cablecat.com