Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Augment a bounded Latin Hypercube in R

Tags:

r

I have created a table of parameter sets sampling the parameter ranges using a Latin Hypercube.

library(tgp)
rect <- rbind(x1 = c(25,500),               
              x2 = c(50,5000),                  
              x3 = c(0.05,0.95),                
              x4 = c(1,20),                     
              x5 = c(1,250),  
              x6   = c(1,5),  
              x7  = c(0.05,0.95), 
              x9   = c(0.01,1000) )

# Define number of samples
n <- 1000

#Generate parameters
set.seed(123)
parameters <- lhs(n, rect)

Now, how can I augment the LH adding x10, which range is between 0.01 and 0.5, without changing the other parameters?

like image 348
Claudia Avatar asked Jan 22 '26 22:01

Claudia


1 Answers

rbind makes a new table, it doesn't modify the table(s) it is being called on; so the following works:

parameters.new <- lhs(n, rbind(rect, x10 = c(0.01, 0.5)))
like image 165
huon Avatar answered Jan 24 '26 12:01

huon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!