MVs & error message 'line too long'

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

MVs & error message 'line too long'

Post by julia1633 »

Greetings,

I am quite new to MLwiN and when I attempted to use it from within STATA I encountered a few problems. (1) My dependent variable so are some of my explanatory variables contain missing values. I am using mlogit within multilevel setting and I don't want to use imputation technique to solve the problem of missing values. I neither wish to resort to 'listwise delete missing data' option. Can my model still be estimated using mlogit regardless the warning message I get concerning MVs? (2) While trying to estimate my model I got the following error message in MLwiN "error while obeying batch file. C:\Users\User\AppData\Local\Temp\ST_0500000.tmp at line number 17: MNON 0 'SUYR5JOBml1' 'resp' 'resp-indicator' 0. Line too long. Could you please advise what this means. Below is the syntax I am using:

runmlwin SUYR5JOBml1 cons age age_sq male gemwork educ_secpost educ_post busang_dum omestb_dum knowent_dum fearfail_dum l_hfgov l_exconst l_finfree l_dgdp l_gdp_pc_ppp, level2(country_year: cons) level1(setid) discrete(distribution(multinomial) link(mlogit) denom(cons) base(0))

where SUYR5JOBml1 is my dependent variable coded as '0' no entry in entrepreneurship; 1-4 denoting entrepreneurial entry with each respective category reflecting entrepreneurs' growth expectations. Please advise how to solve the problem.

I look forward to your reply.

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

Re: MVs & error message 'line too long'

Post by GeorgeLeckie »

Hi Julia,

If you use any of Stata's standard estimation commands (e.g. regress or mlogit), or for that matter the standard estimation commands in other statistical software packages (e.g. SAS, SPSS, R), all these commands and packages will listwise delete (i.e. drop from the estimation sample) those cases with one or more missing values among the response and predictor variables.

The only unusual thing about fitting multinomial models in MLwiN is that you must manually listwise delete the data before attempting to fit the model. Other models in MLwiN (e.g. continuous and binary response models) and all commands in other packages do this for you automatically. The same issue therefore applies if you try to fit multinomial models in MLwiN via the runmlwin command.

So what you need to do is to manually listwise delete your data in Stata before running the runmlwin command. One way to do this is to make use of the missing() function. For example,...

drop if missing(depvar,indepvar1,indepvar2)

We will work on putting a more informative error message Stata side to inform runmlwin users that they must manually listwise delete their data for multinomial response models (both ordered and unordered categorical response variables) prior to running the runmlwin command.

Best wishes

George
ChrisCharlton
Posts: 1353
Joined: Mon Oct 19, 2009 10:34 am

Re: MVs & error message 'line too long'

Post by ChrisCharlton »

Could you also please let us know whether you still get the "line too long" message after removing the cases with missing values?
julia1633
Posts: 30
Joined: Mon Aug 15, 2011 1:54 pm

Re: MVs & error message 'line too long'

Post by julia1633 »

Dear George and Chris,

Thanks a lot for your advice. I've solved the problem of missing values, but I still get the message 'line too long' after getting all the cases with MVs removed. Please advise on what this may be attributed to and how to solve this.

Kind Regards,
Julia
ChrisCharlton
Posts: 1353
Joined: Mon Oct 19, 2009 10:34 am

Re: MVs & error message 'line too long'

Post by ChrisCharlton »

Would it be possible to add the viewmacro option to your runmlwin command and then post the contents of the generated script, as I would like to check that there is nothing obviously wrong there?
julia1633
Posts: 30
Joined: Mon Aug 15, 2011 1:54 pm

Re: MVs & error message 'line too long'

Post by julia1633 »

Would appreciate your advice on how to use this 'viewmacro' option. I've tried to insert it after comma in the model before specifying the levels but it didn't work. Please advise.
GeorgeLeckie
Site Admin
Posts: 432
Joined: Fri Apr 01, 2011 2:14 pm

Re: MVs & error message 'line too long'

Post by GeorgeLeckie »

Hi Julia,

The following example should help.

It causes runmlwin to display the MLwiN macro for the specified model in the Stata viewer. So you should see the Stata viewer pop up and in it you should see the MLwiN macro. Simply post the equivalent macro for your model so that we can see it.

Best wishes

George

. use http://www.bristol.ac.uk/cmm/media/runmlwin/bang, clear

. generate lc1 = (lc==1)

. generate lc2 = (lc==2)

. generate lc3plus = (lc>=3)

. runmlwin use4 cons lc1 lc2 lc3plus, level2(district: cons) level1(woman) discrete(distribution(multinomial) link(mlogit) denom(cons) basecategory(4)) nopause viewmacro



The MLwiN macro which pops up in the Stata viewer for this model is:

ECHO 0
NOTE ***********************************************************************
NOTE MLwiN macro created by runmlwin Stata command: 19 Aug 2011, 09:46:05
NOTE See: www.cmm.bristol.ac.uk/runmlwin for help
NOTE ***********************************************************************

MONI 0
NOTE Import the Stata data set into MLwiN
RSTA 'C:\Users\gl9158\AppData\Local\Temp\8\ST_0000002a.tmp'

NOTE Specify the response variable(s)
NAME c9 'resp' c10 'resp_indicator'
MNOM 0 'use4' 'resp' 'resp_indicator' 4
RESP 'resp'
RDIS 1 4
LFUN 0
DOFF 1 'cons'

