(71B) Statistics: Linear, Exp., Log, Power, Inverse Regression
07-01-2016, 02:21 AM
Post: #1
 Eddie W. Shore Senior Member Posts: 1,588 Joined: Dec 2013
(71B) Statistics: Linear, Exp., Log, Power, Inverse Regression
Statistics: Regression

The program CURVEFIT fits data to one of five regression models:

1. Linear Regression: y = a + bx
2. Exponential Regression: y = a * e^(b*x)
3. Logarithm Regression: y = a + b * ln x
4. Power Regression: y = a * x^b
5. Inverse Regression: y = a + b/x

On the HP 71, the ln function is represented by LOG.

The program will allow different calculations with the same data set.

Code:
Program CURVEFIT (622 bytes)
10 DESTROY H,S,D,X,Y,A,B,E
12 STAT S(2) @ CLSTAT
20 REM CHOOSE REG
22 DISP “1. LIN 2. EXP 3. LOG” @ WAIT 1.5
24 DISP “4. POW 5. INV” @ WAIT 1.5
28 INPUT “CHOICE #:”; H
29 IF E=1 THEN 60
30 REM INPUT PROCESS
32 INPUT “X,Y:”; X,Y
34 ON H GOTO 36,38,40,42,44
36 ADD X,Y @ GOTO 46
38 ADD X,LOG(Y) @ GOTO 46
40 ADD LOG(X),Y @ GOTO 46
42 ADD LOG(X),LOG(Y) @ GOTO 46
44 ADD 1/X,Y @ GOTO 46
46 INPUT “DONE? (Y=1,N=0):”; D
48 IF D=0 THEN 32
60 LR 2,1,A,B
62 IF H=2 OR H=4 THEN A=EXP(A)
64 ON H GOTO 70,72,74,76,78
70 DISP A; “+”; B; “x” @ GOTO 80
72 DISP A; “*EXP(“; B; “x)” @ GOTO 80
74 DISP A; “+”; B; “*LOG(x)” @ GOTO 80
76 DISP A; “x^”; B @ GOTO 80
78 DISP A; “+”; B; “/x” @ GOTO 80
80 PAUSE
84 DISP “ANOTHER ANALYSIS?” @ WAIT 1.5
86 INPUT “Y=1,N=0:”; E
88 IF E=1 THEN 20
90 DISP “DONE”
 « Next Oldest | Next Newest »

 Messages In This Thread (71B) Statistics: Linear, Exp., Log, Power, Inverse Regression - Eddie W. Shore - 07-01-2016 02:21 AM RE: (71B) Statistics: Linear, Exp., Log, Power, Inverse Regression - C.Ret - 06-12-2021, 05:34 AM

User(s) browsing this thread: 1 Guest(s)