3-level multinomial error:'illegal op: v_block:: mult_add()'

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/
julia1633
Posts: 30
Joined: Mon Aug 15, 2011 1:54 pm

3-level multinomial error:'illegal op: v_block:: mult_add()'

Post by julia1633 »

Greetings,

I am estimating a 3-level multinomial model which seems to have no problems with convergence. However, once I replace GDP pc with a set of GDP pc dummies denoting the five quintiles of its distribution (using the first one as a reference category) I get an error message saying
illegal op: v_block::mult_add()
. Could you please advise what it means.

Thanks,
Julia
GeorgeLeckie
Site Admin
Posts: 432
Joined: Fri Apr 01, 2011 2:14 pm

Re: 3-level multinomial error:'illegal op: v_block:: mul

Post by GeorgeLeckie »

Dear Julia,

Please will you paste your runmlwin model syntax for this model.

Many thanks

George
julia1633
Posts: 30
Joined: Mon Aug 15, 2011 1:54 pm

Re: 3-level multinomial error msg 'illegal op: v_block:: mul

Post by julia1633 »

Dear George,

Here it is.

runmlwin SUYR5JOBml2 cons age age_sq male gemwork educ_secpost educ_post busang_dum omestb_dum knowent_dum fearfail_dum l3r_hfgov l3_exconst l3_finfree l3_corrfree l_dgdp iq2 iq3 iq4 iq5, level3(country: cons) level2(year: cons) level1(obsno) discrete(distribution(multinomial) link(mlogit) denom(cons) base(1))

Kind Regards,
Julia
GeorgeLeckie
Site Admin
Posts: 432
Joined: Fri Apr 01, 2011 2:14 pm

Re: 3-level multinomial error:'illegal op: v_block:: mult_ad

Post by GeorgeLeckie »

Dear Julia,

I can't see anything obviously wrong with the syntax.

Please make sure that you are using the latest versions of runmlwin and MLwiN. Type the following to get the latest version of runmlwin...

. adoupdate runmlwin, update

The latest version of MLwiN is 2.23. You can upgrade for free at:

http://www.bristol.ac.uk/cmm/software/m ... rades.html

Should the error message persist, then please would you email me the Stata do-file and Stata dataset so that we can run this command and replicate the error message which you run into?

Best wishes

George
julia1633
Posts: 30
Joined: Mon Aug 15, 2011 1:54 pm

Re: 3-level multinomial error:'illegal op: v_block:: mult_ad

Post by julia1633 »

Dear George,

thanks a lot. I followed your advice, but apparently I still encounter this problem. As suggested, I e-mailed you the dataset and a do file with providing some more details in my e-mail. I would be grateful if you could look into this.

Many thanks,
Julia
ChrisCharlton
Posts: 1354
Joined: Mon Oct 19, 2009 10:34 am

Re: 3-level multinomial error:'illegal op: v_block:: mult_ad

Post by ChrisCharlton »

It appears that the cause of the error is that MLwiN is running out of memory. As a 32-bit program MLwiN can use a maximum of 2Gb on a 32bit machine or 4Gb on a 64bit machine. This amount is shared by the MLwiN code and data structures which are not necessarily stored contiguously, further reducing the possible size that can be allocated to the worksheet. For further information on MLwiN worksheet sizes see http://www.bristol.ac.uk/cmm/software/s ... tsize.html.

In order to run your model in MLwiN you will need to work on a sub-sample.
GeorgeLeckie
Site Admin
Posts: 432
Joined: Fri Apr 01, 2011 2:14 pm

Re: 3-level multinomial error:'illegal op: v_block:: mult_ad

Post by GeorgeLeckie »

Hi Julia,

Your data structure is individuals (level 1) within years (level 2) within countries (level 3).

You have ~500,000 level 1 units, ~200 level 2 units and ~50 level 3 units.

I would therefore recommend taking a random sample of the level 1 units within each level 2 unit.

One way to take a, say, 10% random sub-sample of the level 1 units within each level 2 unit is by using the user-written gsample command:

gsample 10, strata(country year) wor percent

So here you would end up with ~50,000 level 1 units, ~200 level 2 units and ~50 level 3 units.
julia1633
Posts: 30
Joined: Mon Aug 15, 2011 1:54 pm

Re: 3-level multinomial error:'illegal op: v_block:: mult_ad

Post by julia1633 »

Dear Chris and George,

Thanks for looking into this and your useful suggestions. I'll experiment with this.

Kind Regards,
Julia
julia1633
Posts: 30
Joined: Mon Aug 15, 2011 1:54 pm

Re: 3-level multinomial error:'illegal op: v_block:: mult_ad

Post by julia1633 »

Greetings,

I have a few more questions.
(1) Quite often when I try to import the results back in STATA after pressing resume macro once I got meaningless results with '#QO(0.0000)' being reported instead of estimates. Mlwin then fails to import these results in STATA generating an error message that Mlwin hasn't run properly or there was a problem with importing the results in STATA. Is it also attributed to the problem with a sample size and MLwin running out of memory'?
(2) I've tried to estimate the model on a subsample of countries which reduced the number of obs by 300,000 leaving me with about 200,000 units at level 1. However, various specifications which I attempted generate all thoughts of error messages, icnluding the one below:

->OBEY "C:\Users\User\AppData\Local\Temp\ST_0500000m.tmp"

error while obeying batch file C:\Program Files (x86)\MLwiN v2.23\multicat\mnom_p.mc at line number 4:
calc 'pi'=expo('h')
289825 numeric errors in calculate command, first 20 affected entries listed.
Affected entries replaced with system missing.

