Announcement

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

  • How can I merger two graphs in one graph

    how can I merge two graphs and create one graph?
    I run a command
    graph combine 4t.gph 4v.gph, xcommon ycommon name(combined)
    I need the two graphs to be merged like the attached figure. can u share with me the codes
    Best
    Attached Files

  • #2
    The graph I combined is attached here. I need to combine these in one figure
    may you please drop me the codes
    Attached Files

    Comment


    • #3
      Code:
      * Example generated by -dataex-. To install: ssc install dataex
      clear
      input float(ul ll _step irf series)
        1.1795503    .2888858 0      .7342181 0
         .7206178   .11520676 1      .4179123 0
        .17910495  -.04090491 2     .06910002 0
        .06162419  -.02801639 3    .016803898 0
        .02474948 -.009778056 4    .007485711 0
      .0087765455 -.009132749 5 -.00017810178 0
         1.446306   .08401732 0      .7651617 1
         .8044859  -.03326724 1      .3856093 1
        .19248326  -.15251245 2    .019985406 1
        .05006727  -.08335302 3   -.016642874 1
       .025492966  -.02425364 4   .0006196622 1
       .007656507 -.012982474 5  -.0026629835 1
      end
      
      twoway  (line irf _step if !series, lcolor(blue) lwidth(medthick)) ///
      (rarea ll ul _step if !series, color(blue%50)) ///
      (line irf _step if series, lcolor(red) lwidth(medthick)) ///
      (rarea ll ul _step if series, color(red%50) scheme(s1color) ///
      legend(order(1 "Some description 1" 3 " Some description 2")) ///
      title(Orthogonalized IRFs and 95% CIs) xtitle("step"))

      Res.:

      Click image for larger version

Name:	Graph.png
Views:	1
Size:	65.7 KB
ID:	1604469

      Comment


      • #4
        Dear Andrew, attached here the irfs results under boom and busts. I tried to graph in stata but it doesn't generate me the figure desired. [series not found]
        may you please suggest me how to do it. should I copy the two irf results in one excel? may you please run the irfs in ur codes and suggest me what to do.
        2nd, can I graph like yours in separate ways as well. I can run it in stata the default one but I like to graph in different colours
        Thanks bro
        Best
        Attached Files

        Comment


        • #5
          Hi Gabriel, I do not work with IRFs, but I can help with graphing. If you can post your graphs as you did in #2 (.gph format), I can illustrate how you can extract the data from the graphs and combine the plots.

          Comment


          • #6
            Dear Andrews, thank you bro for your genuine help.
            herewith is attached the graphs.
            can you also suggest me to graph independently like your not as defualt stata gives
            best
            Attached Files

            Comment


            • #7
              Dear Andrew, i managed in this way to plot the graph for boom. I am now eager how to combine with busts.

              twoway (rarea ll ul _step if _step>=0 & _step<=5, ///
              fcolor(gs11) lcolor(gs14) lpattern(solid)) ///
              (line irf _step if _step>=0 & _step<=5, lcolor(black) lpattern(solid) lwidth(thick)) ///
              , graphregion(color(white)) ytitle("percent") ylabel(,nogrid) legend(off) title("boom")

              Comment


              • #8
                Dear Andrew,
                I tried to plot the graph but I failed to graph the same graph as yours. may you please suggest me my mistakes?
                ***combine graphs
                twoway (line irf _step if _step>=0 & _step<=5, lcolor(blue) lwidth(medthick)) ///
                (rarea ll ul _step if _step>=0 & _step<=5, color(blue%50)) ///
                (line irf _step if _step>=0 & _step<=5, lcolor(red) lwidth(medthick)) ///
                (rarea ll ul _step if _step>=0 & _step<=5, color(red%50) scheme(s1color) ///
                legend(order(1 "boom" 3 " busts")) ///
                title(Orthogonalized IRFs and 95% CIs) xtitle("step"))
                Attached Files
                Last edited by Gabriel Temesgen; 21 Apr 2021, 03:36.

                Comment


                • #9
                  this is the graph i generated
                  Attached Files

                  Comment


                  • #10
                    So here are your graphs from #6
                    Click image for larger version

Name:	graph1.png
Views:	1
Size:	49.4 KB
ID:	1604860

                    Click image for larger version

