Build design grids from plot coordinates, and support designs spanning multiple grids - #119
Merged
Conversation
KNOWN_ISSUES.md #1 is being reduced to a pointer, so record here why a buffered design breaks the complete-lattice assumption. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Grid-based metrics were computed from the order of rows in the data frame rather than each plot's
row/colcoordinates, so they described a layout that wasn't the design. Four functions each assumed an ordering — two row-major, two column-major. All now read coordinates via a single validated primitive.That change made the grid contract strict, which exposed the rest:
grid_factorsgains an optionalbyargument naming the column that separates grids; adjacency, neighbour balance and piepho's evenness are computed per grid, and efficiency is reported one value per site.calculate_efficiency_factor()returned a plausible-looking value (usually above 1, which is impossible) for designs whose treatment contrasts aren't estimable. It now refuses with a reason. The row-column model gained an intercept, which is what makes the rank test exact; verified against both published designs (0.834, 0.827) and brute-force contrast variances, no existing value changes.summary()no longer dies on a design it can't place on one grid; it reports why each metric is unavailable.objective_function_piepho()designs should be regenerated — it previously scrambled the treatment column against its coordinates.Tests: 1787 pass, 0 fail, 0 warnings. Several existing tests asserted values for designs base R's own
lm()confirms are non-estimable; those fixtures were replaced, keeping each test's original intent.Merge order: PR #97 (
feature/incidence) callsbuild_design_matrix(), which doesn't exist on main, so it must merge after this and be rebased onto it.