pitakakariki / simr

Power Analysis of Generalised Linear Mixed Models by Simulation
69 stars 19 forks source link

Use object rather than formula(object) in doSim #146

Open bwiernik opened 5 years ago

bwiernik commented 5 years ago

If control parameters are set in the merMod object (e.g., to disable checks when using workarounds to freely estimate residual variances across groups; cf. https://stats.stackexchange.com/questions/255546/test-homogeneity-in-lmer-models), using formula(object) loses these control parameters.

It doesn't appear to be possible to pass a control argument to simulate. Using object rather than formula(object) in doSim.merMod yields the same results, while also preserving any control arguments set in the original object model.

bwiernik commented 1 year ago

@pitakakariki Do you think this PR might be merged?

pitakakariki commented 1 year ago

Hi @bwiernik, sorry for not responding earlier. I think from (quite fuzzy) memory when the pull request came in there were unrelated problems with the CI scripts not running. I meant to check back but it slipped my mind.

As you might notice from the large backlog of issues I can't really describe simr as being in "active development", but I am hoping a new role next year will give me a little more time. So I hope to get to your pull request at some point, but can't make any promises as to a timeframe.

I am a little worried that this small change might break a lot of things. That's on me of course - there really should be unit tests written to catch those problems. Using the object rather than the formula is the obvious choice, and I know I went with formula for a reason - and I'm a little worried that I can't quite remember what that was (which means I'm not sure what I'm worried might break). My best guess at the moment was that earlier versions of lme4 didn't allow me to change parameters if I used simulate.merMod.