Announcement

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

  • Display gamma distribution and normal curve on a histogram

    Hello all,

    I am trying to create a twoway bar that will display the mean temperature per month for the past 30 years. I am trying to display the normal curve and the curve for the gamma distribution on the same graph. I was trying the following code with no luck

    twoway bar temperature month, bartype(spanning) bstyle(histogram) norm

    Any help will be appreciated

  • #2
    Why would you want to overlay a normal or gamma distribution on top of such a bar chart? The bar chart does not represent a distribution. Imagine that that were the case: the x-axis represents months, so (assuming this is on a location on the northern hemisphere) the graph would meant that januaries are less prevalent than junes. That is not correct, so the bar chart does not represent a distribution, and plotting any distribution on top of this bar chart is thus not appropriate.

    But that leaves the question: you want to plot a line on top of a barchart. To tell you how to do that we need to know what you want that line to represent. It cannot be a distribution. Maybe you want to smooth the bar chart? Now you have to remember that Januaries and Decembers are far apart in that graph, but close by in time. So that is not that trivial. But before we spent more time on that, we need to make sure that this is what you really want, otherwise we are wasting both your and my time, which neither of us wants.
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      I agree with Maarten Buis except that my guess is that month is a monthly date variable. The fact that experienced users can guess differently shows up the lack of a data example here.

      I would start with

      Code:
      histogram temperature
      and superimpose a normal curve. Where it gets difficult is understanding why a gamma distribution is any use for temperatures. The absence of a natural zero for temperatures -- other than on the kelvin scale, which implies quite different problems -- is a severe barrier to even imagining it makes sense. It has been applied to precipitation data but that is a completely different story. Even a three-parameter gamma implies fitting a minimum which can't be exceeded downwards, which doesn't make physical sense to me

      Comment

      Working...
      X