Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upFix bootstrap and simulation variance estimation for merMod models #117
+63
−9
Conversation
This comment has been minimized.
This comment has been minimized.
Hey, this is cool. Thanks! Sorry for the delayed accept. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
jacob-long commentedFeb 18, 2019
Please ensure the following before submitting a PR:
This would close #105.
/R
not/man
and rundevtools::document()
to update documentation/tests
for any new functionality or bug fixR CMD check
runs without error before submitting the PRFor reference, here was the basic problem: The object manipulation done by
get_effect_variances()
doesn't work on S4 objects likemerMod
models. They aren't subset using[[
, which is the most proximal cause of the error. These particular objects also have different names for the items the function is looking for. S4 objects also can impose object class restrictions for the internal list items, so things like setting the model frame toNULL
can't work becauselme4
insists that it be a data frame.For the bootstrapping code, I was able to use a generalizable fix by just using the call extractor function and manipulating the call rather than the model itself, then evaluating the call and saving that as a temporary model. For the simulation, I had to do some
merMod
-specific control flow (i.e., doing someif (inherits(model, "merMod")
) which is inelegant but I think better than trying to create an internal S3 method or something like that.I should also draw your attention to the fact that for
vce = "simulation"
, we're only simulating the fixed effects and not the random effects. I think this may be okay, and is certainly simpler, but I haven't thought deeply about the statistical theory behind leaving the random effects fixed and simulating only the fixed part of the model.