Announcement

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

  • Rescaling y-axis of gapfigure

    Hi everyone,


    Currently, I am running a synthetic control with the command allsynth whereby I am using the option "gap figure". According to the help function one can use two-way_options.
    I want to change the scale of the y-axis since it is way too large to show the discrepancy between the synthetic control and the trend of the treatment country (see picture 1).
    Click image for larger version

Name:	gap fig_test_2.jpg
Views:	2
Size:	99.8 KB
ID:	1680108



    When adding the option ylab(-250000 250000) does change the labels but the graph is not rescaled (see picture 2).
    Click image for larger version

Name:	gap fig_test_1.jpg
Views:	2
Size:	68.2 KB
ID:	1680107



    I thought the following command (looking at the added option) should have fixed this, however, Stata returns the same graph as picture 1 in which the range of the y axis is not defined...

    allsynth road_tkm lag_road_tkm gdp_capita road_investment(1996(1)2013) share_road(1994(1)2013) FDI(1994(1)2013) emp(1990(1)2013) cn(1990(1)2013) pl_x(1990(1)2013) pl_m(1990(1)2013), trunit(70) trperiod(2003) unitnames(country) keep(synth1.dta, replace) gapfigure(classic lineback, ysc(r(-250000 250000))) nested allopt
    Does anyone know what I did wrong?

    Thank you in advance.
    Attached Files
    Last edited by Harina Peternella; 31 Aug 2022, 07:57.

  • #2
    You are at the mercy of those who use that command which you should identify as community-contributed (FAQ Advice #12). In general, Stata will not truncate data, and it is not apparent what is the underlying data that the command uses. I have a pair of suggestions for generating the graph using twoway:

    1. Obtain the gap variable and plot it, or
    2. Retrieve data from the graph and plot.

    An example of #2 is #10 of https://www.statalist.org/forums/for...s-in-one-graph


    Comment


    • #3
      Thank you for your reply, Andrew Musau, I will generate the gap variable by myself and plot it with a normal graph.

      Comment


      • #4
        Two things you should note. First, you have specified
        Code:
        gapfigure(classic lineback, ysc(r(-250000 250000))
        , which tells allsynth that you want to plot the gaps (the differences between the treated-unit outcome values and the synthetic control outcome values). If you want to plot the treated-unit outcome values and the synthetic control outcome values, I recommend you tell Stata to load your synth1.dta file, where you saved the results of the synthetic control estimation, and then simply plot the two series using e.g.
        Code:
        twoway (line _Y_treated _time, lp(solid)) (line _Y_s _time, lp(dash)) [, twoway_opts]
        I wanted to retain all of the functionality and syntax of synth with allsynth, so I did not change the figure option to make that figure customizable.

        Second, try
        Code:
        gapfigure(classic lineback, ysc(r(-250000 250000) ylabel(-250000(125000)250000))
        Last edited by Justin Wiltshire; 13 Sep 2022, 21:46.

        Comment

        Working...
        X