6

I'm answering a practice exam questions, and having trouble with one on quadratic terms. Could someone give me a quick summery of

1) why they are sometimes included?

2) How to interpret them?

In regards to 2) specifically how would you interpret the sign of the coefficient?

3)If we drew a curve of fitted values, and the curve achieved its maximum value at a value of 20 years, how would I interpret that? Is it that values larger then 20 years are associated with a decline in the response variable?

Thanks

I think I understand these concepts, but would appreciate some reassurence

2 Answers2

16

Lets consider an example (here I use Stata, but the logic works the same in any other package):

. sysuse nlsw88, clear
(NLSW, 1988 extract)


. reg wage c.tenure##c.tenure grade i.race

      Source |       SS           df       MS      Number of obs   =     2,229
-------------+----------------------------------   F(5, 2223)      =     66.51
       Model |  9640.89034         5  1928.17807   Prob > F        =    0.0000
    Residual |  64447.0774     2,223   28.991038   R-squared       =    0.1301
-------------+----------------------------------   Adj R-squared   =    0.1282
       Total |  74087.9678     2,228  33.2531274   Root MSE        =    5.3843

------------------------------------------------------------------------------
        wage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      tenure |   .2773182   .0677307     4.09   0.000     .1444962    .4101402
             |
    c.tenure#|
    c.tenure |  -.0070752   .0036278    -1.95   0.051    -.0141894    .0000389
             |
       grade |   .6792721   .0461853    14.71   0.000     .5887013    .7698429
             |
        race |
      black  |  -.7517506   .2649033    -2.84   0.005    -1.271234   -.2322669
      other  |   .6315991    1.06455     0.59   0.553    -1.456017    2.719215
             |
       _cons |  -2.106807   .6357411    -3.31   0.001    -3.353516   -.8600988
------------------------------------------------------------------------------

Adding the quadratic term tenure$^2$ (c.tenure#c.tenure) to the model means that the effect of tenure changes when you get more tenure. When you have 0 years of tenure, the slope is such that your hourly wage would increase by 28 cents for an additional year of tenure if the slope would remain unchanged, which it doesn't. (Hourly wage is in dollars, so a .28 dollar change is a 28 cents change.) Each additional year of tenure reduces the slope by .7 cents. In this case the coefficient of the square term is negative, so the relationship is concave. It usually helps to see this relationship as a graph:

. qui margins, at(grade=12 race=1 tenure=(0/26))

. marginsplot

  Variables that uniquely identify margins: tenure

enter image description here

Initially you get a higher wage as you get more tenure, but the gain decreases and even becomes negative after say 20 years of tenure. We can be more precise about when this occurs:

. nlcom -_b[tenure]/(2*_b[c.tenure#c.tenure])

       _nl_1:  -_b[tenure]/(2*_b[c.tenure#c.tenure])

------------------------------------------------------------------------------
        wage |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       _nl_1 |   19.59777   5.692054     3.44   0.001     8.441549    30.75399
------------------------------------------------------------------------------

notice the huge confidence interval, this is quite typical, so be careful about interpreting the position of the maximum.

Maarten Buis
  • 21,005
-1

1) Adding quadratic terms allows for non-linearity (in a linear model). If you think that the relation between your target variable and a feature is possibly non-linear, you can add quadratic terms. (Or, you could consider log transformation.)

2) Significance of quadratic terms could signal that the relation is non-linear. The sign merely represents the type of non linearity. A positive quadratic term could suggest that your relation is exponential. A negative relation suggests that for low values of your feature, the relation might be positive, but for high values the relation becomes negative.

3) Correct. Apparently the fitted function is such that a maximum value of 20 can be predicted. After that the non-linear term dominates, if it's sign is negative.

Is this of any help?

slicer_on
  • 27
  • 2
  • 4
    When the coefficient for the squared term is positive, the relationship is convex, not exponential. When that coefficient is negative than the relationship is concave. As to 3) it is not that the value 20 is the maximum predicted value, but that the maximum predicted value occurs at 20. – Maarten Buis May 09 '16 at 13:45