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

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

 From: Nicholas Jankowski Subject: [Octave-bug-tracker] [bug #60348] [octave forge] (statistics) logistic_regression Date: Mon, 8 Aug 2022 16:21:08 -0400 (EDT)

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

more concerning now that I look at this function - the help text gives the
calling form as:

[THETA, BETA, DEV, DL, D2L, P] = logistic_regression (Y, X, PRINT,
THETA, BETA)

but farther down you see:

The full form is
[THETA, BETA, DEV, DL, D2L, GAMMA]
= logistic_regression (Y, X, PRINT, THETA, BETA)

The function definition in the code itself indicates P not GAMMA.  But at the
end of the code, there is:

if (nargout == 6)
if (nx > 0)
e = ((x * beta) * ones (1, nz)) + ((y * 0 + 1) * theta');
else
e = (y * 0 + 1) * theta';
endif
gamma = diff ([(y * 0), (exp (e) ./ (1 + exp (e))), (y * 0 + 1)]')';
endif

which makes one think that the function INTENDED to return Gamma, not P as the
last parameter.  But in fact gamma as defined in lines 181-188 is never used
and the help text gives the definition of return variable P saying it "holds
estimates for the conditional distribution of Y given X".

Hence, I'm now questioning everything said in the other reports about what
gamma(x) = +/-Theta +/- x*beta should actually look like to match the code,
since the gamma = ... lines I based it on are irrelevant to what's actually
being returned.  I have no idea why it's even calculating Gamma. I notice more
than one author, so there may have been some mixing of intent quite some time
ago.

_______________________________________________________

Reply to this item at:

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

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

```

reply via email to