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!

I am two models. Model 1 is a 2-level random slope model with continuous outcome and IGLS is used to estimate the model. Model 2 is a 2-level random coefficient cumulative logit model with a ordinal outcome with 3 categories and MCMC estimation is used.

I have no problem to calculate the predicted value for Model 1 using the following code:

It sounds like there is probably a mismatch between the variable names referenced in the parameter names and those in the data associated with the model. If you look in the predict method in https://github.com/rforge/r2mlwin/blob/ ... nfitMCMC.R you will see that x.names is created as follows:

i.e. it takes the names for the fixed part parameters and removes the "FP_" from the beginning to find their associated data.

If you compare these to what is in the data (i.e. sub("FP_", "", names(model2@FP)) with colnames(model2@data)) I suspect that you will find a mismatch. Without more details of how they differ I can't suggest a fix.

I believe that this is because the extra variables are created internally within MLwiN, rather than generated on the R side, so R2MLwiN is not aware of them. I will think about whether there is a way to resolve this, however in the mean time you would need to manually add the necessary variables to the data frame associated with the model in order to make the predict() function work.

The data stored with the model object is the version sent to MLwiN, rather than the version used to fit the model. When setting up the multinomial model MlwiN will expand the data so that each possible response value get its own row. This is referred to on page 168 of the MLwiN user's guide (http://www.bristol.ac.uk/cmm/media/soft ... al-web.pdf). In order to recreate the prediction that you would get via the MLwiN interface you would need to generate this expanded dataset and then use this instead of the data attached to the model object. One way to do this might be to add the debugmode=TRUE option to your runMLwiN function call, save the expanded data from MLwiN and then load this into R and use it for the prediction.