Announcement

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

  • combining histograms of different bin sizes and plotting gamma distribution on them

    Hi all

    I have prepared histograms (attached) of % trip by trip lengths in the UK for two modes of travel: car and surface rail. Now the challenge is:

    1. To generate trendline of Gamma distribution for each histogram.

    2. To overlay both histograms/trendlines in one plot (note different bin sizes)


    Any help or alternate method, please.

    Thanks

    Adeel

    ITS Leeds university
    Attached Files

  • #2

    1. I don't know what a trendline of Gamma distribution means.
    2. You can use -twoway histogram- to overlay figures:

    Code:
    sysuse auto
    twoway histogram mpg , w(5)  color(green%40) || histogram trunk, color(blue%30) w(2)
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	19.4 KB
ID:	1512874

    Comment


    • #3
      Comparing a curve and a histogram are not nearly so effective as a dedicated gamma quantile plot. See qgamma on SSC.

      Comment


      • #4
        Hi Scott, Thanks, histogram overlay works but transparent coloring is not available in my Stata SE 13.1.

        Hi Nick, thanks for suggesting to use qgamma. Results below hint that it may not be a good fit? I want to check Weibull fit for the data as well but can't find out online how to get its beta/gamma parameters as used in your article 'Speaking Stata: Density probability plots' here https://www.stata-journal.com/sjpdf....iclenum=gr0012


        Click image for larger version

Name:	Picture3.jpg
Views:	1
Size:	54.9 KB
ID:	1513157


        Click image for larger version

Name:	Picture4.jpg
Views:	1
Size:	28.6 KB
ID:	1513158




        Comment


        • #5
          A Weibull distribution may be fitted using weibullfit from SSC and the corresponding quantile plot is at qweibull

          The data you show would seem hopeless for any but a three-parameter gamma, which is more awkward to fit.

          I feel Darwinian about density probability plots. They haven't survived in my data analysis practice.

          Comment

          Working...
          X