Announcement

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

  • #16
    Well, I don't know how trade openness is measured, so I don't know what appropriate values are. That said, if trade openness values less than 1 are possible, then the log transformed values will be negative.

    Comment


    • #17
      Originally posted by Clyde Schechter View Post
      Yes, that's the one.

      So, something like this. This code is not tested, so you may encounter errors in it, but this is the gist of the approach.

      Code:
      local values -1.7 (0.1) 0.1
      
      frame create margin_calculations float(lnto expected_value)
      
      clonevar lnto_original = lnto
      clonevar lnto2_original = lnto2
      
      foreach v of numlist `values' {
      replace lnto = `v'
      replace lnto2 = `v'*`v'
      predict pchat
      summ pchat, meanonly
      frame post margin_calculations (`v') (r(mean))
      drop pchat
      }
      replace lnto = lnto_original
      repace lnto2 = lnto2_original
      
      frame change margin_calculations
      sort lnto
      graph twoway connect expected_value lnto
      You can modify the numbers in local values to reflect what you think are the realistic and interesting range of values of lnto. I rounded off the range you mentioned in #9 to get these, but you might prefer some other set. You can modify the graph itself to suit your preferences using all of the options available with -graph twoway-.
      Sir Clyde, is there a way where I can add for the turning point in the graph? Like a straight line that would denote that this point is the turning point.

      Thanks a lot,
      Justine

      Comment


      • #18
        Code:
        local tp = -_b[lnto]/(2*_b[lnto2])
        carried out after the regression will give you the turning point in local macro tp. Then adding the -xline(`tp')- option to your -graph- command will do what you ask.

        Comment


        • #19
          Hello again sir clyde! I am using the devised codes you kindly provided for me to plot a U-shaped curve. However, when I revised my data on trade openness, it does not work and shows empty graph with x and y axis. Do you have any idea why the code failed this time? Thank you.

          These are my new results using a new dataset of trade openness. My minimum and maximum: 2.90 and 4.70 respectively.

          Code:
          ardl lnco2cb_pc lnOPEN lnOPEN2 lnrgdp_pc lnfec, lags(1 2 2 1 0) ec
          
          ARDL(1,2,2,1,0) regression
          
          Sample:     1992 -     2019                     Number of obs     =         28
                                                          R-squared         =     0.8648
                                                          Adj R-squared     =     0.7853
          Log likelihood =  63.988172                     Root MSE          =     0.0316
          
          ------------------------------------------------------------------------------
          D.lnco2cb_pc |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
          -------------+----------------------------------------------------------------
          ADJ          |
            lnco2cb_pc |
                   L1. |  -1.032174   .1714716    -6.02   0.000    -1.393948   -.6704005
          -------------+----------------------------------------------------------------
          LR           |
                lnOPEN |  -.7933689   .3086353    -2.57   0.020    -1.444533   -.1422053
               lnOPEN2 |   .0725629   .0374378     1.94   0.069    -.0064239    .1515497
             lnrgdp_pc |   .3498539   .0482719     7.25   0.000      .248009    .4516987
                 lnfec |   .5828341   .1442355     4.04   0.001     .2785238    .8871444
          -------------+----------------------------------------------------------------
          SR           |
                lnOPEN |
                   D1. |  -3.050594   .9957688    -3.06   0.007    -5.151483   -.9497057
                   LD. |  -2.735313   1.064005    -2.57   0.020    -4.980167   -.4904593
                       |
               lnOPEN2 |
                   D1. |   .3607249   .1147128     3.14   0.006      .118702    .6027477
                   LD. |   .3251159   .1246687     2.61   0.018     .0620879    .5881439
                       |
             lnrgdp_pc |
                   D1. |   .5827867   .3643549     1.60   0.128    -.1859349    1.351508
                       |
                 _cons |  -.8996144     1.1274    -0.80   0.436    -3.278221    1.478992
          ------------------------------------------------------------------------------

          Comment


          • #20
            Well, I don't know if this is it or not, but the turning point for your quadratic relationship this time is about 5.5. If you are still using a range of values from -1.7 to 0.01, the results would really be outside the range of interest. But that doesn't suggest to me why you would just get an empty, as opposed to a non-quadratic-looking, graph. I can't even offer to troubleshoot with example data because I don't have or use the -ardl- command.

            I would also point out that fitting a model with 10 parameters to 28 data points is not going to give you meaningful results. But, again, that doesn't explain why you are getting an empty graph.

            Possible places to pursue the problem: Are you getting any error messages? What does Stata show you if you -list- the contents of frame margin_calculations?

            Comment

            Working...
            X