Post Reply 
Simple Logistic Regression
04-19-2017, 11:44 AM
Post: #1
Simple Logistic Regression
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;
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




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