Linear models describe a continuous response variable as a function of one or more predictor variables. They can help you understand and predict the behavior of complex systems or analyze experimental, financial, and biological data.

Linear regression is a statistical method used to create a linear model. The model describes the relationship between a dependent variable y (also called the response) as a function of one or more independent variables X_{i} (called the predictors). The general equation for a linear model is:

`y = β _{0} + ∑ β_{i}X_{i} + ε_{i}`

where β represents linear parameter estimates to be computed and ε represents the error terms.

There are several types of linear regression:

**Simple linear regression:**models using only one predictor**Multiple linear regression:**models using multiple predictors**Multivariate linear regression:**models for multiple response variables

Simple linear regression is commonly done in MATLAB. For multiple and multivariate linear regression, see Statistics and Machine Learning Toolbox. It enables stepwise, robust, and multivariate regression to:

- Generate predictions
- Compare linear model fits
- Plot residuals
- Evaluate goodness-of-fit
- Detect outliers

To create a linear model that fits curves and surfaces to your data, see Curve Fitting Toolbox. To create linear models of dynamic systems from measured input-output data, see System Identification Toolbox. To create a linear model for control system design from a nonlinear Simulink model, see Simulink Control Design.

- Statistics Toolbox Overview 3:06 (Video)
- Fitting with MATLAB: Statistics, Optimization, and Curve Fitting 38:37 (Webinar)
- Partial Least Squares Regression and Principal Components Regression (Example)
- MATLAB Tools for Scientists - Introduction to Statistical Analysis 54:52 (Webinar)
- Machine Learning with MATLAB 3:02 (Video)
- Estimating Transfer Functions and Process Models 2:27 (Video)

- What Are Linear Regression Models? (Documentation)
- Linear Model Function in Statistics and Machine Learning Toolbox (Function)
- Choosing a Fitting Method for Linear Regression (Documentation)
- Interpreting Results of a Linear Regression (Documentation)
- Analyzing Linear Regression Diagnostics (Documentation)
- What is Robust Regression? (Documentation)

*See also*: *Statistics and Machine Learning Toolbox*, *Curve Fitting Toolbox*, *machine learning*, *linearization*, *data fitting*, *data analysis*, *mathematical modeling*, *time series regression*, *linear model videos*

Use MATLAB for Big Data, Machine Learning and Production Analytics Systems.

Data Analytics with MATLAB