Error while running multinomial multilevel regression

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
UmmAymanBarakah
Posts: 7
Joined: Sat Apr 05, 2025 9:06 pm

Error while running multinomial multilevel regression

Post by UmmAymanBarakah »

Hello,

This is my first time using runmlwin. I am facing so much errors. Below are the various errors I am encountering. Is there any explanation for this?

runmlwin greenwash cons breadth , level2(gvkey: cons) level1(obsid) discrete(distribution(multinomial) link(mlogit) denom(cons) basecategory(0)) nopause...... when I run this code, I get this error, although I get my results in STATA: " WARNING: IGLS algorithm failed to converge. Increase the number of iterations. See the maxiterations() option.

runmlwin greenwash cons breadth, level2(gvkey: cons) level1(obsid) discrete(distribution(multinomial) link(mlogit) denom(cons) basecategory(0)) maxiterations(100) nopause ...... BUT when I run this I get the following messages without an output.
/*Can't open file: ST_1CC88_0000007.tmp.
error while obeying batch file C:\Users\ia02204\AppData\Local\Temp\ST_1c88_000007.tmp at line number 77: .........Expected Gamma_blk.

Another error, when I run this: runmlwin greenwash cons across , level2(gvkey: cons) level1(obsid) discrete(distribution(multinomial) link(mlogit) denom(cons) basecategory(0)) maxiterations(70) nopause
/*
error while obeying batch file C:\Users\ia02204\AppData\Local\Temp\ST_1c88_000007.tmp at line number 77:
calc 'pi'=expo('h')
31177 numeric errors in calculate command, first 20 affected entries listed.
Affected entries replaced with system missing.
*/




OTHERS

/*
->OBEY "C:\Users\ia02204\AppData\Local\Temp\ST_1c88_000007.tmp"

error while obeying batch file C:\Users\ia02204\AppData\Local\Temp\ST_1c88_000007.tmp at line number 77:
calc 'pi'=expo('h')
2672 numeric errors in calculate command, first 20 affected entries listed.
Affected entries replaced with system missing.

error while obeying batch file C:\Users\ia02204\AppData\Local\Temp\ST_1c88_000007.tmp at line number 77:
calc c1499 = expo('h')
2672 numeric errors in calculate command, first 20 affected entries listed.
Affected entries replaced with system missing.
*/


*/
ChrisCharlton
Posts: 1384
Joined: Mon Oct 19, 2009 10:34 am

Re: Error while running multinomial multilevel regression

Post by ChrisCharlton »

Are you able to provide any information about your data and its structure? For example, does it contain missing values, does it have particularly large/small clusters, does it contain some extreme values, etc? Can you try fitting simpler versions of the model (e.g. with only the intercept) to see if these run successfully? You could also try different base categories, as sometimes there can be estimation problems if there are not many observations with the chosen category?
UmmAymanBarakah
Posts: 7
Joined: Sat Apr 05, 2025 9:06 pm

Re: Error while running multinomial multilevel regression

Post by UmmAymanBarakah »

This is an example data. Please confirm if this is right. If this is my data structure and I want to run 3-level classification, I had to adjust my data.
ID fac time
A 1 2020
B 3 2020
C 5 2020
A 1 2021
B 3 2021
C 5 2021
A 2 2020
B 4 2020
C 6 2020
A 2 2021
B 4 2021
C 6 2021

This is how I adjusted the data and how I run the analyses.
ID fac time timeid unique
A 1 2020 A2020 1
B 3 2020 B2020 2
C 5 2020 C2020 3
A 1 2021 A2021 4
B 3 2021 B2021 5
C 5 2021 C2021 6
A 2 2020 A2020 7
B 4 2020 B2020 8
C 6 2020 C2020 9
A 2 2021 A2021 10
B 4 2021 B2021 11
C 6 2021 C2021 12

runmlwin dependent independent level3(ID: cons) level2(timeid: cons) level1(unique) discrete(distribution(multinomial) link(mlogit) denom(cons) basecategory(0)).

Can you please confirm if this is right?
ChrisCharlton
Posts: 1384
Joined: Mon Oct 19, 2009 10:34 am

Re: Error while running multinomial multilevel regression

Post by ChrisCharlton »

Assuming that the data sample you provided is representative of the rest of the data I think that your problem may be that your data is not sorted by the model hierarchy. Rather than using unique values of ID codes to determine the units MLwiN instead calculates this on when the ID code changes as it scans down the data. Setting up a model using the sample data that you provided shows the following units in the MLwiN equation window (note that the estimates are shown as zero as I have only set up the model and not attempted to fit it):
unsorted-data.png
unsorted-data.png (29.76 KiB) Viewed 5464 times
As you can see each of the higher levels only contains one observation per unit.

If you were to sort the data and then fit this model again you get the following:
sorted-data.png
sorted-data.png (36.64 KiB) Viewed 5464 times
which seems a more plausible unit structure.
UmmAymanBarakah
Posts: 7
Joined: Sat Apr 05, 2025 9:06 pm

Re: Error while running multinomial multilevel regression

Post by UmmAymanBarakah »

Thanks.
Post Reply