# bug #58651: [octave forge] (statistics) logistic_regression: what is actually done with >2 categories?

 Submitter: Muhali Submitted: Wed 24 Jun 2020 01:02:45 PM UTC Category: Octave Forge Package Severity: 3 - Normal Priority: 5 - Normal Item Group: Documentation Status: Duplicate Assigned to: None Originator Name: Open/Closed:  * Closed Release:  * 7.2.0 Operating System:  * Any Fixed Release: None Planned Release: None
* Mandatory Fields

Comment Type & Canned Response:

## Discussion

Wed 10 Aug 2022 05:52:40 PM UTC, comment #2:

despite the text in different parts of both the help and the code, I think you're correct. the output appears to fit -theta + beta * x.  I'm going to be closing this report and shifting discussion over to bug #60348, since some discussion already over there and all of these logistic_regression reports are related.

Nicholas Jankowski <nrjank>
Fri 26 Jun 2020 03:56:21 PM UTC, comment #1:

I now have the impression that it must actually read

logit (gamma_i (x)) = -theta_i + beta' * x

This is demonstrated by the following code:

n = 3 ;
x = linspace(0, 5, 2*n)' ;
y = [zeros(n,1) ; ones(n,1)] ;
[theta, beta] = logistic_regression (y, x) ;

flog = @(z) 1 ./ (1 + exp(-z)) ;                # the logistic function
flin = @(theta, beta, x) -theta + beta * x ;    # the linear part of the predictor

clf ;
yh = flog(flin(theta, beta, x)) ;
plot(x, [y yh], "x")

## to actually see the logistic function
hold on
n = 50 ;
x_d = linspace(0, 5, n)' ;
yh_d = flog(flin(theta, beta, x_d)) ;
plot(x_d, yh_d)

Muhali <muhali>
Wed 24 Jun 2020 01:02:45 PM UTC, original submission:

according to the help text, the logistic_regression function fits the model

logit (gamma_i (x)) = theta_i - beta' * x,   i = 1 ... k-1

that is, a unique beta across all categories. This is in contrast to the multinomial regressions that I know of, such as the Matlab function mnrfit, or as described here.

I think this needs to be clarified or corrected.

Muhali <muhali>

## Attached Files

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Comment:

No files currently attached

## Dependencies

Depends on the following items

Digest:
bug dependencies.

Items that depend on this one: None found

Carbon-Copy List
• -email is unavailable- added by nrjank (Posted a comment)
• -email is unavailable- added by siko1056 (Updated the item)
• -email is unavailable- added by muhali (Submitted the item)
•

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only project members can vote.

## History

Date Changed by Updated Field Previous Value => Replaced by
2022-08-10 nrjank StatusConfirmed Duplicate
Open/ClosedOpen Closed
Release5.2.0 7.2.0
Operating SystemGNU/Linux Any
Dependencies- Depends on bugs #60348
2021-04-28 siko1056 Summary[octave-forge](statistics) logistic_regression: what is actually done with &gt;2 categories? [octave forge] (statistics) logistic_regression: what is actually done with >2 categories?
2020-06-24 rik5 Carbon-CopyRemoved 72865 -
2020-06-24 rik5 CategoryNone Octave Forge Package
Item GroupNone Documentation
StatusNone Confirmed