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
Prior variance matrix is not positive definite
-
- Posts: 7
- Joined: Thu Nov 03, 2016 12:06 pm
-
- Site Admin
- Posts: 432
- Joined: Fri Apr 01, 2011 2:14 pm
Re: Prior variance matrix is not positive definite
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
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