r2mlwin output shows wrong number of higher levels, when subseiting the dataframe

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/
Post Reply
adeldaoud
Posts: 63
Joined: Sat Aug 15, 2015 4:00 pm

r2mlwin output shows wrong number of higher levels, when subseiting the dataframe

Post by adeldaoud »

Hi

This is not a serious issue but can be confusing. R2mlwin output shows the wrong number of higher level units, when subsetting the dataframe and the higher level identifier is a factor. This is due to the fact that R keeps factor names even if they are unused. This means that one should use the droplevels() function after subsetting and before using the variable in an estimation.

https://stat.ethz.ch/R-manual/R-devel/l ... evels.html

I assume that this could be a relatively easy implementation into the R2mlwin function itself: namely to drop any unused factor levels.

cheers
Adel

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

Re: r2mlwin output shows wrong number of higher levels, when subseiting the dataframe

Post by ChrisCharlton »

Thanks for pointing this out. This should now be fixed in the development version (if for some reason you want the old behaviour set the estimation option drop.levels to FALSE).

Post Reply