# Transforming variable to change a variable so you could use it in a model?

If you had a variable where the functional form was incorrect and unknown (not squared, or exponential, or square root, etc.), what would be one way to “fix” the variable so you could use it in the model?

Using linear regression I am not sure exactly what methods can be done. I know about BoxCox and some of the transformations but this is not something that we have learned so I do not believe it to be a relevant answer.

• Can you plot $y$ against $x$? – V. Vancak Mar 3 at 20:28
• @V.Vancak I assume we can. We have been given no data. This is more of a theoretical scenario. – Jac Frall Mar 4 at 2:26

Recall Taylor Expansion of $$f(x)$$ at $$x=x_0$$, i.e., $$f(x) = \frac{1}{k!}\sum_{k=0}^{\infty}f^{(k)}(x_0)(x-x_0)^k,$$ asssuming that the data-generating model is $$y_i = f(x_i)+\epsilon_i$$ you can approximate $$f(x_i)$$ by a polynomial function. E.g., $$\mathbb{E}[y_i|x_i] \approx f(0)+f'(0)x+\frac{1}{2}f''(0)x^2=\beta_0+\beta_1x+\beta_2x^2.$$ You can use methods of variable selection to determine the most appropriate order, however if you don't have "enough" data points then you you should be careful to avoid over-fitting. In order to choose between linear and quadratic approximation you can apply, for example, Ramsey's RESET test.

• It turns out the answer they were looking for was to make the data categorical (ie. factor) – Jac Frall Mar 19 at 21:56