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
- /
- Determining goodness of fit to geometric distribut...

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

07-21-2016 02:32 PM

Hello,

I have a dataset that looks like this:

data geometric;

input observation freq;

datalines;

1 2

2 0

3 1

4 3

5 4

6 7

etc......

;

I am trying to determine if my data fits a geometric distribution versus a poisson distribution.

Any help or suggestions would be greatly appreciated!

Thank you,

Michelle

Accepted Solutions

Solution

07-22-2016
01:12 PM

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

07-21-2016 03:47 PM

There are several ways to do this. In general, you will need two runs, one for Poisson and one for geometric distribution, and then compare the -2 log-likelihoods. I demonstrate with PROC GLIMMIX, with my example code.

```
data a;
input x count;
datalines;
0 10
1 16
2 14
3 21
4 17
5 16
6 13
7 13
8 10
9 6
10 5
11 1
12 2
;
run;
proc glimmix data=a;
title 'Poisson';
model x = / dist=poisson s;
freq count;
run;
proc glimmix data=a;
title 'Geometric';
model x = / dist=geometric s;
freq count;
run;
proc glimmix data=a;
title 'Negative Binomial';
model x = / dist=nb s;
freq count;
run;
*another way to get geometric (neg bin with scale=1);
proc glimmix data=a;
title 'Neg.Bin. with Scale=1 (identical to Geometric)';
model x = / dist=nb s;
freq count;
parms (1) / hold=1; *hold Scale to 1 to get geometric;
run;
```

Note that Poisson and geometric are 1-parameter distributions, so one can directly compare the -2LL values in the output. I also show the fit of the negative binomial, which is a two-parameter distribution which reduces to the Poisson as the Scale goes to 0 (the way GLIMMIX parameterizes it). I bring it up because another special case of the negative binomial is the geometric (when the neg bin Scale = 1). So, I show how to fit this in GLIMMIX also. Note that the results are identical for dist=geometric and dist=nb with the parms (1) statement (last one).

Because negative binomial has two parameters, use AIC to compare fits of different distributions. one can also use other aspects of the fit (e.g., Pearson chi-square) for comparisons, but I won't get into that.

There are other programs that could also be used.

All Replies

Solution

07-22-2016
01:12 PM

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

07-21-2016 03:47 PM

There are several ways to do this. In general, you will need two runs, one for Poisson and one for geometric distribution, and then compare the -2 log-likelihoods. I demonstrate with PROC GLIMMIX, with my example code.

```
data a;
input x count;
datalines;
0 10
1 16
2 14
3 21
4 17
5 16
6 13
7 13
8 10
9 6
10 5
11 1
12 2
;
run;
proc glimmix data=a;
title 'Poisson';
model x = / dist=poisson s;
freq count;
run;
proc glimmix data=a;
title 'Geometric';
model x = / dist=geometric s;
freq count;
run;
proc glimmix data=a;
title 'Negative Binomial';
model x = / dist=nb s;
freq count;
run;
*another way to get geometric (neg bin with scale=1);
proc glimmix data=a;
title 'Neg.Bin. with Scale=1 (identical to Geometric)';
model x = / dist=nb s;
freq count;
parms (1) / hold=1; *hold Scale to 1 to get geometric;
run;
```

Note that Poisson and geometric are 1-parameter distributions, so one can directly compare the -2LL values in the output. I also show the fit of the negative binomial, which is a two-parameter distribution which reduces to the Poisson as the Scale goes to 0 (the way GLIMMIX parameterizes it). I bring it up because another special case of the negative binomial is the geometric (when the neg bin Scale = 1). So, I show how to fit this in GLIMMIX also. Note that the results are identical for dist=geometric and dist=nb with the parms (1) statement (last one).

Because negative binomial has two parameters, use AIC to compare fits of different distributions. one can also use other aspects of the fit (e.g., Pearson chi-square) for comparisons, but I won't get into that.

There are other programs that could also be used.

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

07-21-2016 08:56 PM

Here are an example for Rick's blog:

http://blogs.sas.com/content/iml/2012/04/12/the-poissonness-plot-a-goodness-of-fit-diagnostic.html

http://blogs.sas.com/content/iml/2012/04/04/fitting-a-poisson-distribution-to-data-in-sas.html

I think maybe you could produce empirical quantile and theory quantile and use Chisq Distribution to compare them ?

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

07-21-2016 09:35 PM

Hmm, Interesting. RPOC GENMOD also can do that . proc genmod data=a; title 'Poisson'; model x = / dist=poisson ; freq count; run; proc genmod data=a; title 'Geometric'; model x = / dist=geometric ; freq count; run;

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

07-22-2016 09:19 AM

This is just what I needed, thank you!

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

07-22-2016 10:48 AM

Glad it worked. You could indicate on the website that this was a Solution.