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

        Working...
        X