MixedModels.jl icon indicating copy to clipboard operation
MixedModels.jl copied to clipboard

Additional details in documentation for Grouping()

Open oizin opened this issue 4 years ago • 3 comments

Hi, great package, I just have a small suggestion for the documentation.

I was using MixedModels to fit a model with many levels and got the following error:

┌ Warning: Random effects grouping variables with many levels can cause out-of-memory errors.  Try manually specifying `Grouping()` contrasts for those 
variables.

It took me a while to figure out how to use Grouping() and contrasts, until I saw the example in the tests below. I think it would be worth having something like fit(MixedModel, @formula(y ~ 1 + (1 | grp)), d, contrasts=Dict(:grp => Grouping())) in the documentation for Grouping.

https://github.com/JuliaStats/MixedModels.jl/blob/aae37e9dd724d6eb8ded292a9a8798300bb2a562/test/grouping.jl

Happy to create a pull request if you think this is worthwhile.

oizin avatar Jul 05 '21 03:07 oizin

We hadn't given much more documentation previously because we had only encountered it in a few places in the wild and Grouping() works like any other contrasts / hints for the StatsModels formula interface.

That said, it would be a great thing to have it better documented. Do you have an idea for where to document it so that it's easily discoverable?

palday avatar Jul 13 '21 13:07 palday

My suggestion would be to make sure the docstring for Grouping explains how to use it (with an example invocations for lm and fit) and add a pointer to the docstring in the warning message (something like "for more, see ?Grouping")

kleinschmidt avatar Jul 16 '21 14:07 kleinschmidt

And a PR would be most welcome @oizin !

kleinschmidt avatar Jul 16 '21 14:07 kleinschmidt