turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Is SAS telling something about V matrix in PROC MI...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

08-15-2016 04:38 AM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Scarlett89

08-16-2016 09:21 AM

All Replies

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Scarlett89

08-15-2016 11:34 AM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to SteveDenham

08-15-2016 11:51 AM

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?

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Scarlett89

08-15-2016 12:51 PM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to SteveDenham

08-15-2016 03:06 PM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to SteveDenham

08-16-2016 03:36 AM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Scarlett89

08-16-2016 08:03 AM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to SteveDenham

08-16-2016 09:13 AM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Scarlett89

08-16-2016 09:21 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

08-16-2016 09:31 AM

Thank you so much for the explanation and your help!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Scarlett89

08-16-2016 09:33 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to SteveDenham

08-16-2016 09:38 AM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Scarlett89

08-16-2016 09:39 AM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to SteveDenham

08-16-2016 09:48 AM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Scarlett89

08-24-2016 07:12 AM

A quick look back at theory says **V **= **ZGZ' **+ **R**. Thus, we know everything we need to know about **V** once we know **G **and **R**, as **Z** is a design matrix. If either **G **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