BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
JatinRai
Obsidian | Level 7

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

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

View solution in original post

10 REPLIES 10
SteveDenham
Jade | Level 19

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

Steve Denham

JatinRai
Obsidian | Level 7

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

Rick_SAS
SAS Super FREQ

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

SteveDenham
Jade | Level 19

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

Rick_SAS
SAS Super FREQ

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

PGStats
Opal | Level 21

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
Rick_SAS
SAS Super FREQ

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.

JatinRai
Obsidian | Level 7

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

Rick_SAS
SAS Super FREQ

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.

Rick_SAS
SAS Super FREQ

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 10 replies
  • 11185 views
  • 5 likes
  • 4 in conversation