La regressione lineare per descrivere il modello matematico e fare previsioni a partire da dati sperimentali

Describe mathematical relationships and make predictions from experimental data

Questa tecnica di modellazione statistica è usata per descrivere una variabile di risposta continua in funzione di una o più variabili esplicative (predittori). Può contribuire a capire e a prevedere il comportamento di sistemi complessi, nonché ad analizzare dati sperimentali, finanziari e biologici.

Le tecniche di regressione lineare vengono usate per creare un modello lineare. Il modello descrive la relazione fra una variabile dipendente \(y\) (chiamata anche "la risposta") come funzione di una o più variabili indipendenti \(X_i\) (chiamate "i predittori").

'equazione generale per un modello di regressione lineare è:

\[y = \beta_0 + \sum \ \beta_i X_i + \epsilon_i\]

dove \(\beta\) rappresenta le stime per i parametri lineari da calcolare e \(\epsilon\) rappresenta i termini di errore.

Esistono vari tipi di modelli:

  • semplice: modello con un solo predittore;

  • multiplo: modello con predittori multipli;

  • multivariato: modello con variabili di risposta multiple.

Simple linear regression example showing how to predict the number of fatal traffic accidents in a state (response variable, \(Y\)) compared to the population of the state (predictor variable, \(X\).). (See MATLAB® code example and how to use the mldivide operator to estimate the coefficients for a simple linear regression.)

La regressione lineare semplice viene eseguita comunemente in MATLAB®. Per quella multipla e multivariata, vedi lo Statistics and Machine Learning Toolbox™. Sono disponibili regressioni multiple, a gradino (stepwise), robuste e multivariate per:

Multiple linear regression example, which predicts the miles per gallon (MPG) of different cars (response variable, \(Y\)) based on weight and horsepower (predictor variables, \(X_j\)). (See MATLAB code example, how to use the regress function and determine significance of the multiple linear regression relationship.)

Multivariate linear regression: models for multiple response variables. This regression has multiple \(Y_i\)derived from the same data \(Y\). They are expressed in different formulae. An example of this system with 2 equations is:

\[Y_1 = \beta_{01} + \beta_{11} X_1 + \epsilon_1\]

\[Y_2 = \beta_{02} + \beta_{1 2}X_1 + \epsilon_2\]

Multivariate linear regression example showing how to predict the flu estimates for 9 regions (response variables, \(Y_i\)), based on the week of the year (predictor variable, \(X\)). (See MATLAB code example and how to use the mvregress function to determine the estimated coefficients for a multivariate linear regression.)

Multivariate multiple linear regression: models using multiple predictors for multiple response variables. This regression has multiple \(X_i\) to predict multiple responses \(Y_i\). A generalization of the equations is:

Multivariate multiple linear regression example that calculates the city and highway MPG (as response variables, \(Y_1\) and \(Y_2\)) from three variables: wheel base, curb weight, and fuel type (predictor variables, \(X_1\), \(X_2\) and \(X_3\)). (See MATLAB code example and how to use the mvregress function to estimate the coefficients.).

Applications of linear regression

Linear regressions have some properties that make them very interesting for the following applications :

  • Prediction or forecasting – Use a regression model to build a forecast model for a specific data set. From the mode, you can use regression to predict response values where only the predictors are known.
  • Strength of the regression – Use a regression model to determine if there is a relationship between a variable and a predictor, and how strong this relationship is.

Linear regression with MATLAB

Engineers commonly create simple linear regression models with MATLAB. For multiple and multivariate linear regression, you can use the Statistics and Machine Learning Toolbox™ from MATLAB. 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™.

Per creare un modello lineare per il fitting di curve e superfici ai tuoi dati, vedere il Curve Fitting Toolbox™.



Scopri i nostri corsi per ottenere il massimo dai prodotti MathWorks.