My questions is, that I see people using R´s lm() (linear regression model) with Y ~ X^2 e.g. here: Simple non-linear regression problem

But I dont see how and why it works, hence lm() is clearly stated as a linear estimator (using OLS), why does it work for quadratic, clearly non-linear estimation, as well?

Thank you.

  • 1
    $\begingroup$ If you let $Z=X^2$ then you have a simple linear regression of $Y$ on $Z$. Hence the name. The method does not care that you may have used a non-linear function of independent variables: it does not see that $\endgroup$ – Henry Aug 11 '19 at 21:07
  • $\begingroup$ Nitpick: Y ~ X^2 is exactly the same as Y ~ X. You should study help("formula"). Apparently you eman Y ~ I(X^2). $\endgroup$ – Roland Aug 12 '19 at 6:31
  • $\begingroup$ @Henry, but how can I interpret U-shaped relationships with the output of my lm regression, which tells me that, for instance, increasing X by one leads to an increase of Y bei 5? $\endgroup$ – Tw3Ak3r Aug 12 '19 at 12:34
  • $\begingroup$ @Tw3Ak3r If the output of your regression is that $Y \approx 5X^2+k$ then an increase of $X^2$ by $1$ (not an increase in $X$) is associated with an increase in $Y$ of $5$ $\endgroup$ – Henry Aug 12 '19 at 12:55

lm fits linear models. In statistical parlance linear models are linear in the fitted parameter(s), often not in the independent variable(s). See, for example, Why is polynomial regression considered a special case of multiple linear regression?

  • $\begingroup$ I dont get it. If the relationship between X and Y is U-shaped, how can estimating a straight line into this relationship explain my assumption? If I believe that Very high and low values of a variable have high influence, and only medium values of my variable have low influence (thus forming an "U" as in the sense of X^2), how can saying that "Increasing X by one Unit increases Y by 5 units" be correct ? (if Beta/coefficient of x = 5) Clearly this is not corect because high and low Values of X lead to high Y, whereas medium values of X lead to low values of Y. $\endgroup$ – Tw3Ak3r Aug 12 '19 at 12:30
  • $\begingroup$ Read my answer again, slowly. You have a very common beginner's misunderstanding. In statistics "linear model" does NOT mean linear in the predictor (X), i.e. it does NOT imply a straight line (rectilinear) relationship between Y and X. See, for example, Wikipedia and note that "\phi _{1},\ldots ,\phi _{p} may be nonlinear functions". $\endgroup$ – user20637 Aug 12 '19 at 14:28

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