Announcement

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

  • Synthetic control placebo code

    Hi guys,

    I'm doing an econometric paper analyzing the decriminalization of drugs in the Czech Republic and I'm trying to run a placebo test for my synthetic control method.

    Here is the information from statas help command:

    Example 5 Run placebo in space:
    . tempname resmat
    forvalues i = 1/4 {
    synth cigsale retprice cigsale(1988) cigsale(1980) cigsale(1975) , trunit(`i') trperiod(1989) xperiod(1980(1)1988)
    matrix `resmat' = nullmat(`resmat') \ e(RMSPE)
    local names `"`names' `"`i'"'"'
    }
    mat colnames `resmat' = "RMSPE"
    mat rownames `resmat' = `names'
    matlist `resmat' , row("Treated Unit")

    This is a code example to run placebo studies by iteratively reassigning the intervention in space to the first four states. To do so, we simply run a four loop each where the trunit() setting is incremented in each
    iteration. Thus, in the n of synth state number one is assigned to the intervention, in the second run state number two, etc, etc. In each run we store the RMSPE and display it in a matrix at the end.





    And here is the error Im getting:


    forvalues i = 1/4 {
    2.
    . synth homiciderate popurban neet2024 longtermun healthexpenditurepercapitappp gdppercap Tertiaryedu uppersecond prop1564 alclitpercap unemployr15 homiciderate(2004) hom
    > iciderate(2006) homiciderate(2008),
    3.
    . trunit(1) trperiod(2009) xperiod(2004(1)2008)
    4.
    . matrix `resmat' = nullmat(`resmat') \ e(RMSPE)
    5.
    . local names `"`names' `"`i'"'"'
    6.
    . }
    option trunit() required
    r(198);

    .
    . mat colnames `resmat' = "RMSPE"
    matrix __000000 not found
    r(111);

    .
    . mat rownames `resmat' = `names'
    matrix __000000 not found
    r(111);

    .
    . matlist `resmat' , row("Treated Unit")
    __000000 not found
    r(111);





    Thanks in advance
    Last edited by Amir Jabari; 09 Mar 2017, 15:23.

  • #2
    I'm not familiar with the -synth- command; it is not part of official Stata. And you are asked in the FAQ to indicate where any user-written commands come from.

    That said, your first error message says that the command expects an option -truint()- to be specified. You probably think you did specify it, but if you look at what Stata gave you, notice that a line numbered 3. intervenes between the start of your -synth- command and the -truint()- option. So in your code you have a line break in there that ends the command. You need to put a command continuation sign (///) at the end of the preceding line so that Stata will know that the line beginning -truint()- is part of the same command.

    Since your do-file must have terminated with that error, the remaining errors result because the macro resmat, assuming you did actually define it at some point, went out of scope when the do file terminated, so it no longer exists. If you did define local macro resmat in the code earlier, reruning the whole dofile from that point on, after you fix the error in your -synth- command, should resolve those errors.

    Comment


    • #3
      Amir, may I please know how you managed to resolve the issue?

      Comment

      Working...
      X