Announcement

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

  • Twoway hist: condition x vs. all observations

    Hi,

    I am trying to look at the frequency distribution of the variable total_sales, once for all observations and once when _merge = 3. I am using the following code:

    Code:
    twoway (histogram total_sales, bin(20) freq color(navy)) (histogram total_sales if _merge == 3, bin(20) freq fcolor(none) lcolor(black))
    I get the same amount of bars, but the bars do not exactly lay on top of each other. However, I would like to see how many observations out of all observations also fulfill _merge == 3 (and are within the same bar). Is this possible?

    (I am unable to provide a data example, sorry about that.)

    Best,
    Kathrin
    Last edited by Kathrin Me; 29 Apr 2024, 08:46. Reason: twoway

  • #2
    Code:
    help twoway__histogram_gen
    to get the data, then use twoway bar to graph.

    Comment


    • #3
      I would not use the bin() option here, because choosing the same number of bins won't ensure that the same bins are defined.

      I would choose start() and width() options consistently.

      Comment


      • #4
        I had tried out the width()-option, but not in combination with the start()-option. Thanks Nick, this worked!

        Comment

        Working...
        X