Relationship between Linear Equations and Linear Regression

I just finished Week 1 of the machine learning specialization. After coming up with the linear equation to predict housing prices, I’m starting to think that there’s a relationship between univariate linear regression and linear equations. Specifically, I’m wondering if univariate linear regression is essentially a way to generalize linear equations for cases where we don’t know the initial constant values.

Consider a word problem like this (a random one picked off the internet):

“Joe and Steve are saving money. Joe starts with $105 and saves $5 per week. Steve starts with $5 and saves $15 per week. After how many weeks do they have the same amount of money?”

Of course, we can derive the equations to solve this problem given that we know the constants up front. However, if, for instance, we were only given how much Joe and Steve have each week, we could generalize the problem and apply linear regression to it. Is my understanding correct?

Yes.

That word problem essentially creates a data set with two examples.
That’s enough to learn a linear regression model.

1 Like

Hi @joshboat yes. You got it right. Basically if you have savings per week as independent variable to predict amount of money, you can make inference on people where you dont know how much money they have.

But remember linear regression also have an error component to account for unmeasured variables.

1 Like

Thanks @pastorsoto. This was helpful

By the error component, do you mean the bias?

Yes! This is because you won’t get a perfect model, unless there is perfect linearity, and in this case, you don’t need a regression model.

1 Like

Note that the error term exists, but we don’t try to model it (we have no method for that).

There is always measurement error that we cannot account for.

So it just accounts for why the predictions may not match the training set exactly when the data set is not trivial (i.e. when there are more than 2 points, and they do not perfectly match a straight line model.