Announcement

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

  • "Expression evaluates to missing" xtpmg regression

    Hi Statalist,

    I am running a mean group regression on the following dataset:
    Code:
    . sum
    
        Variable |        Obs        Mean    Std. dev.       Min        Max
    -------------+---------------------------------------------------------
             cno |        560     16.8125    10.69376          1         32
            year |        560        1987    10.10853       1970       2004
         country |          0
          growth |        544    2.220443    2.293302  -7.586336   9.476275
           gdpph |        560    31425.64    12112.78   7706.522   96061.67
    -------------+---------------------------------------------------------
         gdpoecd |        560     26172.1    5549.888   17465.46   36227.84
           tau_k |        293    25.06294    5.492642   14.29711   42.66098
           tau_h |        293    28.20793    8.665205   9.019481   44.85106
           tau_c |        293    21.20655    9.551219   6.971512   56.56422
         topstat |         80    47.94318    6.313459      38.95         60
    -------------+---------------------------------------------------------
     topstatoecd |         80    43.05456    .9212149   41.69681   44.30247
         corptax |         64    30.71305    3.691514      22.12     36.433
     corptaxoecd |         64    28.09793    .9177721   26.96863   29.47705
         newrdis |        560    23.79259    5.910921      4.581     36.781
     newrdisoecd |        560    20.84737    1.320989     17.224     22.209
    -------------+---------------------------------------------------------
       neworndis |        560    10.11505    3.135774      2.907     16.892
    neworndiso~d |        560    10.02971     .704356      8.613     11.002
         product |        151    23.30063    2.846734    16.3717   30.25604
      nonproduct |        151    21.51662    6.781814   10.39179   35.22918
    totalexpen~e |        265    43.89122    7.985306   24.27693   64.16204
    -------------+---------------------------------------------------------
    totalrevenue |        265    42.32334    8.706575   22.74396   57.87862
         deficit |        265   -1.567896    3.954452  -9.432231   15.06486
         gfcfgdp |        558    20.14013    3.698307   11.11179   32.50194
    employment~h |        516    1.012836    1.765756  -7.140246   7.926316
    employment~d |        144    1.018232    .4171962    .320178   1.615237
    -------------+---------------------------------------------------------
      employment |        509    17126.18    27745.68   114.3571   139251.9
          hucap3 |        523    10.46791    2.108801   3.175704   13.42321
         lngdpph |        560    10.28598    .3815435   8.949822   11.47275
    yearsedugr~h |        508    .0750649    .0433725   -.008481      .3988
         surplus |        265    1.567896    3.954452  -15.06486   9.432232
    -------------+---------------------------------------------------------
        _est_PMG |        560    .8089286    .3934967          0          1
        _est_pmg |        560    .8089286    .3934967          0          1
         _est_MG |        560    .8089286    .3934967          0          1
         _est_mg |        560    .8089286    .3934967          0          1
    The code I want to run looks like:
    Code:
    . xtpmg2 d.growth d.l(growth) d.l(0/1)(tau_k tau_h tau_c product surplus gfcfgdp employmentgrowth yearsedugrowth), ///
    >         lr(l.growth tau_k tau_h tau_c product surplus gfcfgdp employmentgrowth yearsedugrowth l.lngdpph) ///
    >         ec(ec_mg) replace mg
    but this gives me the following error:
    Code:
    expression (-_b[tau_k]/_b[L.growth]) evaluates to missing
    I know this problem was potentially solved previously here but the OP deleted any comments on the thread.
    Here, the command xtpmg2 comes from a fix from Jan Ditzen as an answer to this post.

    Anyone know what's causing this problem and how I can resolve it?

    Thanks,
    Bailey

  • #2
    There is no evidence that the linked thread alluded to xtpmg or xtpmg2. But more can be said in this case, as the problem will arise if

    1. either coefficient estimate is missing

    2. the denominator coefficient estimate is zero.

    Does xtpmg2 show any results before it crashes? If not, you need to clone the code to print out the coefficient estimates before that expression to see what is happening. Perhaps the model is too complicated and/or predictors are being omitted for collinearity. However, that guess is wild while guesses 1 and 2 above are I hope closer to a diagnosis.

    Comment


    • #3
      Hi Nick,

      Thanks for replying. I am looking in the ado file and trying to add the line "di [var]" in various places, but the output in Stata is not changing. It remains:
      Code:
      . xtpmg2 d.growth d.l(growth) d.l(0/1)(tau_k tau_h tau_c product surplus gfcfgdp employmentgrowth yearsedugrowth) if cno <= 2 & !missing(tau_k), ///
      >         lr(l.growth tau_k tau_h tau_c product surplus gfcfgdp employmentgrowth yearsedugrowth l.lngdpph) ///
      >         ec(ec_mg) replace mg
      expression (-_b[tau_k]/_b[L.growth]) evaluates to missing
      r(498);
      How would I change the code to print out the estimates as they are estimated?

      Comment


      • #4
        Using this post I have managed to get Stata to print what I believe to be a matrix of the estimates. Output looks thus:
        Code:
        . xtpmg2 d.growth d.l(growth) d.l(0/1)(tau_k tau_h tau_c surplus gfcfgdp employmentgrowth yearsedugrowth), ///
        >         lr(l.growth tau_k tau_h tau_c surplus gfcfgdp employmentgrowth yearsedugrowth l.lngdpph) ///
        >         ec(ec_mg) replace difficult mg
        
        e(b)[1,25]
                 _nl_1       _nl_2       _nl_3       _nl_4       _nl_5       _nl_6       _nl_7       _nl_8       _nl_9      _nl_10      _nl_11      _nl_12      _nl_13
        y1  -.04479398   .36113135  -.00384465  -.12549325    .0119727  -.21076654   .91266318  -.48810541  -1.4824152   .04747708  -.21349721   .45641884   .14553964
        
                _nl_14      _nl_15      _nl_16      _nl_17      _nl_18      _nl_19      _nl_20      _nl_21      _nl_22      _nl_23      _nl_24      _nl_25
        y1  -.72213597   .52601572   .43662465  -.33400003    .0990007   .49295917   .39679806   .33309352   .34133275  -.95590712   .73879706   5.2417275
        
        e(b)[1,25]
                 _nl_1       _nl_2       _nl_3       _nl_4       _nl_5       _nl_6       _nl_7       _nl_8       _nl_9      _nl_10      _nl_11      _nl_12      _nl_13
        y1           0           0   .71127876   1.0245877   .94274591   .34078442           0           0  -.88744825   .24769453  -.45524939   -.1301381  -.34862856
        
                _nl_14      _nl_15      _nl_16      _nl_17      _nl_18      _nl_19      _nl_20      _nl_21      _nl_22      _nl_23      _nl_24      _nl_25
        y1  -.12033898   -.7521431   .69948667  -1.0673016   .20578136  -1.0433546   .18759222  -.43676335   .36109867   1.9323674   3.0443129  -35.018718
        
        e(b)[1,25]
                 _nl_1       _nl_2       _nl_3       _nl_4       _nl_5       _nl_6       _nl_7       _nl_8       _nl_9      _nl_10      _nl_11      _nl_12      _nl_13
        y1   .52578832           0  -.09770537   .91120685  -2.5542109   1.6711025           0           0  -2.1209396  -.58888787   .15561862  -.41799027  -3.9670141
        
                _nl_14      _nl_15      _nl_16      _nl_17      _nl_18      _nl_19      _nl_20      _nl_21      _nl_22      _nl_23      _nl_24      _nl_25
        y1  -4.6461879  -.57183435   -2.888603  -.51199296  -1.5888321    3.581415   2.9902951  -.69138504  -3.1745794           0  -12.267667   88.762915
        
        e(b)[1,25]
                 _nl_1       _nl_2       _nl_3       _nl_4       _nl_5       _nl_6       _nl_7       _nl_8       _nl_9      _nl_10      _nl_11      _nl_12      _nl_13
        y1   .38456522   2.2062491   -3.113327     .000169  -.11474318   .59948888   21.800173  -31.777568  -.61893117   -.0305991  -.18659397   .36855975  -2.0147161
        
                _nl_14      _nl_15      _nl_16      _nl_17      _nl_18      _nl_19      _nl_20      _nl_21      _nl_22      _nl_23      _nl_24      _nl_25
        y1  -.99119631   1.3655481   .47457961  -.73262353   .04717598  -.10612511   .16323973   .29015121  -.02210724  -8.5603969  -2.4996054   209.36965
        
        e(b)[1,25]
                 _nl_1       _nl_2       _nl_3       _nl_4       _nl_5       _nl_6       _nl_7       _nl_8       _nl_9      _nl_10      _nl_11      _nl_12      _nl_13
        y1   3.5766139  -7.9811808  -.85593715  -2.4303989    2.286888           0           0           0  -1.3307164   .09464539  -.93904953  -1.5062841   4.6869824
        
                _nl_14      _nl_15      _nl_16      _nl_17      _nl_18      _nl_19      _nl_20      _nl_21      _nl_22      _nl_23      _nl_24      _nl_25
        y1    2.019163  -.04152635   3.5124446   1.1193798   1.3737042   .83785237  -1.7462238  -.23232868   .89591204  -14.079074           0   239.26301
        
        e(b)[1,25]
                 _nl_1       _nl_2       _nl_3       _nl_4       _nl_5       _nl_6       _nl_7       _nl_8       _nl_9      _nl_10      _nl_11      _nl_12      _nl_13
        y1  -1.4085453   1.0834295   1.8848024   .72601814           0           0   -5.116854           0  -.60795084  -.24878929   .40240313  -.21679446   -.9640057
        
                _nl_14      _nl_15      _nl_16      _nl_17      _nl_18      _nl_19      _nl_20      _nl_21      _nl_22      _nl_23      _nl_24      _nl_25
        y1  -.20839238   .05232955   .14926966  -.71099483  -.41326904    .5464318           0   .04726195  -.90951955  -.69249749  -.68493946  -21.186583
        
        e(b)[1,25]
                 _nl_1       _nl_2       _nl_3       _nl_4       _nl_5       _nl_6       _nl_7       _nl_8       _nl_9      _nl_10      _nl_11      _nl_12      _nl_13
        y1  -.00510889   8.1496694   .40028656  -9.0490764  -.98698742           0           0           0  -.75308294   .87476807  -3.4763736  -.15592472   .53464398
        
                _nl_14      _nl_15      _nl_16      _nl_17      _nl_18      _nl_19      _nl_20      _nl_21      _nl_22      _nl_23      _nl_24      _nl_25
        y1  -2.0449688   3.3164688   2.3317894   4.3134158   2.2865156   1.1383485   2.7450936   .26488859   -1.702324  -6.3475424           0  -164.19372
        
        e(b)[1,25]
                 _nl_1       _nl_2       _nl_3       _nl_4       _nl_5       _nl_6       _nl_7       _nl_8       _nl_9      _nl_10      _nl_11      _nl_12      _nl_13
        y1  -.17524601   .11587818    .1257338  -.18759061   .02371361   .27629219   .79347964  -4.4700987  -1.1970105    .1338607   .00861784   -.2774328  -.80547897
        
                _nl_14      _nl_15      _nl_16      _nl_17      _nl_18      _nl_19      _nl_20      _nl_21      _nl_22      _nl_23      _nl_24      _nl_25
        y1  -.42388577  -.28849892  -.20351999  -.76551052   -.3453137   .15538458  -.56446204   .26563051  -.33822827  -.43357018   -.5134864   54.146844
        
        e(b)[1,25]
                 _nl_1       _nl_2       _nl_3       _nl_4       _nl_5       _nl_6       _nl_7       _nl_8       _nl_9      _nl_10      _nl_11      _nl_12      _nl_13
        y1  -.16227692   .28618757   .45271916  -.11083766   .70726541   .67065594  -2.6127047  -6.9219076  -1.3156639   .17863594  -.02807677  -.10470951   .17337274
        
                _nl_14      _nl_15      _nl_16      _nl_17      _nl_18      _nl_19      _nl_20      _nl_21      _nl_22      _nl_23      _nl_24      _nl_25
        y1  -.16620189   .00298579  -.88096672  -.78927526  -.44906518  -.17972555   -.4725419   .04916712  -.65322836   4.1077299   .61504815   52.813533
        
        e(b)[1,25]
                 _nl_1       _nl_2       _nl_3       _nl_4       _nl_5       _nl_6       _nl_7       _nl_8       _nl_9      _nl_10      _nl_11      _nl_12      _nl_13
        y1  -.33215245  -.08870757  -.93982263   -.3317391           0   1.4617227  -.26552166           0  -4.4135167   1.6326134   2.2910645  -.55922687           0
        
                _nl_14      _nl_15      _nl_16      _nl_17      _nl_18      _nl_19      _nl_20      _nl_21      _nl_22      _nl_23      _nl_24      _nl_25
        y1  -.17027813   1.7880463    2.262968  -.19400332  -.34605746  -3.2050588  -.68974072  -5.5135541  -1.8045446           0   10.017889   110.84673
        
        e(b)[1,25]
                 _nl_1       _nl_2       _nl_3       _nl_4       _nl_5       _nl_6       _nl_7       _nl_8       _nl_9      _nl_10      _nl_11      _nl_12      _nl_13
        y1   1.8889195           0   -2.860866  -.97485963  -1.2166597   .84246155           0           0  -.85780399  -.50201785  -1.8256804  -1.2901508  -.46075862
        
                _nl_14      _nl_15      _nl_16      _nl_17      _nl_18      _nl_19      _nl_20      _nl_21      _nl_22      _nl_23      _nl_24      _nl_25
        y1  -.64391063   1.9043203           0   .86368458   .27892105   1.6186527   .93026201  -.24657257  -.55329517           0   .58564954   42.618287
        
        e(b)[1,25]
                 _nl_1       _nl_2       _nl_3       _nl_4       _nl_5       _nl_6       _nl_7       _nl_8       _nl_9      _nl_10      _nl_11      _nl_12      _nl_13
        y1   .49274508  -.70225519  -.09939392   .86608803   .41975636   2.9813024           0           0  -1.6772895  -.08054867  -2.9765405  -2.6295305   1.5049477
        
                _nl_14      _nl_15      _nl_16      _nl_17      _nl_18      _nl_19      _nl_20      _nl_21      _nl_22      _nl_23      _nl_24      _nl_25
        y1   1.8482288  -.28703944  -.43627254  -1.1973033   -1.137366   .25004977  -.46358977  -3.1707691   -1.482902           0           0   6.2129534
        
        e(b)[1,25]
                 _nl_1       _nl_2       _nl_3       _nl_4       _nl_5       _nl_6       _nl_7       _nl_8       _nl_9      _nl_10      _nl_11      _nl_12      _nl_13
        y1  -3.3443243  -6.1313199   2.6028284   2.3823559  -2.0818499   3.9451348           0           0  -.64102009  -.43434253   -.3524619    5.105905  -2.5094836
        
                _nl_14      _nl_15      _nl_16      _nl_17      _nl_18      _nl_19      _nl_20      _nl_21      _nl_22      _nl_23      _nl_24      _nl_25
        y1  -2.1978067   2.3282483     -.23838  -.81847789  -.10087777    1.862254  -.21639733  -2.7596541  -.77131817           0           0   113.72587
        
        e(b)[1,25]
                 _nl_1       _nl_2       _nl_3       _nl_4       _nl_5       _nl_6       _nl_7       _nl_8       _nl_9      _nl_10      _nl_11      _nl_12      _nl_13
        y1  -1.8813258   1.6589741  -1.6783036  -4.8442956   .35787154           0           0           0  -1.7855042   .24871174   1.8583115   2.7976384  -2.6751745
        
                _nl_14      _nl_15      _nl_16      _nl_17      _nl_18      _nl_19      _nl_20      _nl_21      _nl_22      _nl_23      _nl_24      _nl_25
        y1   2.1746052   2.8192322   2.5667339   4.4016217   5.9510258  -4.7681596   5.7607707   3.3828013   1.2196773           0   -1.831982   35.907603
        expression (-_b[tau_k]/_b[L.growth]) evaluates to missing
        r(498);
        If I am understanding what I'm seeing correctly, we should focus on the final matrix before the error, where the problem lies in (_nl_7 _nl_8 _nl_9) all being 0.

        Is this the source of the problem, and are there any suggestions for dealing with this?

        Thanks.

        Comment


        • #5
          Update: I decided to use Jan Ditzen's xtdcce2 since it is a more current module that seems to work better with more recent versions of Stata (see here for example). The problem appears to be the "product" variable, which does not have enough observations (as inferred from this post). Since this is a data issue, I have had to simply use different data (more specifically, general government expenditure rather than splitting it into productive and unproductive). This solved the problem.

          Comment

          Working...
          X