Name:	Graph2.png
Views:	1
Size:	51.1 KB
ID:	1604861



                    From the gph files, I will extract the data as follows, creating a variable "series" indicating the graph.

                    Code:
                    clear
                    serset clear
                    graph use "4c.gph"
                    serset use
                    gen series=1
                    tempfile gr4c
                    save `gr4c'
                    clear
                    serset clear
                    graph use "4b.gph"
                    serset use
                    gen series=0
                    append using `gr4c'
                    dataex
                    This will give me the dataset below to which I append the code in #3 as is, only changing the legend keys. I may have mixed boom and bust, so change the order if so.

                    Code:
                    * Example generated by -dataex-. To install: ssc install dataex
                    clear
                    input float(ul ll _step irf series)
                      .9349878   .05344553 0     .4942167 0
                      .9566303   .26375782 1     .6101941 0
                      .1506721  -.15873736 2  -.004032633 0
                     .10246723 .0014379263 3    .05195258 0
                     .02035286 -.027688866 4  -.003668004 0
                    .012607763 -.004037577 5   .004285093 0
                      1.651659   .58233076 0     1.116995 1
                      .4159277  -.10556342 1    .15518215 1
                     .11808501  -.02620262 2     .0459412 1
                    .028928503  -.02930867 3 -.0001900822 1
                    .015944468 -.007258649 4  .0043429094 1
                    .003438265  -.00640593 5 -.0014838327 1
                    end
                    
                    twoway  (line irf _step if !series, lcolor(blue) lwidth(medthick)) ///
                    (rarea ll ul _step if !series, color(blue%50)) ///
                    (line irf _step if series, lcolor(red) lwidth(medthick)) ///
                    (rarea ll ul _step if series, color(red%50) scheme(s1color) ///
                    legend(order(1 "boom" 3 "bust")) ///
                    title(Orthogonalized IRFs and 95% CIs) xtitle("step"))
                    Res.:
                    Click image for larger version

Name:	Graph.png
Views:	1
Size:	57.4 KB
ID:	1604862

                    Comment


                    • #11
                      thanks andrews, it works

                      Comment


                      • #12
                        Dear Andrew Musau, can I draw the merged IRFs without coloring the shaded area?

                        Comment


                        • #13
                          Code:
                          twoway  (line irf _step if !series, lcolor(blue) lwidth(thick)) ///
                          (rarea ll ul _step if !series, color(none) lcolor(blue)) ///
                          (line irf _step if series, lcolor(red) lwidth(thick)) ///
                          (rarea ll ul _step if series, color(none) lcolor(red) scheme(s1color) ///
                          legend(order(1 "boom" 3 "bust")) ///
                          title(Orthogonalized IRFs and 95% CIs) xtitle("step"))

                          Comment


                          • #14
                            Dear Andrew Musau
                            Greetings.
                            when I transform my variables to log form and multiply by 100, I got IRFs 100 percent higher than the IRfs with log form only as depicted below. what is the reason? I couldn't know the justification in the literature they use either one of them. Again, I am confused with "one standard error innovation" and "percentage innovations (impulses)". What is their difference? Does the default result of STATA in percentage change?

                            gen lg = 100*ln(spending)


                            gen lg = ln(spending)


                            dear andrew, I also want to graph histogram for (some of the observations 'zero' value and the others 'continuous'). I want to graph (two-way histogram between the size and year) and (duration of the episodes separately and twoway graph with the years). can u suggest to me the STATA code? The figure below I take it from a published paper.

                            Comment


                            • #15
                              Originally posted by Gabriel Temesgen View Post
                              Dear Andrew Musau
                              Greetings.
                              when I transform my variables to log form and multiply by 100, I got IRFs 100 percent higher than the IRfs with log form only as depicted below. what is the reason? I couldn't know the justification in the literature they use either one of them. Again, I am confused with "one standard error innovation" and "percentage innovations (impulses)". What is their difference? Does the default result of STATA in percentage change?
                              Sorry, I do not deal with IRFs and I am not familiar with the literature. My input in this thread does not go beyond graphing.


                              I also want to graph histogram for (some of the observations 'zero' value and the others 'continuous'). I want to graph (two-way histogram between the size and year) and (duration of the episodes separately and twoway graph with the years). can u suggest to me the STATA code? The figure below I take it from a published paper.
                              As this is an entirely new question, start a new thread and ask the question. You should preferably include a data example as suggested in FAQ Advice #12.

                              Comment

                              Working...
                              X