Add sliced and nested Latin hypercube designs#71
Merged
Conversation
Add two new design-generation functions: - slicedLHS(m, t, k) builds a sliced Latin hypercube design (Qian, 2012) composed of t slices of m points each. Every slice is a Latin hypercube design and the union of the slices is a Latin hypercube design. Slice membership is returned in the "slices" attribute. - nestedLHS(small, large, k) builds a nested Latin hypercube design (Qian, 2009) where the small design is a subset of the large design and both are Latin hypercube designs. Includes roxygen documentation and man pages, NAMESPACE exports, testthat tests covering the Latin properties and input validation, NEWS and README entries, and a version bump to 1.4.0.
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
Adds two new design-generation methods to the package, filling a gap in supported design types (previously there was no way to create designs with a slice/subset structure):
slicedLHS(m, t, k)— a sliced Latin hypercube design (Qian, 2012) made up oftslices ofmpoints each. Every slice is itself a Latin hypercube design, and the union of all slices is a Latin hypercube design ofn = m*tpoints. Useful for computer experiments mixing quantitative and qualitative factors (one slice per level combination) and for collecting data in batches. Slice membership is returned in the"slices"attribute of the result.nestedLHS(small, large, k)— a nested Latin hypercube design (Qian, 2009) in which thesmall-point design is a subset of thelarge-point design and both are valid Latin hypercube designs. Useful for two-level / multi-fidelity computer experiments. Returns a list with$smalland$large, where$smallis the firstsmallrows of$large.Both are implemented in pure R (the constructions are simple combinatorial assignments), matching the style of the existing
augmentLHS.What's included
R/slicedLHS.R,R/nestedLHS.Rwith roxygen documentationman/slicedLHS.Rd,man/nestedLHS.RdNAMESPACEexportstests/testthat/test-slicedlhs.R,test-nestedlhs.R) covering the Latin properties of the union/slices/subsets and input validation, using the existingcheckLatinHypercubehelperNEWS,README(.Rmd+.md) entries, updated packageDescription, and a version bump to1.4.0Verification
R is not available in the build environment used to prepare this branch, so the
testthatsuite was not executed here — please runR CMD check/devtools::test()before merging. The construction algorithms were validated by porting them to an independent script and confirming, over 2000 randomized trials each, that:smallrows of the large designReferences
Notes / possible follow-ups
nestedLHSimplements the canonical two-layer case (largemust be an integer multiple ofsmall). A multi-layer chain (n_1 | n_2 | ... | n_L) could be a future extension.roxygen2::roxygenise()should produce an identical result.https://claude.ai/code/session_01JNVgdYk9zNB8B4hLSn8rzj
Generated by Claude Code