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
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.
Use the ConvergenceStatus table. For a discussion and example, see "Monitor convergence during simulation studies in SAS," especially the section "The ConvergenceStatus table".
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
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.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.