How to run Logistic Regression in matlab
조회 수: 12 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
답변 (1개)
Image Analyst
2016년 5월 15일
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
Bernhard Suhm
2020년 5월 7일
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);
참고 항목
카테고리
Help Center 및 File Exchange에서 Linear Regression에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!