Prior variance matrix is not positive definite

Welcome to the forum for runmlwin users. Feel free to post your question about runmlwin here. The Centre for Multilevel Modelling take no responsibility for the accuracy of these posts, we are unable to monitor them closely. Do go ahead and post your question and thank you in advance if you find the time to post any answers!

Go to runmlwin: Running MLwiN from within Stata >> http://www.bristol.ac.uk/cmm/software/runmlwin/
Post Reply
ginamartin
Posts: 7
Joined: Thu Nov 03, 2016 12:06 pm

Prior variance matrix is not positive definite

Post by ginamartin »

Hi Everyone,

I am trying to run a 2-level logistic model using runmlwin with a random intercepts, a random slope, and a cross-level interaction. I would like to run an interaction using MCMC but get the error message "Prior variance matrix is not positive definite". I found the following post https://www.cmm.bristol.ac.uk/forum/viewtopic.php?t=270. But unlike the former I get 0 values for cov(cons) and var.

var(cons) 0.3062052
cov(cons,sc_neigh) 0
var(sc_neigh) 0

I am not certain whether this is an issue and whether it is appropriate to manually supply stating values given this?

Thanks so much!
Gina
GeorgeLeckie
Site Admin
Posts: 432
Joined: Fri Apr 01, 2011 2:14 pm

Re: Prior variance matrix is not positive definite

Post by GeorgeLeckie »

Dear Gina,

Sounds like your IGLS MQL/PQL model which you have fit to obtain starting values for then going on to fit the model by MCMC has given the following estimates for your level-2 random effects variance-covariance matrix

var(cons) 0.3062052
cov(cons,sc_neigh) 0
var(sc_neigh) 0

The IGLS MQL/PQL model has not worked in the sense that its estimated slope variance (and therefore intercept slope covariance) is stuck on zero. There are various reasons why this may be and it would be good for you to stare at the data and your model and think how reasonable it is to specify the random slope. Assuming it is reasonable, it may be that fitting the model by MCMC may have more success than IGLS MQL/PQL. However, the problem is that MCMC in MLwiN specifies a Wishart prior distribution variance matrix for the level-2 covariance matrix based on these IGLS MQL/PQL estimates. This prior variance matrix must be positive define (invertible if you like). So what you need to do is to modify the starting value for the slope variance to a small positive amount. You can keep the covariance at zero.

So after fitting the model by IGLS MQL/PQL first recover the parameter estimates of this model, storing them in a matrix

matrix a = e(b)

then modify the element of matrix a that corresponds to the slope variance

matrix a[1,4] = 0.1

then when you fit the MCMC version of the model, use the initsb(a) option rather than initsprevious

Best wishes

George
Post Reply