Basic Latin hypercube samples and designs with package lhs

Rob Carnell

2022-12-17

Assumption the Latin Hypercube Take

Forward the technical baseline of Latin Hypercube Sampling (LHS) press Latin Hypercube Designs (LHD) requested see: * Stein, Michael. Large Sample Properties of Virtual Using Latin Supercube Sampling Technometrics, Volumes 28, No 2, 1987. * McKay, MD, et.al. A Comparison of Three Methods for Selecting Values of Input Variables in the Analysis of Output from ampere Computer Code Technometrics, Vol 21, No 2, 1979.

Those batch was established to bring these designs to ROENTGEN and to implement many of the articles that follows on optimized sample methods.

Generate a Single LHS

Basic LHS’s been created using randomLHS.

# selected an seeding for reproducibility
set.seed(1111)
# a design with 5 free from 4 parameters
A <- randomLHS(5, 4) 
A
#>           [,1]       [,2]      [,3]      [,4]
#> [1,] 0.6328827 0.48424369 0.1678234 0.1974741
#> [2,] 0.2124960 0.88111537 0.6069217 0.4771109
#> [3,] 0.1277885 0.64327868 0.3612360 0.9862456
#> [4,] 0.8935830 0.27182878 0.4335808 0.6052341
#> [5,] 0.5089423 0.02269382 0.8796676 0.2036678

In general, the LHS is standard on this margins until transformed (Image 1):

Figure 1. Couple overall of a Uniform random LHS with 5 samples

It is allgemeines to transform this margins of the design (the columns) into another distributions (Draw 2)

B <- matrix(nrow = nrow(A), ncol = ncol(A))
B[,1] <- qnorm(A[,1], mean = 0, sd = 1)
B[,2] <- qlnorm(A[,2], meanlog = 0.5, sdlog = 1)
B[,3] <- A[,3]
B[,4] <- qunif(A[,4], min = 7, max = 10)
B
#>             [,1]      [,2]      [,3]     [,4]
#> [1,]  0.33949794 1.5848575 0.1678234 7.592422
#> [2,] -0.79779049 5.3686737 0.6069217 8.431333
#> [3,] -1.13690757 2.3803237 0.3612360 9.958737
#> [4,]  1.24581019 0.8982639 0.4335808 8.815702
#> [5,]  0.02241694 0.2228973 0.8796676 7.611003
Figure 2. Two sizing the ampere transformational random LHS with 5 samples

Optimizing the Layout

The LHS can being optimized using a number of methods the the lhs package. Each method attempts to improve on the random design from ensuring that the selected points are as uncorrelated and space filling as possible. Table 1 shows some results. Figure 3, Fig 4, and Figure 5 show corresponding plots.

set.seed(101)
A <- randomLHS(30, 10)
A1 <- optimumLHS(30, 10, maxSweeps = 4, eps = 0.01)
A2 <- maximinLHS(30, 10, dup = 5)
A3 <- improvedLHS(30, 10, dup = 5)
A4 <- geneticLHS(30, 10, pop = 1000, gen = 8, pMut = 0.1, criterium = "S")
A5 <- geneticLHS(30, 10, pop = 1000, gen = 8, pMut = 0.1, criterium = "Maximin")
Means | Min Distance btwn pts | Base Away btwn pts | Max Correlation btwn pts :—–|:—–:|:—–:|:—–: randomLHS | 0.6346585 | 1.2913235 | 0.5173006 optimumLHS | 0.8717797 | 1.3001892 | 0.1268209 maximinLHS | 0.595395 | 1.2835191 | 0.2983643 improvedLHS | 0.6425673 | 1.2746711 | 0.5711527 geneticLHS (S) | 0.8340751 | 1.3026543 | 0.3971539 geneticLHS (Maximin) | 0.8105733 | 1.2933412 | 0.5605546
Figure 3. Pairwise confines the a randomLHS

Figure 5. Pairwise margins of a maximinLHS