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

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

1 ACCEPTED SOLUTION

Accepted Solutions
StatDave
SAS Super FREQ

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

8 REPLIES 8
StatDave
SAS Super FREQ

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.  

BTAinRVA
Quartz | Level 8

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?

StatDave
SAS Super FREQ

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.

BTAinRVA
Quartz | Level 8

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?

BTAinRVA
Quartz | Level 8

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;

StatDave
SAS Super FREQ

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.

BTAinRVA
Quartz | Level 8

Dave,

 

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

BTAinRVA
Quartz | Level 8

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?

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
  • 8 replies
  • 5134 views
  • 1 like
  • 2 in conversation