I don't understand this concept well and need help.

I was choosing whether to use a linear model or apply a non-linear transformation in my model formula. To do a diagnostic, I quickly plotted my data:

plotalldaily <- ggplot(amsd, aes(ImpressionsA, Leads.T)) + geom_point(color="orange")+geom_smooth()

enter image description here

From the plot, I guessed that a cubic polynomial transformation of my x variable should give me a better model fit. I referred this: http://www3.nd.edu/~rwilliam/stats2/l61.pdf . On Page 5, there is an explanation of polynomial models with cubic terms.

So I checked the model fit using two formulae- one with the non-linear transformation & another simple linear:

test1 <- lm(Leads.T~ImpressionsA, amsd)

test2 <- lm(Leads.T~I(ImpressionsA^3), amsd)

Strangely, the linear relationship is giving me a better model fit: Lower Standardized Error, Higher R-squared and Better Residuals Distribution.

TEST 1 Residuals

enter image description here

TEST 2 Residuals

enter image description here

I don't know what to make of it. Which model should I fit and what other kind of transformations should I try?


1 Answer 1


You haven't used the full form of the cubic representation and are missing two terms (i.e. have unintentionally constrained their parameters to equal zero):

$$Leads = \beta_{0} + \beta_{ImpA}ImpA + \beta_{ImpA^{2}}ImpA^{2} + \beta_{ImpA^{3}}ImpA^{3} + \varepsilon$$

Per the currently highest voted answer in Fitting polynomial model to data in R, you can do either

lm(Leads ~ ImpA + I(ImpA^2) + I(ImpA^{3}))

(as you indicate in your comment, but you had a missing parenthesis), or:

lm(Leads ~ poly(ImpA, 3, raw=TRUE))
  • $\begingroup$ will I have to write the formula as lm(Leads~ImpA+I(ImpA^2)+I(Imp^3) ? $\endgroup$
    – vagabond
    Jul 28, 2014 at 22:34
  • $\begingroup$ Thanks ! Output looks much better in terms of r-squared and standardized error but I have two more problems: 1) The intercept value for the non-linear model is higher and 2) Interpretation of negative coefficients ? How do I write my y=bx+bx^2+bx^3 formula? $\endgroup$
    – vagabond
    Jul 28, 2014 at 22:53
  • 1
    $\begingroup$ (1) Naturally the intercept will change if the functional form changes; (2) Your cubic model posits that the relationship between Leads and ImpA cannot be understood in terms of a single parameter, therefore when interpreting (e.g. predicting a value) you need to combine $\beta_{ImpA}ImpA$, $\beta_{ImpA^{2}}ImpA^{2}$, and $\beta_{ImpA^{3}}ImpA^{3}$; (3) I am not sure if you are asking this, but if you want to know how (for example) my answer used math notation if you click "edit" on a question or answer you can see the underlying markup. $\endgroup$
    – Alexis
    Jul 28, 2014 at 23:03

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.