Allocate updates 20 jul2026#11
Open
jdbunker wants to merge 2 commits into
Open
Conversation
Overhauled allocate(), especially regarding the rounding and lbound/N.h/n.samp-based adjustments * `outputs` Parameter: allows user to choose between raw, adjusted, and/or final (rounded) allocations * c.h Check: no longer listing Neyman * sum(lbound * c.h) > cost: bumped from warning to error after edits to adjustment/rounding step * any(lbound > N.h): gives warning * `outputs` check: every value must be 'raw', 'adjusted', and/or 'rounded' * Adjustment Step: properly routed depending on allocation method * Rounding: stochastic to deterministic * Documentation: updated to reflect all of the above changes * Tests: patched existing tests based on above changes (e.g., warning to error, adjustment/rounding handling); added a few new tests
Making minor tweaks to the allocate() function related to non-ASCII symbols (`–` to `-` and `✓` to `X`). I also regenerated the allocate.Rd file, which incorporates the new `outputs` argument and seemingly expands the table and examples section.
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.
Original Overview
Overhauled allocate(), especially regarding the rounding and lbound/N.h/n.samp-based adjustments
outputsParameter: allows user to choose between raw, adjusted, and/or final (rounded) allocationsoutputscheck: every value must be 'raw', 'adjusted', and/or 'rounded'Expanded Overview
This PR substantially refactors allocate() to improve reproducibility, constraint handling, and transparency of the allocation process.
OutputsArgumentoutputsparameter before proceedingLength: ~40 lines of code.
Why: Makes the allocation process more transparent and easier to debug, validate, and explain.
Adjustment Logic Overhaul
Length: ~200 lines of code.
Why: The previous adjustment process could distort allocations after lower-bound enforcement and did not explicitly account for all constraints (e.g., total cost for optimal cost and variance for optimal variance).
Rounding Improvements
Length: ~160 lines of code
Why: Results are now fully reproducible across runs and no longer depend on random selection.
Validation and Error Handling
Length: ~10 lines of code
Why: Provides clearer feedback and prevents invalid or misleading allocations from being returned.
Documentation Updates
outputsargumentTest Updates
outputsargument,N.h) enforcement,lbound == N.hedge cases,Why: Keeps documentation and test coverage aligned with the refactored implementation.
Addendum
After I made yesterday's patches, I noticed that I inadvertly switched back to non-ASCII symbols. I fixed that in allocate.R and allocate.Rd today.