TransWikia.com

Latin Hypercube Sampling (LHS) in R

Geographic Information Systems Asked by Bineet on November 12, 2021

I am new to R and would like to generate Latin Hypercube samples (LHS) for three variables within the following limts:

  • 1.25 ≤ x1 ≤ 5 ,

  • 1.25 ≤ x2 ≤ 5

  • 7 ≤ x1 ≤ 25

with total 3*10 = 30 samples.

What is the syntax to be used in Rstudio?

One Answer

I would recommend using the lhs package documentation for reference

You would need to install the released version of lhs from CRAN

install.packages("lhs")

or via devtools

devtools::install_github("bertcarnell/lhs")

in your case a example to create a random LHS with 30 samples and 3 variables would be:

X <- randomLHS(30, 3)

Answered by whyzar on November 12, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP