Announcement

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

  • Issue with histogram: Single outlier and x-axis scale

    I have uploaded a .png of my experimental histogram.

    The code for it is as follows

    Code:
    histogram gift_total, xscale(range(0 5000000)) bin(100) percent addlabel ylabel(, angle(horizontal)) xtitle(Gifts) title(Histogram of Gifts Received)
    Now for some reasons, which I can only assume is due to the fact that some observations of my data contain quite big numbers, the x-axis is a bit of an issue.

    For one I tried to limit the scale on the x-axis to 5 million, however this doesn't seemed to have changed the x-axis.

    I am looking at inheritances so even if that one variable is an outlier I wonder if I really don't want to include it. But if I do include it, then I don't see how I can get the histogram to ever be presentable... 100 bins also seem to be a tad much. Any advice on how I can make this histogram presentable?
    Attached Files

  • #2
    https://journals.sagepub.com/doi/abs...867X1801800116
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      Hi Oscar, I would use a logarithmic scale on your x-axis. I think you can add it using
      Code:
       xscale(log)
      More info here https://www.stata.com/manuals13/g-3a...le_options.pdf

      Comment


      • #4
        Ivan Privalko Unfortunately the reference linked in #3 in detail why your suggestion in #4 won't work. But logging the variable and then drawing a histogram will work.

        Comment


        • #5
          Ah good to know. Thank you!

          Comment


          • #6
            You can also drop the very high Gifts value with if Gifts<5000000

            Comment

            Working...
            X