Cannot find valid MLwiN executable

Welcome to the forum for R2MLwiN users. Feel free to post your question about R2MLwiN 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 R2MLwiN: Running MLwiN from within R >> http://www.bris.ac.uk/cmm/software/r2mlwin/
coolkate3738
Posts: 6
Joined: Thu Jun 02, 2016 1:59 pm

Cannot find valid MLwiN executable

Post by coolkate3738 »

Hi Everyone,

Would you be able to help me with the following error I get when trying to use the R2MLwiN package. As you can see there is an error when running runMLwin command that says "Cannot find MLwiN executable. I have made sure that the path R is using actually contains the package, but it still doesnt work

> F1 <- normexam ~ 1 + (1 | school) + (1 | student)

> (VarCompModel <- runMLwiN(Formula = F1, data = tutorial))
Error in runMLwiN(Formula = F1, data = tutorial) :
Cannot find valid MLwiN executable
ChrisCharlton
Posts: 1351
Joined: Mon Oct 19, 2009 10:34 am

Re: Cannot find valid MLwiN executable

Post by ChrisCharlton »

You can tell R2MLwiN where to find the MLwiN executable by setting the MLwiN_path option as follows:

Code: Select all

options(MLwiN_path="<path to MLwiN>")
by default this is set to the most recent version of MLwiN at the time that version of R2MLwiN was released (this location is displayed when you load the R2MLwiN package). If this doesn't match the version on your machine then you will need to change the option to match this.
coolkate3738
Posts: 6
Joined: Thu Jun 02, 2016 1:59 pm

Re: Cannot find valid MLwiN executable

Post by coolkate3738 »

thanks Chris,
I have tried the following.

> install.packages("R2MLwiN", repos = "http://cran.r-project.org")
trying URL 'http://cran.r-project.org/bin/windows/c ... _0.8-2.zip'
Content type 'application/zip' length 830403 bytes (810 KB)
downloaded 810 KB

package ‘R2MLwiN’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
C:\Users\jekaterina.pasecnika\AppData\Local\Temp\RtmpgJ8IH6\downloaded_packages
#so you can see the folder that the package is installed, then i have done the following
options(MLwiN_path="C:/Users/jekaterina.pasecnika/AppData/Local/Temp/RtmpgJ8IH6/downloaded_packages")

# so you can see the location is set to match the previous one

F1 <- normexam ~ 1 + (1 | school) + (1 | student)
>
> (VarCompModel <- runMLwiN(Formula = F1, data = tutorial))
Error in runMLwiN(Formula = F1, data = tutorial) :
Cannot find valid MLwiN executable


# and yet I get the same error..Can you advise please?:(
ChrisCharlton
Posts: 1351
Joined: Mon Oct 19, 2009 10:34 am

Re: Cannot find valid MLwiN executable

Post by ChrisCharlton »

It looks like you're pointing the option to where the R package was downloaded, rather than to where MLwiN is installed. Here is an example pf setting the path and then running a model:

Code: Select all

> library(R2MLwiN)
Loading required package: stats4
Loading required package: lattice
Loading required package: coda
The MLwiN_path option is currently set to C:/Program Files (x86)/MLwiN v2.36/
To change this use: options(MLwiN_path="<path to MLwiN>")

> options(MLwiN_path="C:/Program Files (x86)/MLwiN v2.36/")
> data(tutorial, package = "R2MLwiN")
> F1 <- normexam ~ 1 + (1 | school) + (1 | student)
> (VarCompModel <- runMLwiN(Formula = F1, data = tutorial))
/nogui option ignored
ECHO    0


Echoing is ON
BATC 1

Batch mode is ON
MAXI 2
STAR
iteration 0
       11015.7776845
iteration 1
       11010.6489676

Convergence not achieved
TOLE 2
MAXI 20
NEXT
iteration 2
       11010.6479899

Convergence achieved
ECHO 0
Execution completed


-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 
MLwiN (version: 2.36)  multilevel model (Normal) 
        N min     mean max N_complete min_complete mean_complete max_complete
