This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Multiple Linear Regression

Linear regression with multiple predictor variables

For greater accuracy on low- through medium-dimensional data sets, fit a linear regression model using fitlm.

For reduced computation time on high-dimensional data sets that fit in the MATLAB® Workspace, fit a linear regression model using fitrlinear.


Regression LearnerTrain regression models to predict data using supervised machine learning


LinearModelLinear regression model class
CompactLinearModelCompact linear regression model class
RegressionLinearLinear regression model for high-dimensional data
RegressionPartitionedLinearCross-validated linear regression model for high-dimensional data


fitlmCreate linear regression model
stepwiselm Create linear regression model using stepwise regression
compactCompact linear regression model
dispDisplay linear regression model
fevalEvaluate linear regression model prediction
predictPredict response of linear regression model
randomSimulate responses for linear regression model
plotScatter plot or added variable plot of linear model
plotAdjustedResponseAdjusted response plot for linear regression model
fitrlinearFit linear regression model to high-dimensional data
predictPredict response of linear regression model
dummyvarCreate dummy variables
invpredInverse prediction
plotPartialDependenceCreate partial dependence plot (PDP) and individual conditional expectation (ICE) plots
plsregressPartial least-squares regression
relieffRank importance of predictors using ReliefF or RReliefF algorithm
x2fxConvert predictor matrix to design matrix
regressMultiple linear regression
robustdemoInteractive robust regression
robustfitRobust regression
rsmdemoInteractive response surface demonstration
rstoolInteractive response surface modeling

Examples and How To

Linear Regression

Fit a linear regression model and examine the result.

Interpret Linear Regression Results

Display and interpret linear regression output statistics.

Linear Regression Workflow

Import and prepare data, fit a regression, test and improve its quality, and share it.

Regression with Categorical Covariates

Perform a regression with categorical covariates using categorical arrays and fitlm.

Regression Using Tables

This example shows how to perform linear and stepwise regression analyses using tables.

Robust Regression — Reduce Outlier Effects

Fit a robust model that is less sensitive than ordinary least squares to large changes in small parts of the data.

Parametric Regression Analysis

Choose a regression function, and update legacy code using new fitting functions.

Partial Least Squares

Partial least squares (PLS) constructs new predictor variables as linear combinations of the original predictor variables, while considering the observed response values, leading to a parsimonious model with reliable predictive power.

Partial Least Squares Regression and Principal Components Regression

This example shows how to apply Partial Least Squares Regression (PLSR) and Principal Components Regression (PCR), and discusses the effectiveness of the two methods.


What Are Linear Regression Models?

Regression models describe the relationship between a dependent variable and one or more independent variables.

Wilkinson Notation

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