[Top][All Lists]

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

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

From: Nicholas Jankowski
Subject: [Octave-bug-tracker] [bug #56118] [octave forge] (statistics) logistic_regression gives incorrect result
Date: Sat, 6 Aug 2022 14:02:14 -0400 (EDT)

Update of bug #56118 (project octave):

              Item Group:                    None => Incorrect Result       
                  Status:                    None => Confirmed              
                 Release:                   5.1.0 => 7.2.0                  
        Operating System:               GNU/Linux => Any                    


Follow-up Comment #1:

trying to run comment #0 code produces an error:

>> pkg load statistics
>> x = (1:20)' ; y = [zeros(10, 1) ; ones(10,1)] ;
>> Pfun = @(p) exp(p(1) - p(2) * x) ./ (1 + exp(p(1) - p(2) * x)) ; Pin = [0
0]' ;
>> p1 = nonlin_curvefit (Pfun, Pin, x, y) ;
error: @<anonymous>: function called with too many inputs
error: called from
    __maybe_limit_arg_count__>@<anonymous> at line 30 column 26
    nonlin_curvefit>@<anonymous> at line 87 column 24
    __nonlin_residmin__ at line 310 column 9
    nonlin_curvefit at line 86 column 22

preventing p1 from being defined. I don't know if that matters at all for the
issue, as it does seem that the p2 output is inverted and the correct result
is produced by Pfun(-p2) according to the p2 plot. 

not clear enough from comment #0 if they think the problem is the  function
description or the function itself.  Guessing from the description of the
gamma function definition there and at wikipedia, where it is given as gamma =
B0 + B1*x (where B0 is here called theta and B1 is beta), it seems that in
addition to the ordering change in bug #52417, that perhaps a sign change is
needed too.  again, the code shows that "x*beta + theta" is being performed,
not "theta - beta * x".  Perhaps this accounts for the sign change expected by
the user on the beta term? 

if that's the case, this should be a fairly easy doc fix. if the code needs to
be fixed, then we'll need more info.


Reply to this item at:


Message sent via Savannah

reply via email to

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