Announcement

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

  • How to know if there is an (inverted) U-shape or a linear relationship?

    Good evening,

    I am currently building a regression model for a seminar paper and would like to test whether there is a linear, U-shape or inverted U-shape relationship.

    My variables are as follows:

    Dependent: q_tot
    Independent: rdalliances
    Moderators: munificence, complexity and dynamism
    The rest are control variables

    and I included a time-dummy (i.fyear) and fixed-effects (fe) in the model, which was recommended by the Hausman test.

    I used the following command:

    Code:
        xtset gvkey fyear
        xtreg q_tot rdalliances rdalliances_2 rdi_w adi_w ln_emp1_w lev munificence complexity dynamism i.fyear, fe vce(robust)
        utest rdalliances rdalliances_2
    And got the following significant result, indicating an inverted U-shape relationship:


    utest rdalliances rdalliances_2
    (107,372 missing values generated)

    Specification: f(x)=x^2
    Extreme point: 22.29524

    Test:
    H1: Inverse U shape
    vs. H0: Monotone or U shape

    -------------------------------------------------
    | Lower bound Upper bound
    -----------------+-------------------------------
    Interval | 0 57
    Slope | .1376231 -.214224
    t-value | 2.847806 -3.326562
    P>|t| | .0022052 .0004411
    -------------------------------------------------

    Overall test of presence of a Inverse U shape:
    t-value = 2.85
    P>|t| = .00221


    Now, I got a tip from another student, who did the following command, which gives a graph that does not show an inverted- U-shape and that is difficult to interpret for me.

    Code:
        scatter q_tot rdalliances
        regress q_tot rdalliances rdalliances_2
        twoway qfitci  q_tot rdalliances_2 if e(sample) == 1

    Click image for larger version

