Reputation: 103
I'm trying to perform logistic regression to do classification using MATLAB. There seem to be two different methods in MATLAB's statistics toolbox to build a generalized linear model 'glmfit' and 'fitglm'. I can't figure out what the difference is between the two. Is one preferable over the other?
Here are the links for the function descriptions.
http://uk.mathworks.com/help/stats/glmfit.html http://uk.mathworks.com/help/stats/fitglm.html
Upvotes: 10
Views: 8386
Reputation: 15708
In addition to Dan's answer, I would like to add the following.
The function fitglm
, like newer functions from the statistics toolbox, accepts more flexible inputs than glmfit
. For example, you can use a table as the data source, specifyy a formula of the form Y ~ X1 + X2 + ...
, and use categorical variables.
As a side note, the function lassoglm
uses (depends on) glmfit
.
Upvotes: 5
Reputation: 45752
The difference is what the functions output. glmfit
just outputs a vector of the regression coefficients (and some other stuff if you ask for it). fitglm
outputs a regression object that packs all sorts of information and functionality inside (See the docs on GeneralizedLinearModel class). I would assume the fitglm
is intended to replace glmfit
.
Upvotes: 10