(71B) Statistics: Linear, Exp., Log, Power, Inverse Regression
|
07-01-2016, 02:21 AM
Post: #1
|
|||
|
|||
(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) |
|||
06-12-2021, 05:34 AM
(This post was last modified: 06-12-2021 06:02 AM by C.Ret.)
Post: #2
|
|||
|
|||
RE: (71B) Statistics: Linear, Exp., Log, Power, Inverse Regression
HI,
Cool program, but missing the ability to compute predicted y^ from the regressions. Also, for relatively long statistic series of data, answering DONE ? 0 [ENTER] after each input may be a bit boring. So, since I fill free to modify Eddie's program adding in the way a predicting section, I now have to paid for it and share my version. Still expecting that this will inspire and ease future users to developed an even better or powerfuller version. 10 DESTROY A,B,I,N,R,X,Y @ DIM E$[43],X$[6],Y$[6],C$[5],D$[7] @ STAT S(2) @ CLSTAT 12 INPUT "1lin 2ex 3lg 4pw 5/x ";R @ ON R RESTORE 31,32,33,34,35 @ READ X$,Y$,C$,D$ 14 INPUT "ADD#';N @ FOR I=1 TO N @ DISP I; @ INPUT "X,Y ";X,Y @ ADD VAL(X$),VAL(Y$) @ NEXT I 16 LR 2,1,A,B @ IF R=2 OR R=4 THEN A=EXP(A) ELSE IF B<0 THEN C$="" 18 E$=STR$(A)&C$&STR$(B)&D$ @ DISP "R2";CORR(2,1)^2 @ PAUSE @ DISP "Y=";E$ @ PAUSE 20 INPUT "y^ : (x)=";X @ DISP X;VAL(E$) @ PAUSE @ GOTO 20 31 DATA X,Y,+,*X 32 DATA X,LOG(Y),*EXP(,*X) 33 DATA LOG(X),Y,+,*LOG(X) 34 DATA LOG(X),LOG(Y),*X^, 35 DATA 1/X,Y,+,/X Usage: It the same usage as original version. [RUN] to start the program and select which regression by entering 1 to 5 in the menu to select incrementally:
Wen prompt, ADD# enter the number of data to add in the set. When all data are entered, the R² coefficient of fit goodness is displayed . The more R² approaches one, the better your data points lined up on your paper with lin/log scales. Press [f]+[CONT] to see the equation of regression Y= f(a,b,X). Press [f]+[CONT] again to be prompt for Y^ prediction. Enter abscise (x), next display show (x) and predicted Y. Press [f]+[CONT] to compute further prediction or press [RUN] for a new regression. P.S.: I am not sure that different calculations are allowed with the same data set. One may add more data by typing RUN 14 [END LINE]. But changing regression type without restarting all the data entries may lead to erroneous results. Currently developing a version with may carry regression in parallel so the user may select the better one depending of fitness R². |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)