Announcement

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

  • Stacking variables selectively with graph bar

    Dear Statalists,

    apologies in advance if this question has an easy answer/or was asked before:
    I intend to create a bar graph with 4 variables of which I want 2 of them stacked on to each other. So far the codes I have used are:


    graph bar (sum) new_deep shallow_to_deep new_shallow shallow_reverse, over(y)

    (see also attachment Graph_1)
    and then I have been trying to create a "group" for the stacking:

    gen exp=0
    replace exp=1 if new_deep==1
    replace exp=1 if shallow_to_deep==1

    to graph:
    graph bar (sum) new_deep shallow_to_deep new_shallow shallow_reverse, over(y) stack over (exp)

    (see also attachment Graph_2)

    However this result is also not quite want I want, as in the second graph the stacking is correct, but I want both bars side by side and one unified x-axis from 1997-2014 (just as in the first graph).

    Could anyone point me into the right direction of how to achieve this??
    Thanks a lot!!
    Attached Files

  • #2
    It looks like you'll just need to change the order of your over() options to

    Code:
    graph bar (sum) new_deep shallow_to_deep new_shallow shallow_reverse,  stack over(exp) over(y)
    Consider the difference in the example code:
    Code:
    sysuse auto, clear
    graph bar (sum) turn trunk, over(rep78) stack over(for)
    graph bar (sum) turn trunk, over(for) stack over(rep78)
    Eric A. Booth | Senior Director of Research | Far Harbor | Austin TX

    Comment


    • #3
      Thanks a lot!

      Comment


      • #4
        Dear all support providers, Might be this is simple question for you, but I need support.

        I have used Multinomial logit model to conduct analysis for multiple variable. At the same time I was interested to conduct analysis of their marginal effect. Accordingly I did and got good result for first and last variable category. However, for one variable category found in the middles, the result was zero for some independent variable and >1 for some of variable. What does marginal effect zero means? how can I interpreter it and is it possible with zero marginal effect. What about the marginal effect of greater than one. Is it also okey/what?

        Thanks in advance.

        Comment


        • #5
          Originally posted by Zelalem Jaleta View Post
          Dear all support providers, Might be this is simple question for you, but I need support.

          I have used Multinomial logit model to conduct analysis for multiple variable. At the same time I was interested to conduct analysis of their marginal effect. Accordingly I did and got good result for first and last variable category. However, for one variable category found in the middles, the result was zero for some independent variable and >1 for some of variable. What does marginal effect zero means? how can I interpreter it and is it possible with zero marginal effect. What about the marginal effect of greater than one. Is it also okey/what?

          Thanks in advance.
          You'll want to start a new thread for your unrelated question if you want to get a response.
          Eric A. Booth | Senior Director of Research | Far Harbor | Austin TX

          Comment

          Working...
          X