Repository navigation
Conversation
…rence distribution
…and add the NEWS item
…in the error message
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In
cv_varsel()withcv_method = "LOO"andvalidate_search = TRUE,get_p_clust()reweights the reference-model draws with the PSIS-LOO weights of the left-out observation. If all draws of a cluster have weight 0, for example after underflow with a non-converged chain, the cluster center is 0/0 = NaN. The NaN response removes all rows of the submodel data, andcv_varsel()stops with "matrix multiplication: incompatible matrix dimensions: 0x1 and 2x1".With this PR, such a cluster keeps projection weight 0, and its center, dispersion and predictive variance use equal weights of its draws. The results for the other clusters do not change, apart from rounding. If all projected draws have weight 0 (possible only with thinning),
get_p_clust()stops with an error that names the workarounds.Tests
New tests in
test_get_p_clust.R,test_wcol_moments.Randtest_loo_fold_projection.Rcover clusters with weight sum 0 and the new error. The test intest_loo_fold_projection.Rrunscv_varsel()with Poisson and Gaussian reference models for which the PSIS-LOO weights underflow. One case intest_loo_weight_perturbation.Rchanges its expected result. On master, these test files give 79 failures and 1 error (the error above). The full suite passes (R 4.6.1, lme4 2.0.6) with the same warnings as master.This PR was assisted by Claude.