school 65   2 62.44615 198         65            2      62.44615          198
Estimation algorithm:  IGLS        Elapsed time : 0.33s 
Number of obs:  4059 (from total 4059)        The model converged after 3 iterations.
Log likelihood:      -5505.3 
Deviance statistic:  11010.6 
--------------------------------------------------------------------------------------------------- 
The model formula:
normexam ~ 1 + (1 | school) + (1 | student)
Level 2: school     Level 1: student      
--------------------------------------------------------------------------------------------------- 
The fixed part estimates:  
               Coef.   Std. Err.       z   Pr(>|z|)         [95% Conf.   Interval] 
Intercept   -0.01317     0.05363   -0.25      0.806           -0.11827     0.09194 
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1  
--------------------------------------------------------------------------------------------------- 
The random part estimates at the school level: 
                  Coef.   Std. Err. 
var_Intercept   0.16863     0.03245 
--------------------------------------------------------------------------------------------------- 
The random part estimates at the student level: 
                  Coef.   Std. Err. 
var_Intercept   0.84776     0.01897 
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
coolkate3738
Posts: 6
Joined: Thu Jun 02, 2016 1:59 pm

Re: Cannot find valid MLwiN executable

Post by coolkate3738 »

thanks Chris I have done the same but getting the error again, please advise?

> library(R2MLwiN)
The MLwiN_path option is currently set to C:/Users/jekaterina.pasecnika/Desktop/R2MLwiN
To change this use: options(MLwiN_path="<path to MLwiN>")

> options(MLwiN_path="C:/Program Files (x86)/R2MLwiN")
> data(tutorial, package = "R2MLwiN")
> F1 <- normexam ~ 1 + (1 | school) + (1 | student)
> (VarCompModel <- runMLwiN(Formula = F1, data = tutorial))
Error in runMLwiN(Formula = F1, data = tutorial) :
Cannot find valid MLwiN executable
ChrisCharlton
Posts: 1351
Joined: Mon Oct 19, 2009 10:34 am

Re: Cannot find valid MLwiN executable

Post by ChrisCharlton »

Could you try locating the mlwin.exe file directly (usually in the i386 subdirectory under where you installed MLwiN) and setting MLwiN_path to point to that, as this should remove the need for it to search?
coolkate3738
Posts: 6
Joined: Thu Jun 02, 2016 1:59 pm

Re: Cannot find valid MLwiN executable

Post by coolkate3738 »

HI Chris,
There is no mlwin.exe in that folder or anywhere on my pc. there isnt an i 386 folder in R2MLwiN folder either, unlike with other packages that contain i386.
Regards,
ChrisCharlton
Posts: 1351
Joined: Mon Oct 19, 2009 10:34 am

Re: Cannot find valid MLwiN executable

Post by ChrisCharlton »

The i386 directory would be in the location that you installed MLwiN (usually C:\Program Files (x86)\MLwiN v2.36), not R2MLwiN, the R package for interfacing with it. If this file is missing then I suggest that you reinstall MLwiN, as it is likely that something went wrong last time you installed it.
coolkate3738
Posts: 6
Joined: Thu Jun 02, 2016 1:59 pm

Re: Cannot find valid MLwiN executable

Post by coolkate3738 »

Hi Chris,

MlwiN file does not exist on my computer at all. I looked for it by search function on my pc. Also I have reinstalled R2MLwiN package many times and MLwiN just does not exist within that package. I am talking about R package, just to be sure. I have tried downloading it from CRAN and GIthub and none of them seems to contain the MLwin part. So I am not sure what else to do. I have also asked my colleague to try the same thing and it didnt work for her either, she was getting the same error. Please advise?
ChrisCharlton
Posts: 1351
Joined: Mon Oct 19, 2009 10:34 am

Re: Cannot find valid MLwiN executable

Post by ChrisCharlton »

MLwiN is not included within the R2MLwiN package and needs to be installed separately. If you don't have it installed you will need a copy before you can use R2MLwiN. For details on this see http://www.bristol.ac.uk/cmm/software/mlwin/.
Post Reply