Name:	Screenshot 2022-01-04 184819.jpg
Views:	1
Size:	74.6 KB
ID:	1643590


    It would be of great gelp if someone could help me figuring out which shape is the right for my model.

    Thanks in advance,
    Hanna













    Attached Files

  • #2
    Hanna:
    as per FAQ, please show the outcome table of the following (I assume that -rdalliance- is a continuous predictor):
    Code:
    xtset gvkey fyear
        xtreg q_tot c.rdalliance##c.rdalliances rdi_w adi_w ln_emp1_w lev munificence complexity dynamism i.fyear, fe vce(robust)
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      Hello Carlo,

      thanks for your reply. Sorry for my incomplete data. Here is the result table from the following code:
      Code:
      xtreg q_tot c.rdalliances##c.rdalliances rdi_w adi_w ln_emp1_w lev munificence complexity dynamism i.fyear, fe vce(robust)

      Code:
      .         xtset gvkey fyear
      
      Panel variable: gvkey (unbalanced)
       Time variable: fyear, 1990 to 2017, but with gaps
               Delta: 1 unit
      
      .         xtreg q_tot c.rdalliances##c.rdalliances rdi_w adi_w ln_emp1_w lev munificence complexity dynamism i.fyear, fe vce(robust)
      
      Fixed-effects (within) regression               Number of obs     =     97,045
      Group variable: gvkey                           Number of groups  =     10,905
      
      R-squared:                                      Obs per group:
           Within  = 0.0018                                         min =          1
           Between = 0.0051                                         avg =        8.9
           Overall = 0.0027                                         max =         28
      
                                                      F(36,10904)       =      10.29
      corr(u_i, Xb) = 0.0110                          Prob > F          =     0.0000
      
                                                  (Std. err. adjusted for 10,905 clusters in gvkey)
      ---------------------------------------------------------------------------------------------
                                  |               Robust
                            q_tot | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
      ----------------------------+----------------------------------------------------------------
                      rdalliances |   .1376231    .048326     2.85   0.004     .0428953    .2323508
                                  |
      c.rdalliances#c.rdalliances |  -.0030864   .0009666    -3.19   0.001     -.004981   -.0011918
                                  |
                            rdi_w |  -.0257423   .0446458    -0.58   0.564    -.1132562    .0617716
                            adi_w |  -2.156041   2.889798    -0.75   0.456     -7.82057    3.508487
                        ln_emp1_w |  -.7035516   .4909174    -1.43   0.152    -1.665839    .2587357
                              lev |   .0000634   .0002124     0.30   0.765    -.0003529    .0004797
                      munificence |  -.0083835   .0111881    -0.75   0.454    -.0303142    .0135472
                       complexity |  -.0124099   .0111828    -1.11   0.267    -.0343302    .0095104
                         dynamism |   .7057164    15.7859     0.04   0.964    -30.23752    31.64895
                                  |
                            fyear |
                            1991  |   .2380244   .0557568     4.27   0.000     .1287309    .3473178
                            1992  |   .2762452   .0681123     4.06   0.000     .1427327    .4097577
                            1993  |   .4859586   .0809243     6.01   0.000     .3273323    .6445849
                            1994  |   .1170602   .1061797     1.10   0.270    -.0910713    .3251918
                            1995  |   .6510358   .2009105     3.24   0.001     .2572148    1.044857
                            1996  |   .5152917   .1450736     3.55   0.000     .2309211    .7996623
                            1997  |   .7454193   .1794191     4.15   0.000     .3937252    1.097113
                            1998  |   .7543349   .2382032     3.17   0.002     .2874134    1.221256
                            1999  |   1.217486   .2531688     4.81   0.000     .7212289    1.713742
                            2000  |   .8855819   .2982747     2.97   0.003     .3009093    1.470255
                            2001  |   .6387998   .2765712     2.31   0.021       .09667     1.18093
                            2002  |   .1411374   .3430016     0.41   0.681     -.531208    .8134828
                            2003  |   .4145468   .1990386     2.08   0.037     .0243951    .8046985
                            2004  |   .4632173   .2151444     2.15   0.031     .0414952    .8849394
                            2005  |   .6239823   .2381449     2.62   0.009     .1571751     1.09079
                            2006  |   .7907952    .284232     2.78   0.005     .2336487    1.347942
                            2007  |   .3661173   .6847971     0.53   0.593    -.9762094    1.708444
                            2008  |   -.711842   .8688423    -0.82   0.413    -2.414931    .9912467
                            2009  |   .7724446   1.043326     0.74   0.459    -1.272664    2.817553
                            2010  |  -.2765014   .6483802    -0.43   0.670    -1.547444    .9944415
                            2011  |    .532235   .6335684     0.84   0.401    -.7096741    1.774144
                            2012  |   .4327095    .358434     1.21   0.227    -.2698862    1.135305
                            2013  |   2.852259   1.298427     2.20   0.028      .307106    5.397412
                            2014  |   2.311516   1.439437     1.61   0.108    -.5100413    5.133073
                            2015  |  -.6887462   .8020028    -0.86   0.390    -2.260817    .8833249
                            2016  |   .3286416   1.108239     0.30   0.767    -1.843709    2.500992
                            2017  |   .3940047   .7190646     0.55   0.584    -1.015492    1.803502
                                  |
                            _cons |   6.892991   3.128801     2.20   0.028     .7599733    13.02601
      ----------------------------+----------------------------------------------------------------
                          sigma_u |  46.676253
                          sigma_e |  30.602909
                              rho |  .69936607   (fraction of variance due to u_i)
      ---------------------------------------------------------------------------------------------

      Comment


      • #4
        So let's take a look at the output for dalliances and c.dalliances#c.dalliances. Both coefficients are "statistically significant." So there's that. But, in my view that's not a good way to choose a model. The -utest- results you got, which are just a similar way of looking at statistical significance of quadratic terms, also supports an inverse-U.

        I don't really know what to make of the other code/graph you show in #1. It is based on relating the outcome to a quadratic function of a pure quadratic term in dalliances--but that is just a clear mis-specification of the relationship and doesn't even answer your question anyway. If you want to look at this graphically (which I encourage you to do), do a scatterplot of q_tot vs dalliances (not dalliances2 and see if the relationship looks more linear or U-shaped, inverted or not.)

        But here's the way I like to do it. You may recall from high school algebra that the graph of a quadratic function y = ax2 + bx + c has its vertex (turning-point) at x = -b/2a. Now, realistically, there are very few things in the world that are truly quadratic relationships, and what we are generally thinking about when we approximate that by using a quadratic model is this: is the relationship going up more or less straight line, or does it curve, and ultimately turn around in the other direction. So let's see where the vertex of your output's parabola is:
        Code:
        . display -0.1376231/(2*-0.0030864)
        22.295085
        So you get a turning point at around dalliances = 22.3. Since the horizontal axis of the plot shown in #1 runs from 0 to just past 3,000, and the variable on that axis is dalliances2, I'm guessing that the range of the variable dalliance's itself is something like zero to sqrt(3000), the latter being approximately 55. That suggests that the turning point of this relationship is almost dead center in the range of values of dalliances. That is the data screaming at you that there is a quadratic relationship here. Unless dalliances has an unusual distribution, in which only very low and very high values actually occur and there is a gap in the middle, the regression output is telling you that the relationship is very much inverted U-shaped: you have low values of q_tot at the lowest values of dalliances, and they increase (because a < 0) towards the middle of the data, and then decline to lower values again at the high end of the data. Now, it might be a relatively flat U, since the quadratic coefficient is fairly small, but it's there.

        Comment


        • #5
          Thank you for your very detailed answer, Clyde!

          I appreciate it as it really helps me with buidling my regression

          Kind regards,
          Hanna

          Comment


          • #6
            Hello again,

            I hope to get some help with Stata again.

            I would now like to graph the inverted U-shape relationship between q_tot (dependent variable) and rdalliances (independent variable).

            My regression still looks like this:

            Code:
             xtreg q_tot rdalliances rdalliances_2 rdi_w adi_w ln_emp1_w lev_w
            with 4 control variables (rdi_w, adi_w, ln_emp1_w and lev_w


            My questions:

            1) Is there a special command to use for a graphic solution in the presence of an inverted U-shape relationship?

            2) And what to I have to do, if I want to include a moderator in the graph to show, if the moderator compresses or stretches the main relationship?

            Thanks in advance.

            Kind regards,
            Hanna
            Last edited by Hanna Marie; 06 Jan 2022, 06:34.

            Comment


            • #7
              You will want to use -margins- and -marginsplot- to do this as simply as possible. That will require that you fix up your regression command to be compatible with it. I will show you the code here, but do read -help fvvarlist- to understand what I'm doing and to learn about factor-variable notation. The key point is that Stata has no way to know that rdalliances_2 is the square of rdalliances. To Stata, it's just a different variable. Factor-variable notation is the way you communicate these things, and also the way you work with moderating variables.

              Code:
              xtreg q_tot c.rdalliances##c.rdalliances  rdi_w adi_w ln_emp1_w lev_w
              Note: if any of those covariates is a discrete variable, it should get an i.prefix in the xtreg command.

              Next, identify values of rdalliances, about a dozen or so of them, that span the range of meaning values of that variable and are more or less equally spaced. Then:
              [code]
              margins, at(rdalliances = (list_of_identified_values))
              marginsplot[code]

              To introduce a moderator variable, which for purposes of illustration I'll call moderator it goes like this:

              Code:
              xtreg q_tot i.moderator##c.rdalliances##c.rdalliances  rdi_w adi_w ln_emp1_w lev_w
              margins moderator, at(rdalliances = (list_of_identified_values))
              marginsplot, xdimension(rdalliances)
              Here I'm assuming that the moderator variable is discrete. You can do something similar with a continuous moderator, replacing i. with c., and changing the -margins- command by removing the mention of moderator immediately after margins and adding another at specification for values of the moderator. But in general, continuous moderators are messy, and even more so with quadratic relationships, so I wouldn't really go there if there isn't a very good reason to.

              Added: If you don't like the appearance of the graphs as they come out of -marginsplot-, note that you can modify that using any of the options that work with -graph twoway-.

              Comment

              Working...
              X