Writing a simple linear regression function


Write a function that will read in an arbitrary number of data points (data will be collected from user input in our solution) and return the line of best fit using linear regression.

Note: A linear regression line of best fit has the format: y = mx + b, where x is the explanatory variable and y is the dependent variable. The slope of the line is m, and b is the intercept (the value of y when x = 0).


Access restricted

Subscribe to premium account to see the solution.

Get premium now