Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Interpretation of nonlinear relationships

    In my regression model, I want to test the possibility of a nonlinear relationship, therefore I include a squared term for the coefficient.

    In my results, x is not significant, but x-squared is significant. I believe this means that the relationship is increasing at an increasing rate. However, when I plot the predicted values, the fitted line is u-shape.

    Might anyone be able to help me with this interpretation? Thank you!

  • #2
    Originally posted by Jessica Berrett View Post

    In my results, x is not significant, but x-squared is significant. I believe this means that the relationship is increasing at an increasing rate.
    Significance tells you no such thing. You need to look at the signs of the coefficients on the linear term and on the quadratic term. For an inverted-U shape, you have a positive coefficient on the linear term and a negative coefficient on the quadratic term. For a U-shape, you have a negative coefficient on the linear term and a positive coefficient on the quadratic term.

    Code:
    sysuse auto, clear
    regress mpg price c.weight##c.weight
    *U-SHAPE - COMPUTE MINIMUM
    margins, expression(-_b[weight]/(2*_b[c.weight#c.weight]))
    *COMPUTE MARGINS
    margins, at(weight=(2000(500)6000))
    *GRAPH
    set scheme s1mono
    marginsplot, xline(`=-_b[weight]/(2*_b[c.weight#c.weight])') recast(line) noci title("")
    Res.:


    Code:
    . regress mpg price c.weight##c.weight
    
          Source |       SS           df       MS      Number of obs   =        74
    -------------+----------------------------------   F(3, 70)        =     50.23
           Model |  1668.47498         3  556.158328   Prob > F        =    0.0000
        Residual |  774.984475        70  11.0712068   R-squared       =    0.6828
    -------------+----------------------------------   Adj R-squared   =    0.6692
           Total |  2443.45946        73  33.4720474   Root MSE        =    3.3273
    
    -----------------------------------------------------------------------------------
                  mpg | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
    ------------------+----------------------------------------------------------------
                price |  -.0002597   .0001696    -1.53   0.130     -.000598    .0000786
               weight |   -.016047   .0040403    -3.97   0.000     -.024105   -.0079889
                      |
    c.weight#c.weight |   1.72e-06   6.71e-07     2.56   0.013     3.79e-07    3.06e-06
                      |
                _cons |   54.66807   6.150716     8.89   0.000     42.40086    66.93529
    -----------------------------------------------------------------------------------
    
    
    . *U-SHAPE - COMPUTE MINIMUM
    
    . 
    . margins, expression(-_b[weight]/(2*_b[c.weight#c.weight]))
    warning: option expression() does not contain option predict() or xb().
    warning: prediction constant over observations.
    
    Predictive margins                                          Number of obs = 74
    Model VCE: OLS
    
    Expression: -_b[weight]/(2*_b[c.weight#c.weight])
    
    ------------------------------------------------------------------------------
                 |            Delta-method
                 |     Margin   std. err.      z    P>|z|     [95% conf. interval]
    -------------+----------------------------------------------------------------
           _cons |   4671.197   683.8466     6.83   0.000     3330.882    6011.512
    ------------------------------------------------------------------------------
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	42.4 KB
ID:	1714269

    Last edited by Andrew Musau; 19 May 2023, 17:14.

    Comment


    • #3
      Hi Matthew, I appreciate your response. You are correct, and I forgot to include the signs in my original post. Let me clarify. The coefficient for the linear value is negative but not significant, and the coefficient for the quadratic term is positive and significant. If I'm interpreting this correctly, I think this means it's increasing at an increasing rate. However, when I plot the predicted values, the fitted line is U-shape.

      In Stata, I'm using:
      twoway qfit predicted_value x_value
      Click image for larger version

Name:	Screenshot 2023-05-19 at 7.06.50 PM.png
Views:	1
Size:	470.6 KB
ID:	1714273

      Attached Files
      Last edited by Jessica Berrett; 19 May 2023, 19:09.

      Comment


      • #4
        If I'm interpreting this correctly, I think this means it's increasing at an increasing rate. However, when I plot the predicted values, the fitted line is U-shape.
        Seeing a U-shape is not surprising. Perhaps try think of it as "the slope is having an increasing larger positive adjustment as x increases" rather than "increasing at an increasing rate." When x = .2 you can see that the down-slope was very steep, but as x = .4 the down-slope was less steep. Which means the slope is becoming less negative. And that change was due to the positive adjustment brought by the positive quadratic term. Once the positive adjustment from the quadratic term is enough to offset the initial negative trend, the slope will pass through being 0 (where x ~ 0.55) and start to exceed it, contributing a steeper and steeper up trend.

        Comment


        • #5
          One way forward here is to realise that a predictor and its square are mutually dependent. If you fit a linear and a quadratic term together, so fitting both at the same time, their performance is a joint or team performance. Although the machinery gives separate results, they don't help much in interpretation. It's like assessing the relationship of a couple, which depends jointly on both partners.

          A U-shape (strictly a parabolic shape) is what you always get over the entire real line, but within the range of the data it's possible to see only curvature with no turning point.

          This may have been (should have been?) covered in your secondary school mathematics, although that may have been some years ago.

          Here is a simple script you can run to see some of the possibilities:

          Code:
          clear
          
          twoway function 0.1 * x + x^2, range(-1 1) name(A, replace)
          
          twoway function x + 0.1 * x^2, range(-1 1) name(B, replace)
          
          twoway function 0.1 * x  - x^2, range(-1 1) name(C, replace)
          
          twoway function -x - 0.1*x^2, range(-1 1) name(D, replace)
          
          graph combine A B C D

          Comment

          Working...
          X