Path: blob/master/Data Analysis using Python/Numpy for Simple Linear Regression.ipynb
3047 views
Kernel: Python 3
Linear regression is a statistical approach for modelling relationship between a dependent variable with a given set of independent variables.
Simple Linear Regression Simple linear regression is an approach for predicting a response using a single feature.
WHY Linear Regression?
To find the parameters so that the model best fits the data.
Forecasting an effect
Determing a Trend
How do we determine the best fit line?
The line for which the the error between the predicted values and the observed values is minimum is called the best fit line or the regression line. These errors are also called as residuals.
The residuals can be visualized by the vertical lines from the observed data value to the regression line.
Ques - Find a linear function that predicts the response value(y) as accurately as possible as a function of the feature or independent variable(x).
x as feature vector, i.e x = [x_1, x_2, …., x_n],
y as response vector, i.e y = [y_1, y_2, …., y_n]
for n observations (in above example, n=10).
In [5]:
Out[5]:
In [7]:
Out[7]:
Estimated coefficients:
b_0 = 3.5619834710743117 \
b_1 = 0.8677685950413289
In [ ]: