Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Analytics
- /
- Stat Procs
- /
- proc glimmix for count data model fit assessment

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

☑ This topic is **solved**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 10-13-2022 10:56 AM
(605 views)

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

link = log

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Thank you Steve.This is helpful.

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?

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

This has all been very helpful Steve! Thank you!

**Don't miss out on SAS Innovate - Register now for the FREE Livestream!**

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

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.