Post Reply 
(71B) Statistics: Linear, Exp., Log, Power, Inverse Regression
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

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

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:
  1. Linear regression: data points lined up on normal scaled paper
    Equation: Y=a+b·X
  2. Exponential regression: data points lined up on lin-log scaled graph.
    Equation: Y=a·EXP(b·X)
  3. Logarithm Regression: data lined up on log-lin scaled graph.
    Equation: Y=a+b·LN(X)
  4. Power regression: data points only lined up on log-log scaled paper graph.
    Equation: Y=a·X^b
  5. Hyperbolic Regression: data points lined up when inverted 1/x abscise are use (never see a millimeter hyperbolic paper sheet)
    Equation: Y=a+b/X

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².
Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
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)