Linear Regression
Linear regression is a statistical method used to model the relationship between a dependent variable and one or more independent variables by fitting a linear equation to the observed data.
In its simplest form, it aims to find a straight line (the regression line) that minimizes the sum of the squared differences between the observed values and the values predicted by the line.
Linear regression is used for predictive modeling and data analysis.
Example
X | Y |
---|---|
1 | 2 |
2 | 3 |
3 | 5 |
4 | 4 |
5 | 5 |
6 | 6 |
7 | 8 |
8 | 10 |
9 | 9 |
set title "Linear Regression Example" unset grid set yrange [0:10] set xrange [0:10] f(x) = a*x + b fit f(x) data using 1:2 via a, b plot data using 1:2 title 'Data Points', f(x) title 'Fitted Line'