- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Dave,
Yes, I noticed there was no difference in results. Thanks again for all your help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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?