How to run Logistic Regression in matlab

How can i apply Logistic Regression in Matlab when the function is logistic (Not logit)? Is there a built-in function?
I need to use the function seen at the following link: http://mathgotchas.blogspot.co.il/2011/10/why-is-error-function-minimized-in.html
Please Advice and thanks.

Respuestas (1)

Image Analyst
Image Analyst el 15 de Mayo de 2016
Description
B = mnrfit(X,Y) returns a matrix, B, of coefficient estimates for a multinomial logistic regression of the nominal responses in Y on the predictors in X.
load fisheriris
% The column vector, species, consists of iris flowers of three different species, setosa, versicolor, virginica. The double matrix meas consists of four types of measurements on the flowers, the length and width of sepals and petals in centimeters, respectively.
% Define the nominal response variable using a categorical array.
sp = categorical(species);
% Fit a multinomial regression model to predict the species using the measurements.
[B,dev,stats] = mnrfit(meas,sp);
B

4 comentarios

jack
jack el 16 de Mayo de 2016
Editada: jack el 16 de Mayo de 2016
Thanks, I have conducted that logit is actually used for logistic regression, My question now is how to i apply weighted logistic regression (the weights are on X or meas in your example ?
Tanvir Kaisar
Tanvir Kaisar el 22 de Feb. de 2019
What if there is categorical predictors? How should I convert it into numerals?
Bernhard Suhm
Bernhard Suhm el 7 de Mayo de 2020
Unfortunately, observation weights are currently not supported in multinomial regression. And mnrfit's link function defaults to 'logit', so above syntax would have used that.
However, you can provide observation weights if you use ftglm instead of the multinomial mnrfit, and it also has a couple alternatives to logit link.
So something like mdl = fitglm(meas,sp,'Distribution','binomial','Link','probit','Weights',obsWeights);
KAUSHIK JAS
KAUSHIK JAS el 25 de Jul. de 2020
Can you suggest me how to do Kernelized Logistic Regression in Matlab?

Iniciar sesión para comentar.

Preguntada:

el 15 de Mayo de 2016

Comentada:

el 25 de Jul. de 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by