Programming the statistical procedures from SAS

Poisson Means Test

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 126
Accepted Solution

Poisson Means Test

I want to compare the count of events between two years to see if they are statistically significantly different. Does SAS have anything similar to what's on this web site:

 

http://www.evanmiller.org/ab-testing/poisson-means.html#

 

 

Thanks,

 

Brian


Accepted Solutions
Solution
‎09-25-2015 06:23 AM
SAS Employee
Posts: 245

Re: Poisson Means Test

An offset is only needed when the counts arise from differing amounts of exposure.  As you've no doubt seen, the test is not affected by using an offset when the exposures are the same.  The only difference in results comes in the LSMEANS where it is simply a choice of whether you want to estimate the mean count or the rate per day.

View solution in original post


All Replies
SAS Employee
Posts: 245

Re: Poisson Means Test

This can be easily done in PROC GENMOD.  For example, 

 

proc genmod;

class year;

model count = year / dist=poisson;

run;

 

The test you want is the test of the YEAR parameter.  

Frequent Contributor
Posts: 126

Re: Poisson Means Test

Dave,

 

Thanks for the quick reply!

 

So this is what I submitted:

 

data stents;

input c year;

datalines;

2216 2012

2533 2014

;

proc genmod;

class year;

model c = year / dist=poisson;

run;

 

and the results give me a Wald Chi-Square of 21.13 for year 2012 (P-value < 0.0001). Does this mean there is a significant difference between years? Also, should I be concerned that, in the Criteria for Assessing Goodness of Fit table, the Deviance, Scaled deviance, Pearson Chi-Square, and Scaled pearson X2 values are all 0?

SAS Employee
Posts: 245

Re: Poisson Means Test

Yes, small p-values indicate significance.  The zeros occur because this is a saturated model (all degrees of freedom used in the model) and is not a problem.

Frequent Contributor
Posts: 126

Re: Poisson Means Test

Dave,

 

Thanks for enlightening me!

 

I was looking at this example here: http://support.sas.com/kb/37/344.html

 

Would it make sense for me to include Log(n) offset in Proc GenMod?

Frequent Contributor
Posts: 126

Re: Poisson Means Test

For example:

 

data stents;

input Days Count year;

ln = log(Days);

ObsRate=Count/Days;

datalines;

365 2216 2012

365 2533 2014

;

 

proc genmod data=stents;

class year;

model Count=year / dist=poisson offset=ln;

estimate 'Year rate ratio' year 1 -1;

lsmeans year / diff exp cl;

store out=insmodel;

run;

Solution
‎09-25-2015 06:23 AM
SAS Employee
Posts: 245

Re: Poisson Means Test

An offset is only needed when the counts arise from differing amounts of exposure.  As you've no doubt seen, the test is not affected by using an offset when the exposures are the same.  The only difference in results comes in the LSMEANS where it is simply a choice of whether you want to estimate the mean count or the rate per day.

Frequent Contributor
Posts: 126

Re: Poisson Means Test

Dave,

 

Yes, I noticed there was no difference in results. Thanks again for all your help!

Frequent Contributor
Posts: 126

Re: Poisson Means Test

Dave,

 

One more question: in the SAS example in the previous post they do an analysis of Rate Difference using Proc NLMixed. How is this different from what GenMod is doing?

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 8 replies
  • 708 views
  • 0 likes
  • 2 in conversation