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 mnrfit.

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.

Objects

expand all

GeneralizedLinearModelGeneralized linear regression model class
CompactGeneralizedLinearModelCompact generalized linear regression model class
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

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

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 linear or generalized linear regression model

Create Object

fitclinearFit linear classification model to high-dimensional data
fitcecocFit multiclass models for support vector machines or other classifiers
fitckernelFit Gaussian kernel classification model using random feature expansion
templateLinearLinear classification 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
mnrfitMultinomial logistic regression
mnrvalMultinomial logistic regression values
glmfitGeneralized linear model regression
glmvalGeneralized linear model values

Topics

Generalized Linear Regression

Generalized Linear Models

Generalized linear models use linear methods to describe a potentially nonlinear relationship between predictor terms and a response variable.

Generalized Linear Model Workflow

Fit a generalized linear model and analyze the results.

Fitting Data with Generalized Linear Models

Fit and evaluate generalized linear models using glmfit and glmval.

Train Logistic Regression Classifiers Using Classification Learner App

Create and compare logistic regression classifiers, and export trained models to make predictions for new data.

Wilkinson Notation

Wilkinson notation provides a way to describe regression and repeated measures models without specifying coefficient values.

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.

Hierarchical Multinomial Models

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.