Announcement

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

  • #16
    The updates will not take place until you either restart Stata, or clear all memory. Otherwise, if you can make a reproducible example? I can check why its not working for you

    Comment


    • #17
      Dear Fernando,

      I restarted Stata, and the error persists.

      I am currently working with a subsample of my data in order to produce the code I eventually want to run on my much larger dataset. I want to run a loop with several dependent variables and two separate treatment conditions, produce event-study results, and store the results. I paste a version of the loop below:

      Code:
      local vars "var_1 var_2 var_3"
      forvalues k = 1(1)2 {
      foreach v of local vars {
      jwdid `v', ivar(ID) tvar(YEAR) gvar(treatyear_`k') cluster(cluster) never level(99)
      estat event
      estore (jw_`v'_`k') level(99)
      }
      }
      And I provide a copy of some of my data:

      Code:
      * Example generated by -dataex-. To install: ssc install dataex
      clear
      input double(var_1 var_2 var_3 ID) long YEAR float treatyear_2 byte cluster
      4000 87508.742467    19866 2370032007 2004    0 3
      4000 87361.863929    17448 2370032007 2005    0 3
      4800 89639.394623    21961 2370032007 2006    0 3
      4000 112263.38637    17773 2370032007 2007    0 3
      4000 106307.30297     5746 2370032007 2008    0 3
      4000 90779.428247     4834 2370032007 2009    0 3
      4000  100827.5789     4936 2370032007 2010    0 3
      4000 128809.85223     5042 2370032007 2011    0 3
      4000 117941.40921     6301 2370032007 2012    0 3
      4000 146357.55419     4521 2370032007 2013    0 3
      4000 144360.90143     2859 2370032007 2014    0 3
      4000 134682.75648     4776 2370032007 2015    0 3
      4000 125082.04183  4053.53 2370032007 2016    0 3
      4000 204982.05068     4427 2370032007 2017    0 3
      1700        48042    36752 2370043001 2007    0 4
      1200        34957    26538 2370043001 2008    0 4
      7200    936087.49 15018.57 2370044004 2017    0 4
      1800 41355.786797      877 2370044007 2011    0 4
      1800 113099.64508     4160 2370044007 2014    0 4
      1800 116092.65223     9088 2370044007 2015    0 4
      1800 76711.130607        0 2370044007 2017    0 4
      1800 97198.854752     2745 2370044007 2018    0 4
      3300 35425.311906    11798 2370047001 2007    0 4
      2430 38745.458739     5219 2370047001 2008    0 4
      2430 49367.363279    12325 2370047001 2009    0 4
      2430 40580.994763    10284 2370047001 2010    0 4
      2430 46729.022553    23775 2370047001 2011    0 4
      3350 120627.14621    43026 2370047004 2004 2009 4
      3400 121589.02758    48050 2370047004 2005 2009 4
      3400 146550.22526    70780 2370047004 2006 2009 4
      3400 170518.94934    91297 2370047004 2007 2009 4
      3400 137507.24861    71150 2370047004 2008 2009 4
      3400 126478.33888    75471 2370047004 2009 2009 4
      3400 162778.66367   102720 2370047004 2010 2009 4
      3400 151976.50287    97464 2370047004 2011 2009 4
      3400 156173.18019   125127 2370047004 2012 2009 4
      3400 143110.02296   107581 2370047004 2013 2009 4
      3400 151049.05715   113260 2370047004 2014 2009 4
      4300  133266.3016    96537 2370047004 2015 2009 4
      end
      For example, when I run a single iteration of the loop I get the following output (it is much longer in actuality) and a DoF table. When I type the command estat event I get the error you see at the bottom of the output.

      Code:
      jwdid var_1, ivar(ID) tvar(YEAR) gvar(treatyear_2) cluster(cluster) never level(99)
      WARNING: Singleton observations not dropped; statistical significance is biased (link)
      (MWFE estimator converged in 7 iterations)
      warning: missing F statistic; dropped variables due to collinearity or too few clusters
      
      HDFE Linear regression                            Number of obs   =     16,363
      Absorbing 2 HDFE groups                           F( 111,      9) =          .
      Statistics robust to heteroskedasticity           Prob > F        =          .
                                                        R-squared       =     0.8736
                                                        Adj R-squared   =     0.8515
                                                        Within R-sq.    =     0.0110
      Number of clusters (cluster)   =         10       Root MSE        =   694.0238
      
                                                (Std. Err. adjusted for 10 clusters in cluster)
      -------------------------------------------------------------------------------------------
                                |               Robust
                          var_1 |      Coef.   Std. Err.      t    P>|t|     [99% Conf. Interval]
      --------------------------+----------------------------------------------------------------
      treatyear_2#YEAR#c.__tr__ |
                     2006 2004  |  -143.3621   105.9916    -1.35   0.209    -487.8173     201.093
                     2006 2006  |  -347.3493   167.3154    -2.08   0.068     -891.097    196.3983
                     2006 2007  |  -534.5825   323.9352    -1.65   0.133    -1587.319    518.1537
                     2006 2008  |  -583.1733   293.0042    -1.99   0.078    -1535.389    369.0423
                     2006 2009  |  -645.8113   168.0614    -3.84   0.004    -1191.983   -99.63922
                     2006 2010  |  -1209.718   466.7972    -2.59   0.029    -2726.732    307.2965
                     2006 2011  |  -1328.857   474.1097    -2.80   0.021    -2869.635    211.9219
                     2006 2012  |  -1299.695    473.836    -2.74   0.023    -2839.584    240.1935
                     2006 2013  |  -1546.798   306.1293    -5.05   0.001    -2541.668   -551.9284
                     2006 2015  |  -2901.141   311.2972    -9.32   0.000    -3912.805   -1889.476
      
      -->
      
                     2017 2004  |   914.5714   80.99699    11.29   0.000     651.3445    1177.798
                     2017 2005  |   868.7669   76.65351    11.33   0.000     619.6556    1117.878
                     2017 2006  |   464.2509   57.21763     8.11   0.000      278.303    650.1988
                     2017 2007  |   541.0177   57.49802     9.41   0.000     354.1586    727.8768
                     2017 2008  |   279.7603   35.43216     7.90   0.000     164.6116     394.909
                     2017 2009  |   392.1223   41.13132     9.53   0.000     258.4523    525.7923
                     2017 2010  |   876.5494   35.52366    24.68   0.000     761.1033    991.9954
                     2017 2011  |   674.0768   35.15342    19.18   0.000      559.834    788.3196
                     2017 2012  |   704.9049   25.47408    27.67   0.000     622.1183    787.6914
                     2017 2013  |   754.1909   24.70185    30.53   0.000     673.9139    834.4678
                     2017 2014  |   529.5378    36.8533    14.37   0.000     409.7707     649.305
                     2017 2015  |   416.5151   22.31546    18.66   0.000     343.9935    489.0366
                     2017 2017  |   20.02007   25.15492     0.80   0.447     -61.7293    101.7694
                     2017 2018  |  -74.12614   24.28336    -3.05   0.014    -153.0431    4.790805
                                |
                          _cons |   4580.022   2.739739  1671.70   0.000     4571.119    4588.926
      -------------------------------------------------------------------------------------------
      
      Absorbed degrees of freedom:
      -----------------------------------------------------+
       Absorbed FE | Categories  - Redundant  = Num. Coefs |
      -------------+---------------------------------------|
                ID |      2305        2305           0    *|
              YEAR |        15           1          14     |
      -----------------------------------------------------+
      * = FE nested within cluster; treated as redundant for DoF computation
      
      estat event
      varlist required
      Thank you for your assistance. Kindly let me know if I should provide additional information.

      Guy
      Last edited by Guy Low; 09 Jul 2024, 09:32.

      Comment


      • #18
        Hi Guy
        The error you report was there at some point on an earlier release. But it shouldn't be there now. So please do one more thing.

        Since you already updated JWDID, I would also ask if you have a copy of the ado files in your working directory, or your personal ado folder. If you do, you need to delete them (or store them elsewhere).
        If that doesn't work, please try the following
        use the example in the helpfile, and try to run the estimation using a logfile with "set trace on". And send it to me.
        Fernando

        Comment


        • #19
          Hi Fernando,

          When I run jwdid command, I get the same error “varlist required” after either estat event or estat simple

          I have done the following steps:
          1. Updated the jwdid package and is currently uptodate.
          2. Uninstalled and reinstalled the latest package and restarted stata.
          3. Used the example in the help file and attached the logfile.
          Code:
          frause mpdta.dta, clear
          jwdid lemp, ivar(countyreal) tvar(year) gvar(first_treat)
          estat event
          varlist required
          Is there something else to do?
          Thanks in advance

          jwdid_log.smcl

          Comment


          • #20
            Please update to the latest version
            I think what you see is from an earlier code

            Comment


            • #21
              Dear Fernando,
              Thanks for quick reply

              I have installed the jwdid from ssc and I checked the version and it shows:

              Code:
              . which jwdid
              c:\ado\plus\j\jwdid.ado
              *!v2.00 Paper Out
              Then I have removed the command files and replaced them with those available on github and restarted Stata.
              https://github.com/friosavila/stpack...f3d50105/jwdid
              The github version shows:

              Code:
              . which jwdid
              c:\ado\plus\j\jwdid.ado
              *!v2.01 xattvar
              After Running the command “estat event”, I still get the same error “varlist required”

              Code:
              frause mpdta.dta, clear
              jwdid lemp, ivar(countyreal) tvar(year) gvar(first_treat)
              estat event
              varlist required
              I appreciate if you could show me how to get the latest version.

              Comment


              • #22
                Ok, it should work with the v2.0 the other one still has some kinks with the xattvar (very experimental)
                in any case.
                1) make sure you do not have any other version of jwdid in your computer. Specially not in your working directory
                2) update reghdfe. Perhaps there is where the problem exists
                3) make a logfile and send it to me

                log using xxxx, txt
                set tracedepth 3
                set trace on
                frause mpdta.dta, clear jwdid lemp, ivar(countyreal) tvar(year) gvar(first_treat) estat event set trace off
                log close

                Comment


                • #23
                  I have followed these steps:
                  • uninstalled the current jwdid version and made sure that no files exist in my working directory
                  Code:
                  . ado uninstall jwdid
                   
                  package jwdid from http://fmwww.bc.edu/repec/bocode/j
                        'JWDID': module to estimate Difference-in-Difference models using Mundlak approach
                   
                  (package uninstalled)
                  • reinstalled jwdid from ssc
                  Code:
                  . ssc install jwdid
                  checking jwdid consistency and verifying not already installed...
                  installing into c:\ado\plus\...
                  installation complete.
                  • checked the version (version 2.0)
                  Code:
                  . which jwdid
                  c:\ado\plus\j\jwdid.ado
                  *!v2.00 Paper Out
                  • checked if there is an update for reghdfe
                  Code:
                  . ado update reghdfe
                  note: ado update updates community-contributed files; type update to check for updates to official Stata.
                   
                  Checking status of specified packages:
                   
                     [36] reghdfe at http://fmwww.bc.edu/RePEc/bocode/r:
                          installed package is up to date
                   
                  (no packages require updating)

                  Attached the logfile
                  Attached Files

                  Comment


                  • #24
                    ok, so jwdid works, its estat event that doesnt.
                    what happens if you type

                    margins , subpop(if __etr__==1 ) at(__tr__=(0 1)) over(__event__) noestimcheck contrast(atcontrast(r)) post

                    if that also gives you problems, the issue is not with jwdid but with your Stata installation.

                    1) update Stata: Check if it works
                    2) Reinstall Stata: check if it works
                    3) Contact technical services at Stata. (last resource)

                    Comment


                    • #25
                      typing margins , subpop(if __etr__==1 ) at(__tr__=(0 1)) over(__event__) noestimcheck contrast(atcontrast(r)) post shows:
                      Code:
                       margins , subpop(if __etr__==1 ) at(__tr__=(0 1)) over(__event__) noestimcheck contrast(atcontrast(r)) post
                      
                      Contrasts of predictive margins                        Number of obs   = 2,500
                      Model VCE: Robust                                      Subpop. no. obs =   291
                      
                      Expression: Linear prediction, predict()
                      Over:       __event__
                      1._at: 5.__event__
                                 __tr__ = 0
                             6.__event__
                                 __tr__ = 0
                             7.__event__
                                 __tr__ = 0
                             8.__event__
                                 __tr__ = 0
                      2._at: 5.__event__
                                 __tr__ = 1
                             6.__event__
                                 __tr__ = 1
                             7.__event__
                                 __tr__ = 1
                             8.__event__
                                 __tr__ = 1
                      
                      -------------------------------------------------
                                    |         df        chi2     P>chi2
                      --------------+----------------------------------
                      _at@__event__ |
                        (2 vs 1) 0  |          1        5.20     0.0226
                        (2 vs 1) 1  |          1        7.66     0.0056
                        (2 vs 1) 2  |          1       14.73     0.0001
                        (2 vs 1) 3  |          1        9.55     0.0020
                             Joint  |          4       18.00     0.0012
                      -------------------------------------------------
                      
                      ---------------------------------------------------------------
                                    |            Delta-method
                                    |   Contrast   std. err.     [95% conf. interval]
                      --------------+------------------------------------------------
                      _at@__event__ |
                        (2 vs 1) 0  |  -.0310669   .0136209     -.0577633   -.0043705
                        (2 vs 1) 1  |  -.0522349   .0188729      -.089225   -.0152448
                        (2 vs 1) 2  |  -.1360781   .0354555     -.2055696   -.0665866
                        (2 vs 1) 3  |  -.1047075   .0338743     -.1710999   -.0383151
                      ---------------------------------------------------------------
                      
                      .

                      Comment


                      • #26
                        Dear Mohammed,

                        I am currently having the same issue with estat, giving me the error "varlist required". Did you ever find a solution?

                        Thanks,
                        C

                        Comment


                        • #27
                          You need to update jwdid with the latest version from SSC
                          ssc install jwdid, replace
                          program drop _all
                          and then try again

                          Comment


                          • #28
                            Dear FernandoRios ,

                            Thanks for providing the support. However, even after these suggestions, it still has not worked.

                            I was wondering if it is regarding the Stata version. I have access to the latest version of Stata at the university, and the error does not appear. Nevertheless, at home, I am using version 17, and the error is coming.

                            Comment


                            • #29
                              No
                              i have tried few versions 14-18 and it works
                              try deleting all jwdid files first
                              them reinstall
                              make sure you don’t have old copies on your working directory
                              if the problem persists send me an email with set trace on
                              so if can check what is going on

                              Comment


                              • #30
                                Seems this was a bug with the Stata version you were working with.
                                thanks for helping me figuring out the error

                                Comment

                                Working...
                                X