Announcement

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

  • Allsynth - tmp file not found

    I am trying to run the user-created command allsynth (from Justin Wiltshire, Beta version 0.0.9) with multiple treated units and a single treatment timing. I have district-level data from 1993 until 2011. I provide a data excerpt at the bottom of my post.

    When I run the code:

    allsynth Y literacy(1993(1)2000) Y(1993(1)2000), bcorrect(merge) keep(results, replace) stacked(trunits(daughter) trperiods(treatment), clear figure(classic bcorrect))

    Stata first seems to successfully create the synthetic controls for the specified treated units. However, afterwards, when calculating the average treatment effect, I get the following error:
    Stacking the estimates...

    Calculating the estimated average treatment effect for treated units

    file C:\Users\myusername\AppData\Local\Temp\ST_3e10_000 00d.tmp not found

    I have attempted the following:
    -My Stata can successfully reproduce the stacked allsynth example from the help file. I have also successfully used allsynth in a different dataset, with the stacked option.
    -I reduced the number of treated districts from 60 to 2 in an attempt to simplify the command, but this does not matter.
    -As I said, Stata seems to successfully create the synthetic controls for the specified treated units. However, it excludes Y(1993(1)2000) from the Predictor Balance.
    -If I try the option "transform(Y, normalize)" I get the error "transform(Y, normalize) is specified but Y does not exist as a variable in the data set. Specified at least one variable in the data set".
    -If I reduce the number of donor districts to 7, I no longer get the problem that Y(1993(1)2000) is excluded, nor do I get the warning that "Y does not exist as a variable" if I try to use "transform(Y, normalize)". However, I still get the ".tmp not found" error.
    -I concluded that the problem must be in the Y variable. However, if I run the command with a different dependent variable and leave Y out of the command entirely, I still get the ".tmp" not found error.
    -As such, I conclude that the problem must lie somewhere in the dataset. Where, however, I do not understand.

    I would appreciate any help.

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float year double AreaTotal float ForestDensity long ID_2 float(Soil literacy Y daughter treatment)
    1997  3229  .1570752 106  1.031746  .275191   .06507374 0    .
    1998  3229  .1570752 106  1.031746  .275191  .022517383 0    .
    1999  3229  .1570752 106  1.031746  .275191  -.20059435 0    .
    2000  3229  .1570752 106  1.031746  .275191   .37709555 0    .
    2001  3229  .1570752 106  1.031746  .275191  -.06750825 0    .
    2002  3229  .1570752 106  1.031746 .4081107     .233417 0    .
    2003  3229  .1570752 106  1.031746 .4081107   -.6471402 0    .
    2004  3229  .1570752 106  1.031746 .4081107   .27758738 0    .
    2005  3229  .1570752 106  1.031746 .4081107  -.12879132 0    .
    2006  3229  .1570752 106  1.031746 .4081107   .12414443 0    .
    2007  3229  .1570752 106  1.031746 .4081107    .4403561 0    .
    2008  3229  .1570752 106  1.031746 .4081107   .25279105 0    .
    2009  3229  .1570752 106  1.031746 .4081107    -.555305 0    .
    2010  3229  .1570752 106  1.031746 .4081107    .6239394 0    .
    2011  3229  .1570752 106  1.031746 .4081107  -.08596063 0    .
    1993 19077 4.2234097 107 1.3573903 .5181735 -.008481395 0    .
    1994 19077 4.2234097 107 1.3573903 .5181735    .3281367 0    .
    1995 19077 4.2234097 107 1.3573903 .5181735    .3516888 0    .
    1996 19077 4.2234097 107 1.3573903 .5181735  -.13460565 0    .
    1997 19077 4.2234097 107 1.3573903 .5181735  -.27492568 0    .
    1998 19077 4.2234097 107 1.3573903 .5181735    .3595104 0    .
    1999 19077 4.2234097 107 1.3573903 .5181735   .01871425 0    .
    2000 19077 4.2234097 107 1.3573903 .5181735   .12801498 0    .
    2001 19077 4.2234097 107 1.3573903 .5181735   -.1606701 0    .
    2002 19077 4.2234097 107 1.3573903 .5785219 -.016816258 0    .
    2003 19077 4.2234097 107 1.3573903 .5785219  -.56596684 0    .
    2004 19077 4.2234097 107 1.3573903 .5785219     .417922 0    .
    2005 19077 4.2234097 107 1.3573903 .5785219  -.11410606 0    .
    2006 19077 4.2234097 107 1.3573903 .5785219  -.06028071 0    .
    2007 19077 4.2234097 107 1.3573903 .5785219   .10512254 0    .
    2008 19077 4.2234097 107 1.3573903 .5785219   .21751446 0    .
    2009 19077 4.2234097 107 1.3573903 .5785219  -.07351655 0    .
    2010 19077 4.2234097 107 1.3573903 .5785219    .4994103 0    .
    2011 19077 4.2234097 107 1.3573903 .5785219  -.08752358 0    .
    1993 21257  6.612158 108 1.0864522 .5760336   -.1382008 1 2001
    1994 21257  6.612158 108 1.0864522 .5760336    .3448446 1 2001
    1995 21257  6.612158 108 1.0864522 .5760336    .3477485 1 2001
    1996 21257  6.612158 108 1.0864522 .5760336  -.04370278 1 2001
    1997 21257  6.612158 108 1.0864522 .5760336  -.15648526 1 2001
    1998 21257  6.612158 108 1.0864522 .5760336   .11069566 1 2001
    1999 21257  6.612158 108 1.0864522 .5760336   -.1952595 1 2001
    2000 21257  6.612158 108 1.0864522 .5760336   .14629906 1 2001
    2001 21257  6.612158 108 1.0864522 .5760336  -.04422414 1 2001
    2002 21257  6.612158 108 1.0864522  .646927    .2859437 1 2001
    2003 21257  6.612158 108 1.0864522  .646927  -.42999035 1 2001
    2004 21257  6.612158 108 1.0864522  .646927    .4305195 1 2001
    2005 21257  6.612158 108 1.0864522  .646927  -.06155586 1 2001
    2006 21257  6.612158 108 1.0864522  .646927  -.14271265 1 2001
    2007 21257  6.612158 108 1.0864522  .646927   .28778797 1 2001
    2008 21257  6.612158 108 1.0864522  .646927    .2589848 1 2001
    2009 21257  6.612158 108 1.0864522  .646927   .02300179 1 2001
    2010 21257  6.612158 108 1.0864522  .646927    .3876184 1 2001
    2011 21257  6.612158 108 1.0864522  .646927  -.07782114 1 2001
    1993  8466 2.3730063 109 1.4888598 .5854354    .3048894 0    .
    1994  8466 2.3730063 109 1.4888598 .5854354   .21332344 0    .
    1995  8466 2.3730063 109 1.4888598 .5854354    .3642433 0    .
    1996  8466 2.3730063 109 1.4888598 .5854354   .01354301 0    .
    1997  8466 2.3730063 109 1.4888598 .5854354   -.3939877 0    .
    1998  8466 2.3730063 109 1.4888598 .5854354   .15150565 0    .
    1999  8466 2.3730063 109 1.4888598 .5854354  -.05472958 0    .
    2000  8466 2.3730063 109 1.4888598 .5854354   .06617284 0    .
    2001  8466 2.3730063 109 1.4888598 .5854354  -.29799435 0    .
    2002  8466 2.3730063 109 1.4888598 .6159672   .14989516 0    .
    2003  8466 2.3730063 109 1.4888598 .6159672   -.4936667 0    .
    2004  8466 2.3730063 109 1.4888598 .6159672   .26636022 0    .
    2005  8466 2.3730063 109 1.4888598 .6159672  -.05927211 0    .
    2006  8466 2.3730063 109 1.4888598 .6159672 -.002982259 0    .
    2007  8466 2.3730063 109 1.4888598 .6159672   .11584735 0    .
    2008  8466 2.3730063 109 1.4888598 .6159672   .14008597 0    .
    2009  8466 2.3730063 109 1.4888598 .6159672  -.57640606 0    .
    2010  8466 2.3730063 109 1.4888598 .6159672   .53387964 0    .
    2011  8466 2.3730063 109 1.4888598 .6159672    .1992212 0    .
    1993  2367   .835816 110 1.1302521 .3073967  -.19048584 0    .
    1994  2367   .835816 110 1.1302521 .3073967    .4461459 0    .
    1995  2367   .835816 110 1.1302521 .3073967   .05103827 0    .
    1996  2367   .835816 110 1.1302521 .3073967   .12355268 0    .
    1997  2367   .835816 110 1.1302521 .3073967   -.3791602 0    .
    1998  2367   .835816 110 1.1302521 .3073967   .11177385 0    .
    1999  2367   .835816 110 1.1302521 .3073967  -.20608747 0    .
    2000  2367   .835816 110 1.1302521 .3073967   .08271122 0    .
    2001  2367   .835816 110 1.1302521 .3073967   .13367844 0    .
    2002  2367   .835816 110 1.1302521 .4468094   -.2177663 0    .
    2003  2367   .835816 110 1.1302521 .4468094  -.28805935 0    .
    2004  2367   .835816 110 1.1302521 .4468094   .18409187 0    .
    2005  2367   .835816 110 1.1302521 .4468094  -.15850008 0    .
    2006  2367   .835816 110 1.1302521 .4468094    .3475953 0    .
    2007  2367   .835816 110 1.1302521 .4468094   .16530073 0    .
    2008  2367   .835816 110 1.1302521 .4468094   .05900788 0    .
    2009  2367   .835816 110 1.1302521 .4468094  -.26038313 0    .
    2010  2367   .835816 110 1.1302521 .4468094    .7479821 0    .
    2011  2367   .835816 110 1.1302521 .4468094   -.2089857 0    .
    1993  7632  2.636113 111  1.213534 .5387815   .08119074 0    .
    1994  7632  2.636113 111  1.213534 .5387815   .12352344 0    .
    1995  7632  2.636113 111  1.213534 .5387815   .26066232 0    .
    1996  7632  2.636113 111  1.213534 .5387815  -.02912012 0    .
    1997  7632  2.636113 111  1.213534 .5387815   -.1915751 0    .
    1998  7632  2.636113 111  1.213534 .5387815   .16835415 0    .
    1999  7632  2.636113 111  1.213534 .5387815  .016789556 0    .
    2000  7632  2.636113 111  1.213534 .5387815     .117783 0    .
    2001  7632  2.636113 111  1.213534 .5387815  -.07801765 0    .
    end
    label values ID_2 ID_2
    label def ID_2 106 "Purnia", modify
    label def ID_2 107 "Raigarh", modify
    label def ID_2 108 "Raipur", modify
    label def ID_2 109 "Raisen", modify
    label def ID_2 110 "Rampur", modify
    label def ID_2 111 "Ranchi", modify

  • #2
    Have you tried

    Code:
    set tr on

    Comment


    • #3
      Originally posted by Jared Greathouse View Post
      Have you tried

      Code:
      set tr on
      I have now. I'm not sure what to quote out of the code. In the non-functioning example, I see

      Code:
          = qui use "C:\Users\chaasno1\AppData\Local\Temp\ST_3e10_00000d.tmp", clear
      While in the code above it, I see a number of commands calling up ST_3e10_00000c.tmp and ST_3e10_00000e.tmp, but not the d temp file. In the datafile where allsynth runs successfully, there is only one .tmp file that the command seems to be using, and when when we get to the same line of "calculating the estimated average treatment effect", the code calls up the same .tmp file that is used in all of the code before it.

      However, I'm not sure which part of the code to show you, and I don't think my Stata is showing the entire command even when I max out set reventries and I scroll all the way up, so I'm not sure I'm providing you with useful information. My apologies.

      Comment


      • #4
        For reference, this is the code and dataset which does work:

        allsynth lnGDPPC lnGDPPC(1(1)3), transform(lnGDPPC, normalize) bcorrect(merge) keep(results, replace) stacked(trunits(treated) trperiods(treatment), clear)

        Code:
        * Example generated by -dataex-. For more info, type help dataex
        clear
        input float lnGDPPC long stateid float(splitpanelt treated treatment)
         9.541859  2 1 0 .
         9.902798  2 2 0 .
        10.353473  2 3 0 .
         9.605911  3 1 0 .
         9.819482  3 2 0 .
        10.074644  3 3 0 .
         9.480545  4 1 0 .
          9.54943  4 2 0 .
         9.761483  4 3 0 .
         8.733422  5 1 1 2
          8.84153  5 2 1 2
         9.190077  5 3 1 2
         9.459458  6 1 1 2
         9.058432  6 2 1 2
         8.424558  6 3 1 2
        10.573262  7 1 0 .
         10.77343  7 2 0 .
         11.24801  7 3 0 .
         10.41848  8 1 0 .
        13.071414  8 2 0 .
          14.2213  8 3 0 .
         9.773789  9 1 0 .
         9.785285  9 2 0 .
         9.880027  9 3 0 .
         10.04509 10 1 0 .
          9.86312 10 2 0 .
          9.22353 10 3 0 .
         9.790998 11 1 0 .
        10.155784 11 2 0 .
        10.418034 11 3 0 .
         9.559724 12 1 0 .
        10.063315 12 2 0 .
        10.638887 12 3 0 .
         9.388197 13 1 1 2
        10.145334 13 2 1 2
         10.88179 13 3 1 2
         9.606702 14 1 0 .
         9.778887 14 2 0 .
         9.956235 14 3 0 .
          9.71801 15 1 0 .
        10.065634 15 2 0 .
        10.534862 15 3 0 .
         9.337459 16 1 1 2
         9.111534 16 2 1 2
         8.814237 16 3 1 2
         9.947879 17 1 0 .
         10.21561 17 2 0 .
        10.671805 17 3 0 .
         9.423763 18 1 0 .
         9.570367 18 2 0 .
         9.734066 18 3 0 .
         9.515892 19 1 0 .
         9.778508 19 2 0 .
        10.040114 19 3 0 .
         9.925314 20 1 0 .
         9.897045 20 2 0 .
        10.238645 20 3 0 .
         9.825315 21 1 0 .
         9.894658 21 2 0 .
         10.40486 21 3 0 .
         9.211041 22 1 0 .
         9.445014 22 2 0 .
         9.787287 22 3 0 .
        10.012265 23 1 0 .
        10.597259 23 2 0 .
         10.90461 23 3 0 .
        10.114577 24 1 0 .
         10.27506 24 2 0 .
        10.580014 24 3 0 .
         9.487872 25 1 0 .
         9.642851 25 2 0 .
         9.947032 25 3 0 .
         9.681308 26 1 0 .
         9.861659 26 2 0 .
        10.718726 26 3 0 .
         9.722172 27 1 0 .
         10.05859 27 2 0 .
        10.519586 27 3 0 .
         9.363767 28 1 0 .
         9.875297 28 2 0 .
        10.249903 28 3 0 .
         9.242014 29 1 1 2
         9.292723 29 2 1 2
         9.535248 29 3 1 2
        11.779644 30 1 1 2
         9.878651 30 2 1 2
        10.508927 30 3 1 2
         9.532701 31 1 0 .
         9.870975 31 2 0 .
         10.17043 31 3 0 .
        end
        label values stateid stateid
        label def stateid 2 "Andhra Pradesh", modify
        label def stateid 3 "Arunachal Pradesh", modify
        label def stateid 4 "Assam", modify
        label def stateid 5 "Bihar", modify
        label def stateid 6 "Chhattisgarh", modify
        label def stateid 7 "Delhi", modify
        label def stateid 8 "Goa", modify
        label def stateid 9 "Gujarat", modify
        label def stateid 10 "Haryana", modify
        label def stateid 11 "Himachal Pradesh", modify
        label def stateid 12 "Jammu and Kashmir", modify
        label def stateid 13 "Jharkhand", modify
        label def stateid 14 "Karnataka", modify
        label def stateid 15 "Kerala", modify
        label def stateid 16 "Madhya Pradesh", modify
        label def stateid 17 "Maharashtra", modify
        label def stateid 18 "Manipur", modify
        label def stateid 19 "Meghalaya", modify
        label def stateid 20 "Mizoram", modify
        label def stateid 21 "Nagaland", modify
        label def stateid 22 "Orissa", modify
        label def stateid 23 "Puducherry", modify
        label def stateid 24 "Punjab", modify
        label def stateid 25 "Rajasthan", modify
        label def stateid 26 "Sikkim", modify
        label def stateid 27 "Tamil Nadu", modify
        label def stateid 28 "Tripura", modify
        label def stateid 29 "Uttar Pradesh", modify
        label def stateid 30 "Uttarakhand", modify
        label def stateid 31 "West Bengal", modify

        Comment


        • #5
          Your best bet is to email Justin then

          Comment


          • #6
            Normally I'd help, but I'm in Spain and away from my laptop

            Comment


            • #7
              Synthetic Counterfactual is not going to give you reliable results with only 7 years pre-treatment.

              Comment

              Working...
              X