0

I have a population dataframe. How to plot a gamma distribution diagram?

I am using python and I can plot a diagram using seaborn or plot bar. But I need a gamma distribution diagram. I dont know how to fit my parameters into gamma functions.

plot = sns.distplot(df["Percent"])
fig = plot.get_figure()

plot2 = rows['state'].value_counts().plot.bar()
fig2 = plot2.get_figure()

It only shows me two general diagrams. Not sure how to get gamma distribution.

SM Abu Taher Asif
  • 2,221
  • 1
  • 12
  • 14
Jennifer
  • 19
  • 2
  • 6
  • 1
    are you trying to plot a CDF or PDF of gamma distribution only or are you trying to plot some data in a histogram that you think is distributed like gamma? – AirSquid Jul 24 '19 at 04:10
  • Hi, I m not sure actually. I wish to get two gamma distribution diagrams of actual population and sample population distribution from data. Then to use K-L divergence to get the best sample that most close to the actual population. – Jennifer Jul 24 '19 at 05:20
  • Well, I think you need to figure out clearly what you intend to plot. If you are plotting a large set of sample data, you want to plot a histogram, which can be done a bunch of ways. It does not make sense to say you want to plot a gamma distribution of the data. You only get to plot the data, not plot it as a particular distribution. If you are done fitting a distribution to data, then once you have parameters and a CDF function, you can put a bunch of points into that to plot it. – AirSquid Jul 24 '19 at 05:50
  • Hi, could you help me? My input is a list of values and I need to get Generalized gamma distribution of the list. I need PDF instead of CDF. – Jennifer Aug 01 '19 at 06:57
  • Well, I still think we are x-wired on terms. Why do you think the data is gamma-distributed? The first thing you should do is plot a histogram of the data to see what it looks like. Use matplotlib. It should be close to a 1-liner to plot & show a histogram of a list. If you then want to try to fit a distribution to the data, that is a different beast. – AirSquid Aug 03 '19 at 17:54
  • I am not sure if I need to plot a histogram. I got a list of actual population distribution and a list of sample population distribution. These are all observed data. My supervisor required me to transfer these into gamma distribution and then calculate the kl divergence value between two list. – Jennifer Aug 05 '19 at 00:49

0 Answers0