Announcement

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

  • ppmlhdfe independet variable with interaction term error 3498

    I'm trying to run the PPML regression with command ppmlhdfe.

    If I don't include interaction terms in my independent variables, it works. But there is a warning:
    dependent variable takes very low values after standardizing (4.7715e-11)

    Code:
    ppmlhdfe flow ldist contig comlang_off own, noconstant absorb(imp#sector exp#sector)
    outreg2 using Result.xls, keep(ldist contig comlang_off own) dec(3)
    If I include the interaction terms, as follow, I got error messages.

    Code:
    ppmlhdfe flow ldist contig comlang_off own c.ldist#c.upstreamness c.contig#c.upstreamness
    c.comlang_off#c.upstreamness c.own#c.upstreamness, no constant a(imp#sector exp#sector)
    
    outreg2 using Result.xls, keep(ldist contig comlang_off own c.ldist#c.upstreamness
    c.contig#c.upstreamness c.comlang_off#c.upstreamness c.own#c.upstreamness) dec(3)
    (dropped 16389 observations that are either singletons or separated by a fixed effe
    > ct)
    _assert_abort(): 3498 Invalid options: no
    assert_msg(): - function returned error
    GLM::init_fixed_effects(): - function returned error
    <istmt>: - function returned error
    r(3498);

    (Note: upstreamness is not a dummy variables)
    What causes the warning and error messages, your suggestion will be highly appreciated! Thanks in advance.

  • #2
    Hi Micky,
    Do you mind sharing the complete output you get from ppmlhdfe? Curious if it starts the estimation or if this is an issue with one of the pre-processing steps.

    You can ignore the "dependent variable takes very low values after standardizing" message.

    Another suggestion is to try recentering the variables you are interacting (ie de-meaning them).

    Regards,
    Tom

    Comment


    • #3
      Hi Tom,
      Thank you, and sorry for the late response.
      Unfortunately, there was no output, all I only got was this error...
      I tried not de-meaning the variables and got exactly the same error message.
      Code:
      *collapse (mean) ...
      (Is it what you mean by de-mean?)

      Comment


      • #4
        Actually, there is an output for PPML regression without interaction:
        Code:
        . *Sixth Column (poisson gravity)
        . ppmlhdfe flow ldist, noconstant absorb(imp#sector exp#sector) 
        (dropped 1821 observations that are either singletons or separated by a fixed effect)
        warning: dependent variable takes very low values after standardizing (5.5551e-11)
        Iteration 1:   deviance = 4.2226e+08  eps = .         iters = 15   tol = 1.0e-04  min(eta) =  -7.8
        > 6  P   
        Iteration 2:   deviance = 2.0282e+08  eps = 1.08e+00  iters = 15   tol = 1.0e-04  min(eta) = -10.4
        > 7      
        Iteration 3:   deviance = 1.2856e+08  eps = 5.78e-01  iters = 13   tol = 1.0e-04  min(eta) = -15.5
        > 1      
        Iteration 4:   deviance = 1.0590e+08  eps = 2.14e-01  iters = 16   tol = 1.0e-04  min(eta) = -20.4
        > 1      
        Iteration 5:   deviance = 1.0095e+08  eps = 4.90e-02  iters = 18   tol = 1.0e-04  min(eta) = -23.1
        > 9      
        Iteration 6:   deviance = 1.0002e+08  eps = 9.37e-03  iters = 17   tol = 1.0e-04  min(eta) = -24.2
        > 6      
        Iteration 7:   deviance = 9.9796e+07  eps = 2.20e-03  iters = 13   tol = 1.0e-04  min(eta) = -24.7
        > 3      
        Iteration 8:   deviance = 9.9746e+07  eps = 5.06e-04  iters = 9    tol = 1.0e-04  min(eta) = -25.6
        > 3      
        Iteration 9:   deviance = 9.9735e+07  eps = 1.07e-04  iters = 6    tol = 1.0e-04  min(eta) = -26.4
        > 0      
        Iteration 10:  deviance = 9.9733e+07  eps = 2.10e-05  iters = 5    tol = 1.0e-04  min(eta) = -26.9
        > 0      
        Iteration 11:  deviance = 9.9733e+07  eps = 3.69e-06  iters = 12   tol = 1.0e-05  min(eta) = -27.7
        > 2   S  
        Iteration 12:  deviance = 9.9732e+07  eps = 6.24e-07  iters = 24   tol = 1.0e-06  min(eta) = -28.6
        > 0   S  
        Iteration 13:  deviance = 9.9732e+07  eps = 1.09e-07  iters = 25   tol = 1.0e-07  min(eta) = -29.3
        > 2   S  
        Iteration 14:  deviance = 9.9732e+07  eps = 1.83e-08  iters = 19   tol = 1.0e-07  min(eta) = -29.7
        > 4   S  
        Iteration 15:  deviance = 9.9732e+07  eps = 1.88e-09  iters = 17   tol = 1.0e-08  min(eta) = -29.8
        > 6   S  
        Iteration 16:  deviance = 9.9732e+07  eps = 5.58e-11  iters = 21   tol = 1.0e-09  min(eta) = -29.8
        > 6   S O
        --------------------------------------------------------------------------------------------------
        > ----------
        (legend: p: exact partial-out   s: exact solver   h: step-halving   o: epsilon below tolerance)
        Converged in 16 iterations and 245 HDFE sub-iterations (tol = 1.0e-08)
        
        HDFE PPML regression                              No. of obs      =    188,304
        Absorbing 2 HDFE groups                           Residual df     =    182,527
                                                          Wald chi2(1)    =    5460.81
        Deviance             =  99732480.86               Prob > chi2     =     0.0000
        Log pseudolikelihood = -50133985.55               Pseudo R2       =     0.9247
        ------------------------------------------------------------------------------
                     |               Robust
                flow |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
               ldist |  -2.250707   .0304572   -73.90   0.000    -2.310402   -2.191012
               _cons |   25.73971   .1947899   132.14   0.000     25.35793     26.1215
        ------------------------------------------------------------------------------
        
        Absorbed degrees of freedom:
        ------------------------------------------------------+
          Absorbed FE | Categories  - Redundant  = Num. Coefs |
        --------------+---------------------------------------|
           imp#sector |      2904           0        2904     |
           exp#sector |      2917          45        2872     |
        ------------------------------------------------------+
        
        . outreg2 using ElasticityEvidence_allyears.xls, keep(ldist) dec(3)
        ElasticityEvidence_allyears.xls
        dir : seeout
        
        . 
        . *Seventh Column (poisson gravity with more controls)
        . ppmlhdfe flow ldist contig comlang_off own, noconstant absorb(imp#sector exp#sector) 
        (dropped 1821 observations that are either singletons or separated by a fixed effect)
        warning: dependent variable takes very low values after standardizing (5.5551e-11)
        Iteration 1:   deviance = 1.2836e+08  eps = .         iters = 15   tol = 1.0e-04  min(eta) =  -6.5
        > 5  P   
        Iteration 2:   deviance = 5.5941e+07  eps = 1.29e+00  iters = 10   tol = 1.0e-04  min(eta) =  -8.8
        > 2      
        Iteration 3:   deviance = 3.6093e+07  eps = 5.50e-01  iters = 9    tol = 1.0e-04  min(eta) = -11.2
        > 8      
        Iteration 4:   deviance = 3.1064e+07  eps = 1.62e-01  iters = 10   tol = 1.0e-04  min(eta) = -13.2
        > 6      
        Iteration 5:   deviance = 2.9981e+07  eps = 3.61e-02  iters = 11   tol = 1.0e-04  min(eta) = -14.6
        > 4      
        Iteration 6:   deviance = 2.9744e+07  eps = 7.98e-03  iters = 10   tol = 1.0e-04  min(eta) = -15.8
        > 6      
        Iteration 7:   deviance = 2.9694e+07  eps = 1.68e-03  iters = 6    tol = 1.0e-04  min(eta) = -16.9
        > 6      
        Iteration 8:   deviance = 2.9684e+07  eps = 3.25e-04  iters = 4    tol = 1.0e-04  min(eta) = -17.7
        > 5      
        Iteration 9:   deviance = 2.9682e+07  eps = 6.03e-05  iters = 3    tol = 1.0e-04  min(eta) = -18.7
        > 2      
        Iteration 10:  deviance = 2.9682e+07  eps = 1.13e-05  iters = 6    tol = 1.0e-05  min(eta) = -19.5
        > 9      
        Iteration 11:  deviance = 2.9682e+07  eps = 2.07e-06  iters = 5    tol = 1.0e-05  min(eta) = -20.2
        > 1   S  
        Iteration 12:  deviance = 2.9682e+07  eps = 3.87e-07  iters = 7    tol = 1.0e-06  min(eta) = -20.5
        > 1   S  
        Iteration 13:  deviance = 2.9682e+07  eps = 7.28e-08  iters = 9    tol = 1.0e-07  min(eta) = -21.4
        > 8   S  
        Iteration 14:  deviance = 2.9682e+07  eps = 9.97e-09  iters = 9    tol = 1.0e-08  min(eta) = -22.0
        > 2   S  
        Iteration 15:  deviance = 2.9682e+07  eps = 6.56e-10  iters = 9    tol = 1.0e-09  min(eta) = -22.1
        > 2   S O
        --------------------------------------------------------------------------------------------------
        > ----------
        (legend: p: exact partial-out   s: exact solver   h: step-halving   o: epsilon below tolerance)
        Converged in 15 iterations and 123 HDFE sub-iterations (tol = 1.0e-08)
        
        HDFE PPML regression                              No. of obs      =    188,304
        Absorbing 2 HDFE groups                           Residual df     =    182,524
                                                          Wald chi2(4)    =  110222.41
        Deviance             =  29681833.59               Prob > chi2     =     0.0000
        Log pseudolikelihood = -15108661.92               Pseudo R2       =     0.9773
        ------------------------------------------------------------------------------
                     |               Robust
                flow |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
               ldist |  -.6028196   .0243682   -24.74   0.000    -.6505803   -.5550589
              contig |   .4499241   .0622624     7.23   0.000     .3278921    .5719561
         comlang_off |   .4373884   .0510127     8.57   0.000     .3374054    .5373714
                 own |   3.337482   .0652528    51.15   0.000     3.209589    3.465375
               _cons |   11.70065   .2180741    53.65   0.000     11.27323    12.12807
        ------------------------------------------------------------------------------
        
        Absorbed degrees of freedom:
        ------------------------------------------------------+
          Absorbed FE | Categories  - Redundant  = Num. Coefs |
        --------------+---------------------------------------|
           imp#sector |      2904           0        2904     |
           exp#sector |      2917          45        2872     |
        ------------------------------------------------------+
        
        . *Eight Column (poisson gravity trade cost interact with upstreamness)
        . ppmlhdfe flow ldist contig comlang_off own c.ldist#c.upstreamness c.contig#c.upstreamness c.coml
        > ang_off#c.upstreamness c.own#c.upstreamness, no constant a(imp#sector exp#sector)
        (dropped 1821 observations that are either singletons or separated by a fixed effect)
                 _assert_abort():  3498  Invalid options: no
                    assert_msg():     -  function returned error
        GLM::init_fixed_effects():     -  function returned error
                         <istmt>:     -  function returned error
        r(3498);
        
        end of do-file
        
        r(3498);

        Comment


        • #5
          Hi Micky,
          What I mean by demeaning the variables is to subtract their means so that they each have mean zero.

          It might be easiest for me to figure out what is going on if you send me your data (or a minimum working example that replicates the error). Is that OK?

          regards,
          Tom

          Comment


          • #6
            Hi Tom,

            I tried it again based on your comment and it produced a lot of missing values because I guess I had some missing values in my data.
            Also, after de-meaning the variables, many of them became negative. The error message is the same as before.
            Of course. For some reason I can't send you the data via private message, would you mind give me your email address? Thank you.

            Best regards,
            Micky

            Comment


            • #7
              A variable with mean zero will have some negative values unless all values are zero (in which case it is not interesting or useful for this purpose). I guess the implication is that you should not do this for the outcome or response variable.

              Comment


              • #8
                Nick, thank you for your advice. I reran the regression without demeaning the dependent variable and got the following error messages:

                _assert_abort(): 3498 Invalid options: no demean_
                assert_msg(): - function returned error
                GLM::init_fixed_effects(): - function returned error
                <istmt>: - function returned error
                r(3498);

                Comment


                • #9
                  Originally posted by Micky Lu View Post
                  Hi Tom,

                  I tried it again based on your comment and it produced a lot of missing values because I guess I had some missing values in my data.
                  Also, after de-meaning the variables, many of them became negative. The error message is the same as before.
                  Of course. For some reason I can't send you the data via private message, would you mind give me your email address? Thank you.

                  Best regards,
                  Micky
                  Hi Micky,
                  Thanks for sending me your code and data. I think I found your issue.

                  In the options you have specified for some of the ppmlhdfe calls, you have a space between "no" and "constant" where it looks like you should just have "noconstant". If you fix that, you will get what looks like the correct output.

                  Hope it helps!

                  Regards,
                  Tom

                  Comment


                  • #10
                    Originally posted by Tom Zylkin View Post

                    Hi Micky,
                    Thanks for sending me your code and data. I think I found your issue.

                    In the options you have specified for some of the ppmlhdfe calls, you have a space between "no" and "constant" where it looks like you should just have "noconstant". If you fix that, you will get what looks like the correct output.

                    Hope it helps!

                    Regards,
                    Tom
                    Dear Professor Zylkin,

                    Thank you very much for your help! It works now.

                    Best regards,
                    Micky

                    Comment

                    Working...
                    X