Simulating Cluster RCTs
Thank you both for the advice. Kevin
On 06/02/2018 02:48 AM, Ben Bolker wrote:
If you can find an existing package that does the kind of model you want, that would certainly be recommended. You could also look at the power analysis section of the GLMM FAQ https://bbolker.github.io/mixedmodels-misc/glmmFAQ.html#power-analysis For scalar/intercept-only random effects, the theta parameters are the among-group standard deviations (scaled by the residual standard deviation, for linear mixed models). For random-slopes models it's (alas) more complicated -- the theta parameters are the elements of the (scaled) Cholesky factor of the variance-covariance matrix -- but you could use the functions in ?vcconv to convert from variance-covariance matrices to Cholesky factors .. On Fri, Jun 1, 2018 at 4:54 PM, Ulf K?ther <ukoether at uke.de> wrote:
Hi Kevin, I think that a more appropriate way to achieve your goal is to have a look at a library that explicitly deals with the simulation of data. Especially, you should look into the "simstudy" package, which is developed by Keith Goldfield, which is, as I recall it, clearly able to do what you want: The package: https://cran.r-project.org/web/packages/simstudy/index.html Goldfield's blog about generating data using simstudy: https://www.rdatagen.net/ His posts about clustered data: https://www.rdatagen.net/page/clustered/ Good luck, Ulf Am 01.06.2018 um 14:53 schrieb Kevin E. Thorpe:
Hi All. Apologies if this is the wrong list but after searching I have not found what I am looking for. I would like (mainly for teaching) to be able to simulate cluster RCTs with continuous and binary outcomes. It appears to me that simulate.merMod in lme4 may be one way to do this. Unfortunately, I am a bit lost in the help file. For one thing, in the newparams argument, I have no idea what theta is. Also, in the simulations I would like to be able to specify an ICC to control the clustering effect as well as the usual things (e.g. mean response in the control group, treatment effect, number of clusters and cluster sizes). I would be most appreciative for any guidance or examples of this type of simulation, either with simulate.merMod or other approaches. Thank you in advance for your time. Kevin
Kevin E. Thorpe Head of Biostatistics, Applied Health Research Centre (AHRC) Li Ka Shing Knowledge Institute of St. Michael's Hospital Assistant Professor, Dalla Lana School of Public Health University of Toronto email: kevin.thorpe at utoronto.ca Tel: 416.864.5776 Fax: 416.864.3016