fitglm
Fit a generalized linear regression model.
📝Syntax
mdl = fitglm(X, y)
mdl = fitglm(X, y, modelspec)
mdl = fitglm(X, y, ..., Name, Value)
yfit = predict(mdl, Xnew)
📄Description

fitglm creates a GeneralizedLinearModel object from numeric predictors X and response y.

Supported distributions are normal, binomial, and poisson. Supported links are identity, log, and logit, with canonical defaults for each distribution.

Supported model specifications include constant, linear, interactions, quadratic, purequadratic, and numeric term matrices. Name-value arguments include Distribution, Link, Intercept, PredictorNames, ResponseName, MaxIter, and TolFun.

💡Examples
X = [0; 1; 2; 3; 4; 5; 6; 7];
y = [1; 1; 2; 3; 5; 8; 13; 21];
mdl = fitglm(X, y, 'Distribution', 'poisson');
yfit = predict(mdl, [2; 4; 6])
🔗See Also
fitlmregressrobustfit
🕔Version History
Version Description
2.0.0 initial version
Edit this page on GitHub