turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Fitting poisson distribution to a histogram

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-01-2012 08:22 PM

I want to chart the poisson distribution on a histogram and subsequently to a qqplot. Proc univariate doesn't seem to support this. Any help is deeply appreciated.

Accepted Solutions

Solution

04-02-2012
09:39 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-02-2012 09:39 AM

1) Estimate the parameter with PROC GENMOD: http://support.sas.com/kb/24/166.html

2) Use the DATA step and he tPDF function to compute the Poisson PDF (well, really the PMF=probability mass function) for the range of x values of interest.

3) The Poisson is a discrete distribution, so your data should be plotted with a bar chart. Because PROC SGPLOT doesn't enable you to overlay a bar chart and a scatter plot of (x, pdf(x)), you need to use the GTL to overlay the two plots.

4) You can create a Q-Q plot by following the steps laid out in my blog: http://blogs.sas.com/content/iml/2011/10/28/modeling-the-distribution-of-data-create-a-qq-plot/

Rick

All Replies

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-02-2012 08:15 AM

Do you have access to SAS/QC? If so, PROC CAPABILITY should be able to help with this problem.

Steve Denham

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-12-2012 11:24 AM

Unfortunately I don't have access to SAS/QC.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-12-2012 11:32 AM

CAPABILITY and UNIVARIATE only model continuous distributions. The Poisson distribution is discrete.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-13-2012 07:44 AM

I apologize--I gave an answer without checking the documentation. I knew CAPABILITY had several distributions, and wrongly assumed that it included the Poisson. There is nothing that is better than reading the manual, and I missed it on this one.

Steve Denham

Solution

04-02-2012
09:39 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-02-2012 09:39 AM

1) Estimate the parameter with PROC GENMOD: http://support.sas.com/kb/24/166.html

2) Use the DATA step and he tPDF function to compute the Poisson PDF (well, really the PMF=probability mass function) for the range of x values of interest.

3) The Poisson is a discrete distribution, so your data should be plotted with a bar chart. Because PROC SGPLOT doesn't enable you to overlay a bar chart and a scatter plot of (x, pdf(x)), you need to use the GTL to overlay the two plots.

4) You can create a Q-Q plot by following the steps laid out in my blog: http://blogs.sas.com/content/iml/2011/10/28/modeling-the-distribution-of-data-create-a-qq-plot/

Rick

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-02-2012 10:54 AM

Great advice! There is even an easier way to do step 3 now. The VBARPARM can be combined with SERIES plots in SGPLOT (I think this is new to 9.3).

PG

PG

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-02-2012 11:23 AM

Clever! Yes, you can use PROC FREQ to tabulate the data. You'll want to scale the PERCENT variable to a proportion so that it is on the same scale as the PDF.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-12-2012 11:25 AM

Rick,

Thank you so much for the response and then subsequently backing this with your blog. I have read and shared your blogs in the past and they have always worked.

Thanks,

Jatin

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-12-2012 11:31 AM

You are welcome. And thanks to you for the interesting idea.

For those who do not read my blog, I followed up my first post with a second: The Poissonness plot: A goodness-of-fit diagnostic

in which I present a graphical diagnostic plot that is an alternative to using a Q-Q plots.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-04-2012 05:55 AM

I explain the details of my answer and give an example (which includes PGStats's suggestion) on my blog in the article "Fitting a Poisson Distribution to Data in SAS."

The same approach should work for other discrete distributions such as negative binomial and geometric distributions.

Rick