WARNING: macro file has aborted, your data may be in a transformed state
->WSET

reallocating hierarchy

or simply produced '#QO' instead of estimates. If the sample is much smaller why do I still get these sort of error messages or meaningless estimates.

Kind Regards,
Julia
GeorgeLeckie
Site Admin
Posts: 432
Joined: Fri Apr 01, 2011 2:14 pm

Re: 3-level multinomial error:'illegal op: v_block:: mult_ad

Post by GeorgeLeckie »

Hi Julia,

Given the difficulties that you are currently encountering, I would suggest that you do not use the nopause option. This way you will be given a chance to check whether the model has converged and gives sensible results in MLwiN before attempting to import the results back to Stata. If MLwiN gives error messages, fails to converge or gives meaningless results then you should not click the Resume Macro button in MLwiN. You should click the Abort Macro button to return control to Stata without attempting to pass back the meaningless results to Stata.

An important likely source of difficulties arises because you do not building the model up sequentially, rather you try to fit the final model directly. Because your models is computationally challenging to fit, it is recommended to fit a series of increasingly complex models where you use the parameter estimates of the previous model as starting values for the next. In terms of your model I would suggest first fitting the single-level version of your model, second bring in the country effects, third bring in the year effects. To do this you need to make use of the initsprevious command. I have done this below for two different random samples of your data

(1) Applying a 5% sample of individuals (level 1 units)
(2) Applying a 10% sample of countries (level 3 units)

The code to replicate my results is as follows. Hopefully this will also run smoothly on your machine. Let me know how you get on. If everything works fine then start to increase the random sample and see how far you get.

Code: Select all

global MLwiN_path "D:\Program Files (x86)\MLwiN v2.24\mlwin.exe"

****************************************************************************
* 5% SAMPLE OF INDIVIDUALS
****************************************************************************
use "Q:\C-modelling\runmlwin\GEM 2001-2006 reduced version.dta", clear

recast float obsno

set seed 12345

gsample 5, strata(country year) wor percent

sort country  year obsno

tablist country year, sort(v) sepby(country)

runmlwin SUYR5JOBml2 cons age age_sq male ///
	gemwork educ_secpost educ_post busang_dum omestb_dum knowent_dum fearfail_dum ///
	l3r_hfgov l3_exconst l3_finfree l3_corrfree l_dgdp ///
	iq2 iq3 iq4 iq5, ///
	level3(country:) ///
	level2(year:) ///
	level1(obsno) ///
	discrete(distribution(multinomial) link(mlogit) denom(cons) base(1)) nopause

runmlwin SUYR5JOBml2 cons age age_sq male ///
	gemwork educ_secpost educ_post busang_dum omestb_dum knowent_dum fearfail_dum ///
	l3r_hfgov l3_exconst l3_finfree l3_corrfree l_dgdp ///
	iq2 iq3 iq4 iq5, ///
	level3(country: cons) ///
	level2(year:) ///
	level1(obsno) ///
	discrete(distribution(multinomial) link(mlogit) denom(cons) base(1)) initsprevious nopause

runmlwin SUYR5JOBml2 cons age age_sq male ///
	gemwork educ_secpost educ_post busang_dum omestb_dum knowent_dum fearfail_dum ///
	l3r_hfgov l3_exconst l3_finfree l3_corrfree l_dgdp ///
	iq2 iq3 iq4 iq5, ///
	level3(country: cons) ///
	level2(year: cons) ///
	level1(obsno) ///
	discrete(distribution(multinomial) link(mlogit) denom(cons) base(1)) initsprevious nopause



****************************************************************************
* 10% SAMPLE OF COUNTRIES
****************************************************************************

use "Q:\C-modelling\runmlwin\GEM 2001-2006 reduced version.dta", clear

recast float obsno

set seed 12345

gsample 10, strata(country) wor percent

sort country  year obsno

tablist country year, sort(v) sepby(country)

runmlwin SUYR5JOBml2 cons age age_sq male ///
	gemwork educ_secpost educ_post busang_dum omestb_dum knowent_dum fearfail_dum ///
	l3r_hfgov l3_exconst l3_finfree l3_corrfree l_dgdp ///
	iq2 iq3 iq4 iq5, ///
	level3(country:) ///
	level2(year:) ///
	level1(obsno) ///
	discrete(distribution(multinomial) link(mlogit) denom(cons) base(1)) nopause

runmlwin SUYR5JOBml2 cons age age_sq male ///
	gemwork educ_secpost educ_post busang_dum omestb_dum knowent_dum fearfail_dum ///
	l3r_hfgov l3_exconst l3_finfree l3_corrfree l_dgdp ///
	iq2 iq3 iq4 iq5, ///
	level3(country: cons) ///
	level2(year:) ///
	level1(obsno) ///
	discrete(distribution(multinomial) link(mlogit) denom(cons) base(1)) initsprevious nopause

runmlwin SUYR5JOBml2 cons age age_sq male ///
	gemwork educ_secpost educ_post busang_dum omestb_dum knowent_dum fearfail_dum ///
	l3r_hfgov l3_exconst l3_finfree l3_corrfree l_dgdp ///
	iq2 iq3 iq4 iq5, ///
	level3(country: cons) ///
	level2(year: cons) ///
	level1(obsno) ///
	discrete(distribution(multinomial) link(mlogit) denom(cons) base(1)) initsprevious nopause

****************************************************************************
exit

Best wishes

George
Post Reply