Programming the statistical procedures from SAS

Is SAS telling something about V matrix in PROC MIXED?

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 7
Accepted Solution

Is SAS telling something about V matrix in PROC MIXED?

Hi SAS Community,

 

I've got a non-positive definite G matrix. It is said that the estimates of fixed effects are still valid  if the marginal covariance matrix V is positive definite. Unfortunately, I can't find anywhere if SAS system will tell me about it or will stop (it is telling only about G and R matrices and about infinite likelihood but not about the general matrix V). I though about saving  the matrix with "ods output" and check somehow if it is positive definite but this is a block diagonal matrix and I have to write that I want 760 blocks (I have 760 subjects), since SAS shows only the blocks I am specifying. Is somebody familiar with that? Do I have to really prove V matrix or can I trust the results?

 

Darja


Accepted Solutions
Solution
‎08-16-2016 09:35 AM
Valued Guide
Valued Guide
Posts: 684

Re: Is SAS telling something about V matrix in PROC MIXED?

Posted in reply to Scarlett89

Your factor analytic structure, FA0(3), is still giving you an unstructured covaraince matrix. It is just contstraining it to be at least positive semi-definite. A valid covariance matrix must be positive semi-definite or posistive definite. It is always a very good practice to use FA0(#) or CHOL when one wants an unstructured G. BY the way, add the G and GCORR options to the RANDOM statement to get a direct display of G (in addition to the FA parameters that determine G).

 

View solution in original post


All Replies
Respected Advisor
Posts: 2,655

Re: Is SAS telling something about V matrix in PROC MIXED?

Posted in reply to Scarlett89

Can you share your output?  I suspect that you may have more random effects than are needed, and if this is the case, then the NPD of the G matrix should not be a problem--it's not like problems with the Hessian.

 

Steve Denham

Occasional Contributor
Posts: 7

Re: Is SAS telling something about V matrix in PROC MIXED?

Posted in reply to SteveDenham

Thank you very much for your answer. As random effects I have an intercept and two slopes, I can't remove any of them because it is what I have assumed in my analysis- that every subject is allowed to have random intercept and random slope. I suppose the problem is that I have somehow not enough observations after stratifying by group (one group is bigger than second and for bigger group D matrix is PD). Which part of the output or code would be helpful?

 

 

Respected Advisor
Posts: 2,655

Re: Is SAS telling something about V matrix in PROC MIXED?

Posted in reply to Scarlett89

Your PROC MIXED code, and any of the output up to and including the parameter estimates (both fixed and random), including the iteration history.

 

I think you have identified the source of the problem with an intercept and two slopes.  I would expect to need only one, but seeing your code may make this easier to understand.

 

Steve Denham

Valued Guide
Valued Guide
Posts: 684

Re: Is SAS telling something about V matrix in PROC MIXED?

Posted in reply to SteveDenham

As indicated by Steve, you usually only have to be concerned when you get a message about the Hessian being non-positive definite.

Occasional Contributor
Posts: 7

Re: Is SAS telling something about V matrix in PROC MIXED?

Posted in reply to SteveDenham

Here is my SAS Code:

 

proc mixed data=stat method=reml nobound;                                        
class id bmi_mother sex country isced troubled;
model bmi_z_score=slope_before slope_after bmi_mother sex country isced troubled/s cl ddfm=kr;             
random int slope_before slope_after/ type=un subject=id_no;
format sex sex_new. isced isc. country count. troubled tr. bmi_mother catA.;
by categ;
run;

 

I have a piecewise mixed model, so I am assuming two random slopes-slope before the event and slope after. I saved some output in Word for one group where G matrix was NPD and attached it here. I deleted the reference categories too, I hope it is ok, was not sure what I am allowed to post. The output with random slopes and intercepts is too big because I have 760 subjects, so in the document is G matrix, intercept and R, iteration history, as well as fixed effects estimates. Without stratifying, the G matrix is ok. I think the problem is that it is just not enough variability in the data or something bacause for this group I have less observations per subject. The results look good compared to the other models but I am still not sure about conclusions.

Respected Advisor
Posts: 2,655

Re: Is SAS telling something about V matrix in PROC MIXED?

Posted in reply to Scarlett89

I'm stumped as to how the G matrix is NPD, as there are estimates for every element of the covariance matrix.  I am going to suggest re-running this in PROC GLIMMIX, so that the standard errors of the covariance elements might be presented.

 

proc glimmix data=stat  nobound;                                        
class id bmi_mother sex country isced troubled;
model bmi_z_score=slope_before slope_after bmi_mother sex country isced troubled/s cl ddfm=kr2;             
random int slope_before slope_after/ type=un subject=id_no;
format sex sex_new. isced isc. country count. troubled tr. bmi_mother catA.;
by categ;
run;

If this throws the same type error, try type=chol for the covariance structure, to use a Cholesky parameterization.  This occasionally helps solve NPD problems, and if it doesn't, the values obtained should help point out the source of the near singularity.

 

Steve Denham

Occasional Contributor
Posts: 7

Re: Is SAS telling something about V matrix in PROC MIXED?

Posted in reply to SteveDenham

I think it has every estimate because I have specified nobound option, otherwise some variances are 0. The matrix in general is NPD apparently. I have to use proc mixed because it is the procedure of my master thesis but I think I have found that type=chol is the same as type=FA0(q) in proc mixed, so I have now:

 

proc mixed data=stat method=reml nobound COVTEST;                                        
class id bmi_mother sex country isced troubled;
model bmi_z_score=slope_before slope_after bmi_mother sex country isced troubled/s cl ddfm=kr;             
random int slope_before slope_after/ type=FA0(3) subject=id_no;
format sex sex_new. isced isc. country count. troubled tr. bmi_mother catA.;
by categ;
run;

 

Both groups have no warning about NPD G matrix anymore and the estimates are changed just a little bit. Does it mean that I still have estimated the unstructured matrix just with this factor-analysis (as far as I understood from the Internet) and everything is good? I am not familiar with this method unfortunately.. It took more iterations too. Could you please look on my results? I made SE as well, it is possible with COVTEST.

Solution
‎08-16-2016 09:35 AM
Valued Guide
Valued Guide
Posts: 684

Re: Is SAS telling something about V matrix in PROC MIXED?

Posted in reply to Scarlett89

Your factor analytic structure, FA0(3), is still giving you an unstructured covaraince matrix. It is just contstraining it to be at least positive semi-definite. A valid covariance matrix must be positive semi-definite or posistive definite. It is always a very good practice to use FA0(#) or CHOL when one wants an unstructured G. BY the way, add the G and GCORR options to the RANDOM statement to get a direct display of G (in addition to the FA parameters that determine G).

 

Occasional Contributor
Posts: 7

Re: Is SAS telling something about V matrix in PROC MIXED?

Thank you so much for the explanation and your help!

Respected Advisor
Posts: 2,655

Re: Is SAS telling something about V matrix in PROC MIXED?

Posted in reply to Scarlett89

Please mark @lvm's reply as a correct answer.

 

Steve Denham

Occasional Contributor
Posts: 7

Re: Is SAS telling something about V matrix in PROC MIXED?

Posted in reply to SteveDenham

I did but thank you so much too, you helped me with the solution!

Respected Advisor
Posts: 2,655

Re: Is SAS telling something about V matrix in PROC MIXED?

Posted in reply to Scarlett89

This looks really good--I would go with this analysis, remembering that the variance estimates are the factor analytic estimates, and not the values in the G matrix.  Follow @lvm's advice and add G and GCORR to the RANDOM statement.  And pay no attention to the Z test probability values you get from the COVTEST option--you are right in using it to get standard errors.

 

Steve Denham

Occasional Contributor
Posts: 7

Re: Is SAS telling something about V matrix in PROC MIXED?

Posted in reply to SteveDenham

The very last question for understanding. So, basically, SAS do not say anything about V matrix in general and I have to search for different solutions in these situations? It just seems strange that SAS check the positive definiteness of G and R matrices but not the V matrix.

Respected Advisor
Posts: 2,655

Re: Is SAS telling something about V matrix in PROC MIXED?

Posted in reply to Scarlett89

A quick look back at theory says ZGZ' R.  Thus, we know everything we need to know about V once we know and R, as Z is a design matrix.  If either or R has problems, then we know V will have the same problem, unless there is the very rare case where the matixes exactly offset.  It is why you should always get a look at both of these, using the G or R options.

 

Steve Denham

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 15 replies
  • 695 views
  • 8 likes
  • 4 in conversation