Error "Unable to invert xtx."

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
MForseth
Posts: 6
Joined: Fri Jun 21, 2024 9:12 am

Error "Unable to invert xtx."

Post by MForseth »

Hi
I have run a multinomial model in Stata via runmlwin. The model runs fine, but I was hoping to get some confidence intervals, but when I run the command below after the model, I get the following error message: "error while obeying batch file C/... at line number 1973: MCMC 0 1 1 5.8 50 10 G27[2] 2 2 2 1 1 6 Unable to invert xtx."
Why does this error occur?

runmlwin iscore cons hybridnum _Itempcat* hybridtempint* rain temprainint*, ////
level3(id_farm: cons) ////
level2(flock_id: cons) ////
level1(idvar) ////
discrete(dist(multinomial) link(mlogit) denom(cons) basecategory(0)) ////
nopause igls rrr maxiterations(50)


runmlwin iscore cons hybridnum _Itempcat* hybridtempint* rain temprainint*, ////
level3(id_farm: cons) ////
level2(flock_id: cons) ////
level1(idvar) ////
discrete(dist(multinomial) link(mlogit) denom(cons) basecategory(0)) ////
mcmc(burnin(1) chain(10) on) rrr initsprevious nopause

Best regards,
Merete
ChrisCharlton
Posts: 1384
Joined: Mon Oct 19, 2009 10:34 am

Re: Error "Unable to invert xtx."

Post by ChrisCharlton »

It's hard to say what exactly is causing this error without seeing the data. It could be something like there being colinear variables in the model, or you might have categorical variables where no data is present for a particular category value.

In order to work out what might be going on I would suggest:
  • Check the starting values used for the MCMC model. Any starting matrices need to be invertible.
  • Start with the simplest model possible and then build up to your desired version. This should indicate at what point the problem occurs.
  • Run the model without the nopause option, and then examine the the model and its structure within MLwiN. This will help to ensure that the model being fitted is what you expect.
MForseth
Posts: 6
Joined: Fri Jun 21, 2024 9:12 am

Re: Error "Unable to invert xtx."

Post by MForseth »

Thank you so much for your reply.
We have now made sure that all the starting values are invertible. When we run the model without the option "nopause", we can see that the model runs in MLwiN, however, the results are not displayed in Stata.
How should we continue to get the data exported to Stata?
ChrisCharlton
Posts: 1384
Joined: Mon Oct 19, 2009 10:34 am

Re: Error "Unable to invert xtx."

Post by ChrisCharlton »

If you run the model without the nopause option then MLwiN will pause at various points to allow you to inspect the model/data. You can can then resume it by clicking "Resume macro" on the toolbar. Once you have got through all the points that it pauses the results will be sent to Stata. When you are happy that the model is working as desired you can restore the nopause option to your command and it will behave as before.
MForseth
Posts: 6
Joined: Fri Jun 21, 2024 9:12 am

Re: Error "Unable to invert xtx."

Post by MForseth »

Now I got the results in Stata. Thank you so much, again, for your help!
Post Reply