Error "Unable to invert xtx."

Welcome to the forum for MLwiN users. Feel free to post your question about MLwiN software 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!

Remember to check out our extensive software FAQs which may answer your question: http://www.bristol.ac.uk/cmm/software/s ... port-faqs/
Post Reply
MForseth
Posts: 6
Joined: Fri Jun 21, 2024 9:12 am

Error "Unable to invert xtx."

Post by MForseth »

I have built a hierarchical multinomial model, estimated in MLwiN, submitted in Stata via the runmlwin command. I would like to calculate som confidence intervals, but when I run the command below, an error message appears, saying "Unable to invert xtx.". Is there some mistake in my model causing this error message to appear?

Thankful for advice,
Merete Forseth


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
domenrex
Posts: 1
Joined: Wed Jul 17, 2024 5:15 am

Re: Error "Unable to invert xtx."

Post by domenrex »

The error message "Unable to invert xtx" typically suggests that there is an issue with the matrix inversion process, which can occur for several reasons:

Multicollinearity: This is the most common cause. When predictors in your model are highly correlated, the
𝑋

𝑋
X

X matrix becomes nearly singular, making it difficult or impossible to invert. You might want to check the correlations between your predictors and remove or combine those that are highly correlated.

Sparse Data: If some of your predictors have little to no variation or if there are categories in your multinomial outcome that have very few observations, this can lead to issues in model estimation. Consider aggregating some categories or checking the distribution of your data.

Model Specification: Double-check your model specification to ensure that it is correctly specified and that all necessary variables and interactions are included. Errors in specifying the model can also lead to issues with matrix inversion.

Initialization: Sometimes, the initial values provided to the MCMC chain can affect the convergence. You might want to try different initial values or more burn-in iterations to help with the estimation process.
Imelinoza
Posts: 1
Joined: Tue Aug 27, 2024 9:20 am

Re: Error "Unable to invert xtx."

Post by Imelinoza »

The error message "Unable to invert xtx" typically indicates a problem with the model specification, which leads to issues with matrix inversion during the estimation process.
You can do this by running a collinearity diagnostics test (e.g., vif in Stata) or by manually inspecting correlations between variables. If high multicollinearity is present, consider removing or combining some of the correlated variables.
Post Reply