# Use log-transformation or polynomials

I am conducting a regression analysis in which there is not a linear relationship between my predictor (X) and outcome variable (Y). My data looks roughly like the image below. What I'm wondering is how I might decide between two options to alleviate this issue. On one hand, I've read that log-transforming the predictor can be appropriate in situations such as this - and doing so does seem to make the regression residuals look better (i.e., random). However, I've also read that nonlinear terms can be useful as well. Including a X and X-squared as predictors improves the R2 over a model containing only X as a predictor.

Thus, am I correct that both strategies are equally appropriate? Is there some reason that a researcher should adopt one over the other? Without having any special knowledge in this topic, it seems like using a log transformation might be better because it is simpler - this approach uses only 1 predictor while the nonlinear regression approach uses 2.

• You show a negative $y$ value for the lowest $x$. If that lowest $x$ is zero, it rules out taking logarithms of $x$ without some extra fudge. If that lowest $y$ is indeed possibly negative, some functional forms look less plausible. In general, a sensible functional form depends not just on the data but also on what you expect of the relationship on substantive (notably scientific) grounds, which you should expand on. – Nick Cox Jun 27 '17 at 8:03

Note that the two options you raise (transforming $y$ vs adding polynomial terms in $x$) have very different implications about

1. the behavior at (or somewhat past) the ends of the x-range

2. the variability about the curve (and hence about the relative weight the data points have in the fitting)

If your data look only roughly like the image it might be better to give a sample of actual data; what may to you look like a slightly different appearance visually might actually suggest quite a different model.

Models are generally best chosen for theoretical reasons; if you really have no idea of a suitable model (there's simply nothing understood about the variables or their relationships at all, so that you can't suggest even whether the relationship should be monotonic increasing, asymptotic, might decrease etc) and you just want a good fit to the data you have, then we're in the realm of developing a model from exploratory methods (hopefully on a subset of the data if you want to perform inference as well) -- in that case, I'd consider non-parametric regression methods (such as a spline fit perhaps), as a first step, followed by an examination of residuals to investigate the behavior of the spread about the local mean.

By the looks of it, a log-transformation of x seems like a reasonable step. You could plot y against log(x), and check whether the relationship looks linear. You already mention that the fit improved.

As you add more non-linear terms, the fit should improve in general, at least on the training data. However, this is not an indication that you have found a better model.

You could try to gather some knowledge of the domain, and see whether any of these transformations are meaningful. That apart, as you mentioned, simplicity, improved fit, and potentially a linear relationship makes the log transform a better choice than having other non-linear terms along with x.