-
Notifications
You must be signed in to change notification settings - Fork 16
Description
The time has come to refactor predictInterval. It always should have been multiple functions since each piece of the prediction interval can be sampled independently. To help make future maintenance easier and unit testing more straightforward, the function should be broken up into the following components:
predict_setup() - does the work of getting the merMod pieces needed to make intervals
sample_re() - creates the random component of the prediction intervals
sample_fe() - creates the fixed component of the prediction intervals
sample_model() - gets the model fit error (if user requests) component of the prediction intervals
Then predictInterval is simply a function that calls these functions and then combines the results into different configurations depending on what the user requests.
I don't think the sub-functions should be exported, predictInterval() should always be the function the user interacts with even when they only request part of the prediction interval. But, it will make unit testing easier moving forward and should make it easier to adapt to changes in lme4 if they come up or to incorporate new model types like in issue #101
What say you @carlbfrederick - does this sound like a good plan? Any feeling on names/conventions/structure? This is mostly off the top of my head.