jknowles / merTools

Convenience functions for working with merMod objects from lme4
105 stars 15 forks source link

minimize use of ranef(); try to keep model matrices sparse #120

Closed bbolker closed 2 years ago

bbolker commented 3 years ago

This is related to #119, but also mixes in some (possibly misguided) attempts to avoid converting sparse to dense matrices. The latter isn't quite working because I haven't spent enough time understanding the logic at the end of predictInterval() to see how the computations could be done without reverting to dense matrices ...

This should probably have been two separate PRs, and I can separate them if you want, but wanted to start the conversation. Except for a little bit of leftover mess at the point where I gave up on maintaining sparsity, this should be fine - it does resolve #119 I think (but, I couldn't actually run that example on my system, because I ran out of memory - which is why I was pissing around with sparse matrices).

jknowles commented 3 years ago

Thanks for this. Apologies for just seeing it now, most of my development work is not public on GitHub so I don't check this as often as I should.

You raise some great questions. I will pull down the code and test to see if I can figure out a way around the sparse matrix issue. The problem is when I wrote the function I didn't know how to use a sparse matrix and I'm afraid I probably know even less now. But perhaps with a look at it I can formulate an intelligent description of what is going on and answer some of your other good points on #119.

I appreciate the time you spent on this! If it makes more sense to have more of a conversation about lme4 -> merTools I'd love to, fastest way to get in touch with me for something like that is by email though.

dotPiano commented 2 years ago

I am also experiencing issues with the runtime of predictInterval(). Would it be possible to merge and release this? While I cannot speak for the sparsity optimizations, reducing the usage of ranef() would already provide a massive benefit and it doesn't look like it would break anything.