NOTE Specify the level identifier(s)
IDEN 3 'district'
IDEN 2 'woman'
IDEN 1 'resp_indicator'

NOTE Specify covariate(s) used anywhere in the model
RPAT 1 0 0
ADDT 'cons'
ADDT 'lc1'
ADDT 'lc2'
ADDT 'lc3plus'
RPAT
RPAT 0 1 0
ADDT 'cons'
ADDT 'lc1'
ADDT 'lc2'
ADDT 'lc3plus'
RPAT
RPAT 0 0 1
ADDT 'cons'
ADDT 'lc1'
ADDT 'lc2'
ADDT 'lc3plus'
RPAT
RPAT 1 0 0
RPAT
RPAT 0 1 0
RPAT
RPAT 0 0 1
RPAT

NOTE Specify level 2 random part covariate(s)
SETV 3 'cons.1'
SETV 3 'cons.2'
SETV 3 'cons.3'

NOTE Set estimation method to be IGLS
METH 1

NOTE Fit the model
STAR
BATC 1
NEXT
MONI 1
ITNU 0 b21
CONV b22

NOTE Open the equations window
WSET 15 1
EXPA 3
ESTM 2
NOTE ***********************************************************************
julia1633
Posts: 30
Joined: Mon Aug 15, 2011 1:54 pm

Re: MVs & error message 'line too long'

Post by julia1633 »

Dear George,

Thanks a lot for your advice. Below is the macro for my model.

ECHO 0
NOTE ***********************************************************************
NOTE MLwiN macro created by runmlwin Stata command: 19 Aug 2011, 22:46:12
NOTE See: www.cmm.bristol.ac.uk/runmlwin for help
NOTE ***********************************************************************

MONI 0
NOTE Import the Stata data set into MLwiN
RSTA 'C:\Users\Kuryan\AppData\Local\Temp\ST_0k000002.tmp'

NOTE Specify the response variable(s)
NAME c21 'resp' c22 'resp_indicator'
MNOM 0 'SUYR5JOBml2' 'resp' 'resp_indicator' 1
RESP 'resp'
RDIS 1 4
LFUN 0
DOFF 1 'cons'

NOTE Specify the level identifier(s)
IDEN 3 'country_year'
IDEN 2 'setid'
IDEN 1 'resp_indicator'

NOTE Specify covariate(s) used anywhere in the model
RPAT 1 0
ADDT 'age'
ADDT 'age_sq'
ADDT 'male'
ADDT 'gemwork'
ADDT 'educ_secpost'
ADDT 'educ_post'
ADDT 'busang_dum'
ADDT 'omestb_dum'
ADDT 'knowent_dum'
ADDT 'fearfail_dum'
ADDT 'l3r_hfgov'
ADDT 'l3_exconst'
ADDT 'l_finfree'
ADDT 'l_dgdp'
ADDT 'l_gdp_pc_ppp'
RPAT
RPAT 0 1
ADDT 'age'
ADDT 'age_sq'
ADDT 'male'
ADDT 'gemwork'
ADDT 'educ_secpost'
ADDT 'educ_post'
ADDT 'busang_dum'
ADDT 'omestb_dum'
ADDT 'knowent_dum'
ADDT 'fearfail_dum'
ADDT 'l3r_hfgov'
ADDT 'l3_exconst'
ADDT 'l_finfree'
ADDT 'l_dgdp'
ADDT 'l_gdp_pc_ppp'
RPAT
RPAT 1 0
ADDT 'cons'
FPAR 0 'cons.2'
RPAT
RPAT 0 1
ADDT 'cons'
FPAR 0 'cons.3'
RPAT

NOTE Specify level 2 random part covariate(s)
SETV 3 'cons.2'
SETV 3 'cons.3'

NOTE Set estimation method to be IGLS
METH 1

NOTE Fit the model
STAR
BATC 1
NEXT
MONI 1
ITNU 0 b21
CONV b22

NOTE Open the equations window
WSET 15 1
EXPA 3
ESTM 2
NOTE ***********************************************************************

Please let me know if there is any problem with it.

Kind Regards,
Julia
ChrisCharlton
Posts: 1353
Joined: Mon Oct 19, 2009 10:34 am

Re: MVs & error message 'line too long'

Post by ChrisCharlton »

Thanks for providing the macro. I cannot see anything obviously wrong with it. Would it be possible for you to email George or myself an example data set and do file that demonstrates the problem so that we can investigate further?
julia1633
Posts: 30
Joined: Mon Aug 15, 2011 1:54 pm

Re: MVs & error message 'line too long'

Post by julia1633 »

Dear Chris and George,

Thanks for looking into this. It may be a bit complicated as even after compression the file is about 500MB. It has about 700,000 obs. I may delete some variables not currently in use and will deal with missing values so to reduce the size of the file after I finish running the model as the dataset is currently in use and I don't have any more copies of it. I am currently experimenting with gllamm and both my desktop and a laptop have been on for 2 days with gllamm trying to estimate mlogit in the context of multilevel modeling. I've progressed as far as iteration 6, but there is no sign of convergence as yet. I'll try to post a sample dataset with a do file as soon as possible (provided I could manage to reduce its size).

Kind Regards,
Julia
Post Reply