Announcement

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

  • Problems with histogram

    Hello everybody,

    I have been making some histograms however I've had problems with the presentations of them. There should not be problems with the distance between the bins, why is it? (there are no problems with frequency, etc. Can I make them perfect? Or is it my Stata version (11.1)?

    Click image for larger version

Name:	Graph.png
Views:	4
Size:	31.3 KB
ID:	118486

    Thank you!
    Attached Files
    Last edited by Gian Carlo; 31 Jul 2014, 18:29.

  • #2
    Please show us the command that generates the first graph.

    "There are no problems with frequency". Please show us a frequency table of the variable (testing).

    Comment


    • #3
      I totally agree with Svend – unless you provide the syntax and data producing the graph (ideally, as a minimal working example), it is hard to tell where your problem originates from.

      As a quick guess: I suspect your variable "testing" is discrete, not continuous. If so, you should use -histogram-'s option -discrete-; compare the histograms in this example:
      Code:
      clear all
      sysuse auto
      histogram rep78 , name(continuous) nodraw
      histogram rep78 , name(discrete) discrete nodraw
      graph combine continuous discrete
      Regards
      Bela
      Attached Files

      Comment


      • #4
        Thank you for your answers. I spent a lot of time figuring out what the problem was and it was as Daniel said, discrete option. Anyway, I don't understand why if it was continuous it should have spaces between the bins. The data has numbers like 20, 25, 30, 35, 40... The spaces don't have the same distance... If you could tell me I would be very thankful. Thanks.

        Comment


        • #5
          Try this: define the bins so that each has a midpoint of 5, 10, 15, and a width of 5. This should solve the case:
          Code:
          histogram testing, start(2.5) width(5)

          Comment

          Working...
          X