octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #56118] [octave forge] (statistics) logistic_r


From: Muhali
Subject: [Octave-bug-tracker] [bug #56118] [octave forge] (statistics) logistic_regression gives incorrect result
Date: Mon, 8 Aug 2022 10:33:08 -0400 (EDT)

Follow-up Comment #2, bug #56118 (project octave):

somehow, the function call has changed. Now one needs

Pfun = @(p, x) ... :


pkg load optim
x = (1:20)' ; y = [zeros(10, 1) ; ones(10,1)] ;
Pfun = @(p, x) exp(p(1) - p(2) * x) ./ (1 + exp(p(1) - p(2) * x)) ; Pin = [0
0]' ;

p1 = nonlin_curvefit (Pfun, Pin, x, y) ;
[p2(1) p2(2)] = logistic_regression(y, x) ;

subplot(2,1,1) ;
plot(x, y, "x", x, Pfun(p1, x), "-") ;
set(gca, "box", "off")
subplot(2,1,2) ;
plot(x, y, "x", x, Pfun(p2, x), "-") ;
set(gca, "box", "off")


Whether the function or the documentation is incorrect is just a question of
how the regression equation is defined. They only need to be consistent.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?56118>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]