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

 Submitted by: Muhali Submitted on: Wed 24 Jun 2020 01:02:45 PM UTC Category: Octave Forge Package Severity: 3 - Normal Priority: 5 - Normal Item Group: Documentation Status: Confirmed Assigned to: None Originator Name: Open/Closed: Open Release: 5.2.0 Operating System: GNU/Linux

You are not logged in

## Discussion

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: None found

Items that depend on this one: None found

Carbon-Copy List
• -email is unavailable- added by muhali (Submitted the item)
•

Do you think this task is very important?
This task has 0 encouragements so far.

Only project members can vote.