This is my first post here. I hope I can make myself clear. Right now I'm learning linear regression as part of an introduction class to machine learning.

After going over the steps in the simple regression formulae, I realized that I had been doing something similar in the past to construct lines. In Python:

data = [{'x': 1, 'y': 2}, {'x': 5, 'y': 7}, {'x': 6, 'y': 8}]
coeff = sum([d['x'] / d['y'] for d in data]) / len(data)

Here, we're calculating the mean ratio between the variables, which we can use as a coefficient for constructing a line. Does this method have a name, and how does it relate to simple linear regression?

  • 2
    $\begingroup$ Something similar (instead of dividing x to y, divide the difference to y) is called mean absolute percentage error (en.wikipedia.org/wiki/Mean_absolute_percentage_error) but percentages/ratios require absolute zeros. Regression does not have that requirement and the calculations are quite different actually. $\endgroup$
    – ayhan
    Jun 22, 2016 at 8:12

1 Answer 1


I do not know other terms than the average of inverse slope or the inverse of the harmonic mean of slopes. This is also the negative of the average slope of the perpendiculars.

It gives you the inverse of the average slope of lines passing through $(0,0)$ and $(x_i,y_i)$. If the $(x,y)$ are almost aligned with $(0,0)$, this is an estimate of the inverse of the slope of a line passing through the points.

Linear regression is quite different, as it involves cross-products of sums of $x$ or $y$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.