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

Hello SAS Community,

 

I am trying to model a count event that occurs in different states over time. I believe the appropriate model is a generalized linear mixed model with Poisson distribution (using proc mixed or glimmix). Below is an arbitrary dataset and the code I wrote. I just need input on the best way to model this information. Thank you!

Data

state year count_event population
AL 2010 2 20010
AL 2011 4 20399
AL 2012 8 20589
AR 2010 5 40322
AR 2012 8 43222
CA 2010 19 64032
CA 2011 32 68004
CA 2012 34 69333

 

Code

proc glimmix data = dsn;
class year state;
model count_event = year state / dist = poisson solution offset = newvar; /*Note: newvar = log(population)*/
random int / subject = state;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
doctortimi
Obsidian | Level 7

Thank you for the clarification. I just ran this code. Added the "repeated subject = state" portion.

 

proc genmod data = dsn1;
class dyr state;
model cohort_sample_size/population_size = dyr state / dist = binomial type3;
repeated subject = state /type = ar within = dyr;
run;

 

 

View solution in original post

4 REPLIES 4
StatDave
SAS Super FREQ

Your data appears to be binomial with observed probabilities event_count/population. A random effects model in PROC GLIMMIX is one modeling approach you can use. Another is a GEE model in PROC GEE or PROC GENMOD. Here is an example using an AR correlation structure, but you could select a different one.

 

proc genmod data = dsn;
class year state;
model count_event/population = year state / dist = binomial;
repeated state / type=ar within=year;
run;
doctortimi
Obsidian | Level 7

Thank you for your response, StatDave_sas. So with your approach, there is no need for an offset? 

StatDave
SAS Super FREQ

Right...  "/population" on the response side takes care of it. 

doctortimi
Obsidian | Level 7

Thank you for the clarification. I just ran this code. Added the "repeated subject = state" portion.

 

proc genmod data = dsn1;
class dyr state;
model cohort_sample_size/population_size = dyr state / dist = binomial type3;
repeated subject = state /type = ar within = dyr;
run;

 

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 4 replies
  • 2903 views
  • 0 likes
  • 2 in conversation