HP Forums

Full Version: Simple Logistic Regression
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The program SIMPLOGI attempts to fit two lists of data (X, Y) to the equation:

y = 1 / (A + B*e^(-x))

by using the translation: X’ = e^-X and Y’ = 1/Y and performing linear regression analysis on X’ and Y’. This is good for all data except when y = 0.

Code:
EXPORT SIMPLOGI(L1,L2)
BEGIN
// EWS 2017-04-18

LOCAL S:=SIZE(L1);
LOCAL L0:=MAKELIST(1,X,1,S);
L1:=e^(−L1);
L2:=1/L2;

LOCAL M1,M2,M3;
M1:=list2mat(CONCAT(L0,L1),S);
M1:=TRN(M1);
M2:=list2mat(L2,S);
M2:=TRN(M2);
M3:=CAS.LSQ(M1,M2);


RETURN {"Y=1/(A+Be^(−X))",M3};

END;
Reference URL's