Announcement

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

  • Unexpected error from XTPMG output

    Hi dear all. I am having an unexpected error message from xtpmg output.

    I am using Stata 16 for Mac

    I have time series panel data. When I run PMG and DFE, there is no problem. But when I try MG, I have the following

    ​​​​​​xtpmg dlnmtob dexri, ///
    lr(l.lnmtob exri) ///
    ec(ECT) replace mg
    invalid new variable name;
    variable name ECT is in the list of predictors
    r(110);

    Please, can anyone help me understand why?

    Thanks

  • #2
    I am having the exact same error. The error even occurs with the sample data and sample code. The error does not occur using the pooled mean group estimator (pmg) but does occur with the mean group estimator (mg).

    use jasa2
    tsset id year

    xtpmg d.c d(1/2).y d.pi if year>1962, ec(ec) lr(l.c y pi) mg replace

    I get the error:
    invalid new variable name;
    variable name ec is in the list of predictors
    r(110);

    I am running Stata 15 SE.

    Comment


    • #3
      I think something might have changed in the internal stata "predict" command that causes this.

      After that error message, there are stored results

      Code:
      . xtpmg dlogwage dlogprod dlogppi ldlogprod ldlogppi, lr(llogwage llogprod llogppi llogur) mg const(1 2) replace
      ...
      invalid new variable name;
      variable name __ec is in the list of predictors
      
      . ereturn display
      ------------------------------------------------------------------------------
      | Coef. Std. Err. z P>|z| [95% Conf. Interval]
      -------------+----------------------------------------------------------------
      __ec |
      llogprodc | 1 1.45e-16 6.9e+15 0.000 1 1
      llogppi | 1 2.06e-15 4.9e+14 0.000 1 1
      llogurc | -.0784173 .0273155 -2.87 0.004 -.1319547 -.0248798
      -------------+----------------------------------------------------------------
      SR |
      __ec | -.6478756 .1106849 -5.85 0.000 -.864814 -.4309373
      dlogprodc | .5455238 .1107506 4.93 0.000 .3284566 .762591
      dlogppi | .4894336 .1009903 4.85 0.000 .2914964 .6873709
      ldlogprodc | -.0085203 .04175 -0.20 0.838 -.0903488 .0733083
      ldlogppi | .1393261 .1062404 1.31 0.190 -.0689011 .3475534
      _cons | -.9154345 .4601066 -1.99 0.047 -1.817227 -.0136421
      ------------------------------------------------------------------------------
      and the next step internally in xtpmg is to try and run

      Code:
      . predict double __ec , eq(__ec)
      invalid new variable name;
      variable name __ec is in the list of predictors
      The reason it fails seems to be that predict does not like you to store the results of predict using the same name as the equation you are referring to. you can see anything else for a variable name works fine:

      Code:
      . predict double anythingelse , eq(__ec)
      (18 missing values generated)
      To me it seems that this is a bug in predict - otherwise I would be interested to learn how this is a feature

      PS:I also needed to change some of the xtpmg.ado code to make it work with two constraints

      my file now reads

      Code:
      program define CalcConst
          args cons1 cons2 cons3 cons4 cons5 
          local constraint `cons1' `cons2' `cons3' `cons4' `cons5' 
          tempname A bc C IAR j R Vc touse
      ...
      compared to the original

      Code:
      program define CalcConst
          args constraint
          tempname A bc C IAR j R Vc touse
      ...

      Comment


      • #4
        .... and a quick solution might be to change line 390 in the original xtpmg.ado code from

        quie predict double `ec' if `touse', eq(`ec')

        to

        quie predict double `ec'tmp if `touse', eq(`ec')
        ren `ec'tmp `ec'

        at least for me this works fine.

        Comment


        • #5
          Damiaan Persyn all, I have the same problem.. I can't find the original xtpmg.ado. any idea?

          Comment


          • #6

            I have a problem with the use of the command xtpmg with the mg option.
            Infact, if I give the following command:

            xtpmg d.lpcco2e d.lgdp d.lpcecgj d.lopeness if EMU==0, lr(l.lpcco2e lgdp lpcecgj lopeness) ec(ECT) replace mg

            it does not work, giving me the following error:

            invalid new variable name;
            variable name ec is in the list of predictors r(110);

            Could anyone can help me?
            Many thanks,
            CM

            Comment


            • #7
              I check with all my STATA versions: the problem arose from STATA 15. In fact, in STATA 14, STATA 13, STATA 12, and STATA 11 the command works; while in STATA 15 and STATA 16 it gives that error.

              Comment


              • #8
                I never saw this thread, but there was a similar question posted here.
                Jan

                Comment


                • #9
                  Hello all,

                  I had the same problem when I tried to replicate the results of an old paper of mine: https://github.com/JamelSaadaoui/Res...aadaoui%202015

                  The patch of JanDitzen works well, however, the problem stays the same with the 'mg' option.

                  That would be nice to fix this to keep some sort of replicability for old papers.

                  Best,
                  Jamel

                  Comment


                  • #10
                    Jamel Saadaoui the fix works on my end with the mg option.

                    I think there is no solution for this as long as the authors do not publish an "official" fix.

                    Comment


                    • #11
                      Thanks JanDitzen
                      I double-checked, but I guess we need to wait an "official" fix.
                      For future papers, I will surely use your very interesting works and packages for non-stationary panel and common factors.
                      Best,
                      Jamel

                      Comment


                      • #12
                        Originally posted by Damiaan Persyn View Post
                        .... and a quick solution might be to change line 390 in the original xtpmg.ado code from

                        quie predict double `ec' if `touse', eq(`ec')

                        to

                        quie predict double `ec'tmp if `touse', eq(`ec')
                        ren `ec'tmp `ec'

                        at least for me this works fine.
                        it really works for me!!!!!THX!!!!

                        Comment


                        • #13
                          Originally posted by Damiaan Persyn View Post
                          .... and a quick solution might be to change line 390 in the original xtpmg.ado code from

                          quie predict double `ec' if `touse', eq(`ec')

                          to

                          quie predict double `ec'tmp if `touse', eq(`ec')
                          ren `ec'tmp `ec'

                          at least for me this works fine.
                          Yes, absolutely, it also worked for me, now.

                          Sorry for the confusion.

                          Use this to clean installation before putting the patch: ssc install xtpmg, all replace

                          Kind regards,
                          Jamel

                          Comment


                          • #14
                            I am also getting the same error whenever i run mg. i am using stata version 18. in simplest terms , what should i do? Any help?
                            Regards,
                            Khethang

                            Comment


                            • #15
                              You have to locate your personal folder with the command

                              sysdir

                              For this package xtpmg, mine is here: C:\Users\jamel\ado\plus\x

                              Then, you have to apply following the patch by opening the xtpmg.ado from a Do-file editor in Stata (Thanks to Francisco Serranito for this point):

                              Originally posted by Damiaan Persyn View Post
                              .... and a quick solution might be to change line 390 in the original xtpmg.ado code from




                              quie predict double `ec' if `touse', eq(`ec')

                              to

                              quie predict double `ec'tmp if `touse', eq(`ec')
                              ren `ec'tmp `ec'





                              Save the file. It should work!

                              Kind regards,

                              Jamel

                              Comment

                              Working...
                              X