Calcite | Level 5

## Proc Mixed, G matrix warning, remove solutions from replications?

I am using SAS 9.4

I am running a proc Mixed and saving the group level residuals for analysis. I am running 1000 replications. Some of the runs result in a estimated G matrix is not positive definite. I understand why this is happening.

Questions:

1. is there a way to report how many of the replications are resulting in the 'estimated G matrix is not positive definite'?

2. is there a way to remove the resulting residual solutions for these cases from the 'solutionr' file?

Is there a way to remove the results from the fit statistics as well?

3. is there a way to continue the replications so the total is 1000 excluding those that result in the non-positive definite matrix?

here is my code (iter=replication number). :

proc mixed data=fulltestdata covtest;
by iter;
class idt idk wave;
model y = wave / noint s residual ;
random wave / sub=idt type=un g gcorr solution;
repeated wave / sub=idk(idt) type=un r rcorr;

ods graphics off; ods output fitstatistics=fit solutionr=MMtchres;
run;

Sample from the log:

NOTE: Convergence criteria met.
NOTE: The above message was for the following BY group:
iter=731
NOTE: Convergence criteria met.
NOTE: The above message was for the following BY group:
iter=732
NOTE: Convergence criteria met.
NOTE: The above message was for the following BY group:
iter=733
NOTE: Convergence criteria met.
NOTE: Estimated G matrix is not positive definite.
NOTE: The above message was for the following BY group:
iter=734
NOTE: Convergence criteria met.
NOTE: The above message was for the following BY group:
iter=735
NOTE: Convergence criteria met.
NOTE: The above message was for the following BY group:
iter=736

1 ACCEPTED SOLUTION

Accepted Solutions
SAS Super FREQ

## Re: Proc Mixed, G matrix warning, remove solutions from replications?

When you use ODS OUTPUT, it creates a SAS data set which contains "non-printing columns" for the table.

In particular, if you look at the variables in the ConvergenceStatus table (PROC CONTENTS), you will see that one of the variables is

pdG which stands for "positive definite gradient."

This is a binary indicator variable. You can use a WHERE clause such as

WHERE=(pdG = 1)

to obtain only the samples for which the gradient at the solution was positive definite.

3 REPLIES 3
SAS Super FREQ

## Re: Proc Mixed, G matrix warning, remove solutions from replications?

Use the ConvergenceStatus table. For a discussion and example, see "Monitor convergence during simulation studies in SAS," especially the section "The ConvergenceStatus table".

Calcite | Level 5

## Re: Proc Mixed, G matrix warning, remove solutions from replications?

Thanks. The model did converge so the Convergence status table with reasons doesn't help.

The log:

222
223 proc mixed data=fulltestdata covtest;
224 by iter;
225 class idt idk wave;
226 model y = wave / noint s residual ;
227 random wave / sub=idt type=un g gcorr solution;
228 repeated wave / sub=idk(idt) type=un r rcorr;
229
230 ods graphics off; ods output fitstatistics=fit solutionr=MMtchres ConvergenceStatus=CS;
231 run;

NOTE: Convergence criteria met.
NOTE: Estimated G matrix is not positive definite.
NOTE: The above message was for the following BY group:
iter=1
NOTE: Convergence criteria met.
NOTE: Estimated G matrix is not positive definite.
NOTE: The above message was for the following BY group:
iter=2
NOTE: The data set WORK.CS has 2 observations and 5 variables.
NOTE: The data set WORK.MMTCHRES has 90 observations and 9 variables.
NOTE: The data set WORK.FIT has 8 observations and 3 variables.
NOTE: PROCEDURE MIXED used (Total process time):
real time 0.64 seconds
cpu time 0.61 seconds

SAS Super FREQ

## Re: Proc Mixed, G matrix warning, remove solutions from replications?

When you use ODS OUTPUT, it creates a SAS data set which contains "non-printing columns" for the table.

In particular, if you look at the variables in the ConvergenceStatus table (PROC CONTENTS), you will see that one of the variables is

pdG which stands for "positive definite gradient."

This is a binary indicator variable. You can use a WHERE clause such as

WHERE=(pdG = 1)

to obtain only the samples for which the gradient at the solution was positive definite.

Discussion stats
• 3 replies
• 728 views
• 1 like
• 2 in conversation