Error when fitting a multinomial logit regression with panel data

 Posts: 1250
 Joined: Mon Oct 19, 2009 10:34 am
Re: Error when fitting a multinomial logit regression with panel data
It looks like the model in the equation screenshot has failed to run (likely due to numeric issues) as it is showing no cases in use and a covariance matrix consisting only of zeros. Were you starting MCMC after the MQL1 or PQL2 model estimation? The new MCMC error message is indicating that the prior matrix being used is not positivedefinite, so you may need to adjust the starting values before beginning the MCMC estimation.

 Posts: 12
 Joined: Thu Oct 15, 2020 2:17 pm
Re: Error when fitting a multinomial logit regression with panel data
Hi Chris,
After several attempts to adjust the starting values manually (as suggested here http://www.bristol.ac.uk/cmm/software/s ... rrors.html) before beginning the MCMC estimation, which did not help at all, I ran the model using RIGLS estimation then switched to MCMC and it worked! Basically I started with IGLS, then switched to RIGLS and finally to MCMC. But not sure how this process affects my overall results? Any concerns/thoughts please?
Re your question whether I was starting MCMC after the MQL1 or PQL2 model estimation, I always started the model with IGLS MQL1 (because PQL2 did not work as I posted previously), tried to switched to PQL2 or MCMC but failed. I also started the model using RIGLS, tried to switched to PQL2 or MCMC, but failed. The only way worked is as follows: IGLS MQL1 > RIGLS MQL1 > MCMC
After several attempts to adjust the starting values manually (as suggested here http://www.bristol.ac.uk/cmm/software/s ... rrors.html) before beginning the MCMC estimation, which did not help at all, I ran the model using RIGLS estimation then switched to MCMC and it worked! Basically I started with IGLS, then switched to RIGLS and finally to MCMC. But not sure how this process affects my overall results? Any concerns/thoughts please?
Re your question whether I was starting MCMC after the MQL1 or PQL2 model estimation, I always started the model with IGLS MQL1 (because PQL2 did not work as I posted previously), tried to switched to PQL2 or MCMC but failed. I also started the model using RIGLS, tried to switched to PQL2 or MCMC, but failed. The only way worked is as follows: IGLS MQL1 > RIGLS MQL1 > MCMC
Re: Error when fitting a multinomial logit regression with panel data
Hi FerhatTura,
Chris passed on your query to me but I am not sure how much extra help I can be. Essentially to run the model in MCMC you first need to ensure that the starting values are plausible i.e. that variances are positive and that any covariance matrix is positive definite (essentially that it doesn't contain correlations outside of 1,1). Hence the suggestions in the manual. My only guess is that the starting values from the RIGLS fit were in fact plausible (more luck than judgement). It is worth knowing that MCMC methods are more complicated and depend on prior distributions which MLwiN will show you particularly if you press the + button on the equations window. In some models the prior distributions are ascribed from the starting values i.e. covariance matrices have an inverseWishart prior which contains a parameter which is effectively a prior guess for the matrix (and which MLwiN uses the starting values for).
The equations window in your original post to Chris look very odd with the 0 of 2066 cases used so it might be good to either send us the worksheet or include what the equations window from RIGLS and indeed from MCMC when it runs looks like.
Best wishes,
Bill.
Chris passed on your query to me but I am not sure how much extra help I can be. Essentially to run the model in MCMC you first need to ensure that the starting values are plausible i.e. that variances are positive and that any covariance matrix is positive definite (essentially that it doesn't contain correlations outside of 1,1). Hence the suggestions in the manual. My only guess is that the starting values from the RIGLS fit were in fact plausible (more luck than judgement). It is worth knowing that MCMC methods are more complicated and depend on prior distributions which MLwiN will show you particularly if you press the + button on the equations window. In some models the prior distributions are ascribed from the starting values i.e. covariance matrices have an inverseWishart prior which contains a parameter which is effectively a prior guess for the matrix (and which MLwiN uses the starting values for).
The equations window in your original post to Chris look very odd with the 0 of 2066 cases used so it might be good to either send us the worksheet or include what the equations window from RIGLS and indeed from MCMC when it runs looks like.
Best wishes,
Bill.

 Posts: 12
 Joined: Thu Oct 15, 2020 2:17 pm
Re: Error when fitting a multinomial logit regression with panel data
Hi Bill,
Thank you very much for your reply and the reminder about the requirements for the MCMC estimation. Yes, I am aware of the suggestions in the manual but had failed to sort the problem out even if I checked my data for several times and tried several solutions suggested here on the forum and on http://www.bristol.ac.uk/cmm/software/s ... rrors.html.
However, after doing some extra search, I have found a suggestion by Kelvyn Jones (please https://www.researchgate.net/post/Multi ... edefinite) which fixed the problem at last. I hope Kelvyn's suggestion works for everyone having the same problem in the future. I also suggest this solution by Chris (https://www.cmm.bris.ac.uk/forum/viewtopic.php?t=1253) to anyone who has issues with Priors.
I really appreciate all your replies/suggestions/comments.
Kind regards,
Ferhat
Thank you very much for your reply and the reminder about the requirements for the MCMC estimation. Yes, I am aware of the suggestions in the manual but had failed to sort the problem out even if I checked my data for several times and tried several solutions suggested here on the forum and on http://www.bristol.ac.uk/cmm/software/s ... rrors.html.
However, after doing some extra search, I have found a suggestion by Kelvyn Jones (please https://www.researchgate.net/post/Multi ... edefinite) which fixed the problem at last. I hope Kelvyn's suggestion works for everyone having the same problem in the future. I also suggest this solution by Chris (https://www.cmm.bris.ac.uk/forum/viewtopic.php?t=1253) to anyone who has issues with Priors.
I really appreciate all your replies/suggestions/comments.
Kind regards,
Ferhat
Re: Error when fitting a multinomial logit regression with panel data
Hi Ferhat,
Looking at your variance matrix ALL elements were 0 this means you need to make the matrix positive definite. I think in other places I have suggested making sure the offdiagonal values are 0 which will ensure all correlations are 0 HOWEVER you do need to have all the elements on the diagonal i.e. the variances to be positive. I would suggest here maybe using say 1 for the elements on the diagonal. All that said the other numbers on the equations window shot look weird too  fixed effects crazily big and N = 0 so clearly something else is wrong with your model set up to end up with 0 cases being used!
Best wishes,
Bill.
Looking at your variance matrix ALL elements were 0 this means you need to make the matrix positive definite. I think in other places I have suggested making sure the offdiagonal values are 0 which will ensure all correlations are 0 HOWEVER you do need to have all the elements on the diagonal i.e. the variances to be positive. I would suggest here maybe using say 1 for the elements on the diagonal. All that said the other numbers on the equations window shot look weird too  fixed effects crazily big and N = 0 so clearly something else is wrong with your model set up to end up with 0 cases being used!
Best wishes,
Bill.

 Posts: 12
 Joined: Thu Oct 15, 2020 2:17 pm
Re: Error when fitting a multinomial logit regression with panel data
Hi Bill,
Thanks for your reply. I got that screenshot after running the model first using IGLS MQL1, then switching to IGLS PQL2 estimation (so those results were from PQL2 estimation). Now, before running the MCMC estimation, I did what Kelvyn suggested. Namely, I first ran the model using IGLS MQL1, did what Kelyn suggested to be able to switch to MCMC estimation and it worked. I am more than happy to send the worksheet if you don't mind having a look at it? Please advise.
Best wishes
Ferhat
Thanks for your reply. I got that screenshot after running the model first using IGLS MQL1, then switching to IGLS PQL2 estimation (so those results were from PQL2 estimation). Now, before running the MCMC estimation, I did what Kelvyn suggested. Namely, I first ran the model using IGLS MQL1, did what Kelyn suggested to be able to switch to MCMC estimation and it worked. I am more than happy to send the worksheet if you don't mind having a look at it? Please advise.
Best wishes
Ferhat
Re: Error when fitting a multinomial logit regression with panel data
Hi Ferhat,
Happy to take a quick look if you send me the worksheet (william.browne@bristol.ac.uk). We are running a workshop this week so may not be able to get back immediately.
Bill.
Happy to take a quick look if you send me the worksheet (william.browne@bristol.ac.uk). We are running a workshop this week so may not be able to get back immediately.
Bill.