Main Content

Generalized Linear Regression

Generalized linear regression models with various distributions and link functions, including logistic regression

For greater accuracy and link function choices on low-dimensional through medium-dimensional data sets, fit a generalized linear regression model using fitglm. For a multinomial logistic regression, fit a model using fitmnr.

To reduce computation time on high-dimensional data sets, train a binary, linear classification model, such as a logistic regression model, by using fitclinear. You can also efficiently train a multiclass error-correcting output codes (ECOC) model composed of logistic regression models by using fitcecoc.

For nonlinear classification with big data, train a binary, Gaussian kernel classification model with logistic regression by using fitckernel.

Blocks

ClassificationLinear PredictClassify observations using linear classification model (Since R2023a)

Functions

expand all

Create GeneralizedLinearModel Object

fitglmCreate generalized linear regression model
stepwiseglmCreate generalized linear regression model by stepwise regression

Create CompactGeneralizedLinearModel Object

compactCompact generalized linear regression model

Add or Remove Terms from Generalized Linear Model

addTermsAdd terms to generalized linear regression model
removeTermsRemove terms from generalized linear regression model
stepImprove generalized linear regression model by adding or removing terms

Predict Responses

fevalPredict responses of generalized linear regression model using one input for each predictor
predictPredict responses of generalized linear regression model
randomSimulate responses with random noise for generalized linear regression model

Evaluate Generalized Linear Model

coefCIConfidence intervals of coefficient estimates of generalized linear regression model
coefTestLinear hypothesis test on generalized linear regression model coefficients
devianceTestAnalysis of deviance for generalized linear regression model
partialDependenceCompute partial dependence (Since R2020b)

Visualize Generalized Linear Model and Summary Statistics

plotDiagnosticsPlot observation diagnostics of generalized linear regression model
plotPartialDependenceCreate partial dependence plot (PDP) and individual conditional expectation (ICE) plots
plotResidualsPlot residuals of generalized linear regression model
plotSlicePlot of slices through fitted generalized linear regression surface

Gather Properties of Generalized Linear Model

gatherGather properties of Statistics and Machine Learning Toolbox object from GPU (Since R2020b)

Create MultinomialRegression Object

fitmnrFit multinomial regression model (Since R2023a)

Work with MultinomialRegression Object

coefCIConfidence intervals for coefficient estimates of multinomial regression model (Since R2023a)
coefTestLinear hypothesis test on multinomial regression model coefficients (Since R2023a)
fevalPredict responses of multinomial regression model using one input for each predictor (Since R2023a)
partialDependenceCompute partial dependence (Since R2020b)
plotPartialDependenceCreate partial dependence plot (PDP) and individual conditional expectation (ICE) plots
plotResidualsPlot residuals of multinomial regression model (Since R2023a)
plotSlicePlot of slices through fitted multinomial regression surface (Since R2023a)
predictPredict responses of multinomial regression model (Since R2023a)
randomGenerate random responses from fitted multinomial regression model (Since R2023a)
testDevianceDeviance test for multinomial regression model (Since R2023a)

Create Object

fitclinearFit binary linear classifier to high-dimensional data
fitcecocFit multiclass models for support vector machines or other classifiers
fitckernelFit binary Gaussian kernel classifier using random feature expansion
templateLinearLinear learner template

Predict Labels

predictPredict labels for linear classification models
predictClassify observations using multiclass error-correcting output codes (ECOC) model
predictPredict labels for Gaussian kernel classification model
glmfitFit generalized linear regression model
glmvalGeneralized linear model values

Objects

expand all

GeneralizedLinearModelGeneralized linear regression model class
CompactGeneralizedLinearModelCompact generalized linear regression model class
MultinomialRegressionMultinomial regression model (Since R2023a)
ClassificationLinearLinear model for binary classification of high-dimensional data
ClassificationECOCMulticlass model for support vector machines (SVMs) and other classifiers
ClassificationKernelGaussian kernel classification model using random feature expansion
ClassificationPartitionedLinearCross-validated linear model for binary classification of high-dimensional data
ClassificationPartitionedLinearECOCCross-validated linear error-correcting output codes model for multiclass classification of high-dimensional data

Topics

Generalized Linear Regression

Multinomial Logistic Regression

  • Multinomial Models for Nominal Responses
    A nominal response variable has a restricted set of possible values with no natural order between them. A nominal response model explains and predicts the probability that an observation is in each category of a categorical response variable.
  • Multinomial Models for Ordinal Responses
    An ordinal response variable has a restricted set of possible values that fall into a natural order. An ordinal response model describes the relationship between the cumulative probabilities of the categories and predictor variables.
  • Multinomial Models for Hierarchical Responses
    A hierarchical multinomial response variable (also known as a sequential or nested multinomial response) has a restricted set of possible values that fall into hierarchical categories. The hierarchical multinomial regression models are extensions of binary regression models based on conditional binary observations.