Programming the statistical procedures from SAS

Proc genmod GEE with error message

Reply
Contributor
Posts: 62

Proc genmod GEE with error message

Hello,

 

I want to run a Proc genmod GEE on data eq after impute the missing data with EM method. My dependent variable is the binary data y with different visits (1-6) and the independent variables include age, sex, numeric data x, for example. I found that with either low percentage or high percentage of y=1, I will get the following error:

 

WARNING: The generalized Hessian matrix is not positive definite. Iteration will be terminated.
ERROR: Error in parameter estimate covariance computation.
ERROR: Error in estimation routine.

 

And some warning message from output like:

--------------------------------------- Imputation Number=1 ---------------------------------------

WARNING: The generalized Hessian matrix is not positive definite. Iteration will be terminated.

 

my question is:

How could I find which data generated with "The generalized Hessian matrix is not positive definite" and how to output them or remove them? Since my data more 20000 ID, I can not go though the log to find them and do research for the pattern

data eq;
input ID y1 y2 y3 y4 y5 y6 x1 x2 x3 x4 x5 x6 sex age;
cards;
1 1 0 . 1 1 1 27 40 8 23 45 19 1 1 15
2 1 . 1 1 . 1 . 29 37 30 . 25 1 25
3 0 1 1 1 1 . 30 . 25 . 27 . 0 32
4 1 . 1 . 1 1 38 38 23 13 45 . 1 16
;
run;


%macro mi(in_data);
/*PROC MI EM*/
proc mi data = &in_data nimpute=&n_imp seed= &&my_seed&i out=MI_results;;
   em itprint ; 
   var y1 y2 y3 y4 y5 y6 x1 x2 x3 x4 x5 x6 sex age;
run;

	data MI_results1;
set MI_results;
y_me=y1;
x_me=x1;
visit=1;
output;
y_me=y2;
x_me=x2;
visit=2;
output;
y_me=y3;
x_me=x3;
visit=3;
output;
y_me=y4;
x_me=x4;
visit=4;
output;
y_me=y5;
x_me=x5;
visit=5;
output;
y_me=y6;
x_me=x6;
visit=6;
output;
drop y1 y2 y3 y4 y5 y6 x1 x2 x3 x4 x5 x6;
run;

Data MI_results3;
Set MI_results1;
IF y_me ^= 0  & y_me ^= 1 THEN y_me1 =round(exp(y_me)/(1+EXP(y_me)),0.1);
else y_me1=y_me;
run;

Data MI_results2;
Set MI_results3;
IF y_me1 > 0.5 THEN y_me2 =1;
ELSE y_me2 =0;
run;
/*PROC GENMOD GEE*/
	proc genmod data = MI_results2;
		class sex(ref='0') id;
  		model y_me2= x_me sex age/ dist=bin link=logit covb;
		repeated subject=id / type=ar(1) PRINTMLE;
      	by _Imputation_;
      	ODS output GEEEmpPEst=lgsparms
                   CovB=lgscovb;
    run;
/*PROC MI ANALYZE*/
	proc mianalyze parms=lgsparms;                
         modeleffects Intercept x_me age sex;
		 ods output ParameterEstimates=POOL_parms_tem;
    run;
/*COMBINE 1000 times SIMULATION, OUTPUT dataset POOL_parms*/
	data POOL_parms_tem;
		set POOL_parms_tem;
		index = &i;
		keep NImpute index Parm Estimate StdErr;
	run;
	%if &i=1 %then %do;
	data POOL_parms POOL_parms_old POOL_parms_tem;
		set POOL_parms_tem;
		index = &i;
		keep NImpute index Parm Estimate StdErr;
	run;
	%end;
	%else %if &i>1 %then %do;
	data POOL_parms;set POOL_parms_old POOL_parms_tem;run;
	data POOL_parms_old;set POOL_parms;run;
	%end;
%mend mi;

%macro try(in_data,n_imp,in_seed,n_boot);
	data seed_long(drop=i);
  		call streaminit(&in_seed);
  		do i = 1 to &n_boot;
    		x_seed = floor(rand("Uniform")*500000); output;
  		end;
	run;

 	data _null_;
 		set seed_long;
 		call symput('my_seed'|| compress(put(_n_,4.)), x_seed);
 	run;

   %let i=1;
   %do %until (&i>&n_boot) ;
	  %mi(&in_data)
      %let i = %eval(&i+1);
   %end;
%mend try;

%try(eq,21,34534,10);

.

 

If possible, how to solve the problem?

 

Thanks

Ask a Question
Discussion stats
  • 0 replies
  • 112 views
  • 0 likes
  • 1 in conversation