BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
avanwie
Calcite | Level 5

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
Rick_SAS
SAS Super FREQ

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.

View solution in original post

3 REPLIES 3
Rick_SAS
SAS Super FREQ

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

avanwie
Calcite | Level 5

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

 

Screen Shot 2019-03-24 at 11.02.54 AM.png

Rick_SAS
SAS Super FREQ

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.

sas-innovate-2024.png

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.

 

Register now!

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.

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