Hi,
I have a question about a comparison of two groups of data, which are small count. The following are the code. However, when I fit the model, the "contrast" p-value cannot be calculated. And SAS always give me the warning:
WARNING: The negative of the Hessian is not positive definite. The convergence is questionable.
WARNING: The procedure is continuing but the validity of the model fit is questionable.
WARNING: The specified model did not converge.
WARNING: Negative of Hessian not positive definite.
Is there any problem with my code? The following is the data and the code:
data test;
input diet total;
cards;
1 1
1 0
1 1
1 1
1 2
1 0
1 0
1 4
1 1
1 1
1 1
1 3
1 1
1 3
1 0
1 3
1 1
1 3
1 1
2 3
2 2
2 2
2 2
2 4
2 1
2 3
2 4
2 1
2 3
2 0
2 5
2 2
2 6
2 2
2 1
2 2
2 2
2 2
2 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
3 0
4 4
4 5
4 4
4 3
4 4
4 7
4 4
4 3
4 2
4 4
4 1
4 2
4 2
4 3
4 4
4 0
4 2
4 5
;
proc genmod data=test;
class diet;
model total=diet / dist=poisson link=log;
contrast 'group, 1 vs. 2' diet 1 -1 0 0;
contrast 'group, 1 vs. 3' diet 1 0 -1 0;
contrast 'group, 1 vs. 4' diet 1 0 0 -1;
run;
I think you have a problem with nearly complete quasi-separation. For diet=3, all observations are zeroes, so the optimization fails. PROC GLIMMIX is a little more robust, so you could try:
proc glimmix data=test;
class diet;
model total=diet / dist=poisson link=log solution;
contrast 'group, 1 vs. 2' diet 1 -1 0 0;
contrast 'group, 1 vs. 3' diet 1 0 -1 0;
contrast 'group, 1 vs. 4' diet 1 0 0 -1;
run;
Hope this helps.
Steve Denham
Thanks Steve! It works.
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.
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.