Fluorite | Level 6

proc glimmix for count data model fit assessment

I'm conducting a difference-in-difference analysis to assess the impact of an intervention on violent crime.My outcome is violent crime, inputted as a count that is converted to a rate via an offset of (ln of population years) to account for a changing population over time.

I want to asses whether my count outcome data are overdispersed to confirm that I am appropriately using a negative binomial distribution. I'm using proc glimmix (SAS 9.4). I read about using the standard "Gener. Chi-Square/DF" output to determine whether data are overdispersed, with a value closer to 1.0 showing that the data are not overdispersed; but I was cautioned not to use this calculation to determine whether I should use a negative binomial model instead of a Poisson model.

I have been advised to assess whether my outcome data are overdispersed by dividing the residual deviance by the predicted mean. Is there SAS code I can add to my glimmix model to calculate this? Here is my present code for a difference-in-difference model with a negative binomial distribution.

proc glimmix data=main.simple_model;
class tract post (ref='0') exposed (ref='0');
model totcrime = post exposed post*exposed covariates/
solution
dist = negbin
offset = logpopyrs
cl;
random int/subject=tract type=un s;
covtest 'var(tract)=0' . 0;
run;

Would another possibility be to run the model as a Poisson model and then a negative binomial model and do a likelihood ratio test?

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: proc glimmix for count data model fit assessment

You might try adding PLOTS=pearsonpanel(conditional marginal) to the PROC GLIMMIX statement.  Not sure that is what you are going after but it will produce plots of the Pearson residuals versus the predicted values, both conditional and marginal.

You can also use the OUTPUT statement for something like:

`output out=out1 pred(/* choose what predicted value you want*/)=predicted                 pearson/* choose what predicted value you want, but make sure it is the same as for the predicted value*/) =pearson;`

That ought to give you a similar dataset where you could use PROC SGPLOT.

SteveDenham

4 REPLIES 4

Re: proc glimmix for count data model fit assessment

The link gives an R approach to answering the question using a likelihood ratio test: https://www.statology.org/negative-binomial-vs-poisson/  To accomplish the same thing in SAS, use the converged log likelihood value from the two choices. The difference should be distributed as a chi-squared variate with a single degree of freedom.  But the big thing that is in this website is "LOOK AT THE RESIDUALS GRAPHICALLY".  Over or underdispersion to the degree that inferences may be affected should be readily apparent from a plot of residuals vs. predicted values.

SteveDenham

Fluorite | Level 6

Re: proc glimmix for count data model fit assessment

When I used proc genmod for another project I used the code:

output out=residuals
stdreschi = Stdreschi;
Proc plot data=residuals;
plot stdreschi*time_yrs_t;
run;

This code doesn't seem to be available for/work in proc glimmix. Do you know of code with me that will enable proc glimmix to output the residuals and predicted values so that I can plot them?

Re: proc glimmix for count data model fit assessment

You might try adding PLOTS=pearsonpanel(conditional marginal) to the PROC GLIMMIX statement.  Not sure that is what you are going after but it will produce plots of the Pearson residuals versus the predicted values, both conditional and marginal.

You can also use the OUTPUT statement for something like:

`output out=out1 pred(/* choose what predicted value you want*/)=predicted                 pearson/* choose what predicted value you want, but make sure it is the same as for the predicted value*/) =pearson;`

That ought to give you a similar dataset where you could use PROC SGPLOT.

SteveDenham

Fluorite | Level 6

Re: proc glimmix for count data model fit assessment

This has all been very helpful Steve! Thank you!

Discussion stats
• 4 replies
• 678 views
• 2 likes
• 2 in conversation