Issue running MLPowSim in R

Welcome to the forum for MLwiN users. Feel free to post your question about MLwiN software 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!

Remember to check out our extensive software FAQs which may answer your question: http://www.bristol.ac.uk/cmm/software/s ... port-faqs/
Post Reply
Neuro123
Posts: 2
Joined: Thu Nov 05, 2020 3:13 pm

Issue running MLPowSim in R

Post by Neuro123 »

I am currently experiencing an issue trying to run the R output of MLPowSim, 'powersimu.r'. When performing a power analysis for a 1-level model (e.g. the one outlined in the manual section one, p8), the script runs perfectly.

However, I am now trying to replicate the example outlined in the manual section 5.1 (on p113) for R. The R script is generated by MLPowSim, but when running it, I get the error "Error in lmer(modelformula, data, method="ML") : unused argument (method = "ML").
I have tried requesting REML instead, and have tried to change some other parameters deviating from the example given in the manual, but so far I am unsuccessful in bypassing this error message.

I have R version R-3.6.3 installed and running on a Windows platform. Any suggestions as to solving this problem would be highly appreciated!
ChrisCharlton
Posts: 1283
Joined: Mon Oct 19, 2009 10:34 am

Re: Issue running MLPowSim in R

Post by ChrisCharlton »

What happens if you just remove the method="ML" statement from the command? i.e.:

Code: Select all

lmer(modelformula, data)
If that doesn't make a difference could you post the associated generated R code?
Neuro123
Posts: 2
Joined: Thu Nov 05, 2020 3:13 pm

Re: Issue running MLPowSim in R

Post by Neuro123 »

Thank you for your suggestion - in the meantime, I'd concluded that the lmer function has been updated relatively recently, and the argument 'method=' is no longer a valid argument to the function. Removing the argument works, but will run the default for the function. From R documentation, I conclude that the argument 'REML=TRUE/FALSE' should allow to specify the method.
Post Reply