background

Regression in Python — Real Python

What does Regression mean by linear Regression? Regression literally means Regression. I believe that understanding this word, the linear regression may be impressed.

What exactly does Regression mean

It turned out to commemorate the discovery of Biostatistician Galton, Darwin’s cousin, who had been trying to find out why people are different from each other through evolution.

One of his big findings was that there was a relationship between the height of parents and the height of their children.

In our daily lives, we often wonder why some parents are tall and their children are short, and conversely, some parents are short and their children are tall. Galton’s explanation is that the average height of the offspring has returned to the centre. It is this tendency for offspring height to revert back to the average height of their peers that is responsible for the non-polarisation of human height.

So he used the word regression to describe the relationship between parental height Y and offspring height X.

Another interesting interpretation, interpreted from etymology, is regression:

  • “Re” : backward, backward, opposite, relative
  • Gress = walk
  • I can’t see the action, the state, etc

What does “regression” mean in regression analysis? – I am an observer’s answer – Zhihu’s answer is an interesting analogy to stir-fry:

The experience of cooking. If you cook tomatoes and eggs, you need to add salt and other seasonings to make them taste good. You put a small pinch, but not enough, add more, and the result is too much. Then add some water. It’s going to be bland. You feel like it’s a little bit too light, you add a little bit more salt, and when you’re done, you don’t end up adding salt. Is it delicious for you? This is what it feels like to be back.

This means constantly adjusting the ingredients (salt, water, etc.) that affect the taste of the dish until you find a balanced ratio. There is a constant “fallback” in the process of adjustment.

At this point, you finally understand what regression means. However, the statistical relationship between y and x does not always mean regression.

Regression in statistics

Study the relationship between variables

What does a variable mean? What kind of relationship does guanxi mean?

Let’s take a concrete example of linear regression:

You want to know why dev’s colleague A makes more money than you when he’s younger than you?

In other words, what are the factors that affect your salary?

You think about it, although A is young, but A little earlier than you came to the company, education is higher than you, will talk (may just come when the salary is high?) , and so on.

Corresponding to the problem above, in this case,

  • What are the variables?

Wage (y)

  • What kind of relationship does guanxi mean?

What is the relationship between salary and age (X1), length of service (X2), education (X3), personality (X4) and other factors

In statistical terms, to find a function -= the number y = f(x) where x: x1…. xn.

Here, y (wage) is the dependent variable, x1… Xn is the independent variable.

Here’s another example:

A leader asked his subordinates to investigate the real estate situation in a city

House price (y) is one of his tests

Which factors (X1… Xn) affects the direction of housing prices in the city

There are many other examples.

The key points are: the two points of linear regression study:

  • x1… Does xn affect y
  • If it does, to what extent does it affect y

Reference

  • Linear Regression in Python — Real Python
  • Why is there a statistical regression?
  • What does regression mean in regression analysis
  • Book: Applying regression analysis