{"id":25441404,"url":"https://github.com/bertcarnell/lhs","last_synced_at":"2025-04-06T12:13:02.501Z","repository":{"id":56928885,"uuid":"159986717","full_name":"bertcarnell/lhs","owner":"bertcarnell","description":"Provides a number of methods for creating and augmenting Latin Hypercube Samples and Orthogonal Array Latin Hypercube Samples","archived":false,"fork":false,"pushed_at":"2024-06-30T23:16:19.000Z","size":28355,"stargazers_count":45,"open_issues_count":9,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-30T11:07:24.507Z","etag":null,"topics":["latin-hypercube","latin-hypercube-sample","latin-hypercube-sampling","lhs","orthogonal-arrays","r","r-package"],"latest_commit_sha":null,"homepage":"https://bertcarnell.github.io/lhs/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bertcarnell.png","metadata":{"files":{"readme":"README.Rmd","changelog":"ChangeLog","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-01T20:59:29.000Z","updated_at":"2025-03-03T05:25:49.000Z","dependencies_parsed_at":"2024-01-28T20:34:38.700Z","dependency_job_id":"af2f1a8d-e288-4396-b5a6-f8998ad3ab55","html_url":"https://github.com/bertcarnell/lhs","commit_stats":{"total_commits":355,"total_committers":6,"mean_commits":"59.166666666666664","dds":"0.45633802816901403","last_synced_commit":"2f2d1a3f355a50c122380f6a244213b959e4fcb3"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bertcarnell%2Flhs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bertcarnell%2Flhs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bertcarnell%2Flhs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bertcarnell%2Flhs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bertcarnell","download_url":"https://codeload.github.com/bertcarnell/lhs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247478331,"owners_count":20945266,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["latin-hypercube","latin-hypercube-sample","latin-hypercube-sampling","lhs","orthogonal-arrays","r","r-package"],"created_at":"2025-02-17T12:28:00.808Z","updated_at":"2025-04-06T12:13:02.484Z","avatar_url":"https://github.com/bertcarnell.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\ntitle: \"lhs\"\noutput: \n  md_document:\n    variant: markdown_github\n  \n---\n\n\u003cdiv\u003e\n  \u003ctable\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\n        \u003cimg align=\"left\" width=\"200\" height=\"200\" src=\"logo.svg\"/\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/table\u003e\n\u003c/div\u003e\n\n```{r setup, include=FALSE}\nrequire(knitr)\n```\n\n```{r badges, echo=FALSE, results=\"asis\"}\ncat(paste0(\"|\u003csub\u003e\", \n           paste0(\n             c(\"Actions\", \"Code Coverage\", \"Website\", \"Doxygen\", \"CRAN Downloads\", \"CRAN\"), \n             collapse=\"\u003c/sub\u003e|\u003csub\u003e\"), \n           \"\u003c/sub\u003e|\\n\"))\ncat(paste0(\"|\", paste0(rep(\":---:\", 6), collapse=\"|\"), \"|\\n\"))\ncat(paste0(\"|\", \n           paste0(c(\"[![R build status](https://github.com/bertcarnell/lhs/workflows/R-CMD-check/badge.svg)](https://github.com/bertcarnell/lhs/actions)\",\n                    \"[![Coverage status](https://codecov.io/gh/bertcarnell/lhs/branch/master/graph/badge.svg)](https://codecov.io/github/bertcarnell/lhs?branch=master)\",\n                    \"[![](https://img.shields.io/badge/pkgdown-lhs-blue.svg)](https://bertcarnell.github.io/lhs/)\",\n                    \"[![](https://img.shields.io/badge/Doxygen-lhs-blue.svg)](https://bertcarnell.github.io/lhs/html/index.html)\",\n\n                    \"[![](https://cranlogs.r-pkg.org/badges/lhs)](https://cran.r-project.org/package=lhs)\",\n                    \"[![CRAN status](https://www.r-pkg.org/badges/version/lhs)](https://cran.r-project.org/package=lhs)\"), \n                  collapse=\"|\"), \n           \"|\"))\n```\n\n# lhs\n\n`lhs` provides a number of methods for creating and augmenting \nLatin Hypercube Samples and Orthogonal Array Latin Hypercube Samples.\n\n- Reverse Dependency Checks\n    - [Depends](etc/revdep_README_Depends.md)\n    - [Imports](etc/revdep_README_Imports.md)\n    - [Suggests](etc/revdep_README_Suggests.md)\n- Docker Images for Testing\n    - [lhs-debug](https://hub.docker.com/repository/docker/bertcarnell/lhs-debug)\n    - [lhs-revdep](https://hub.docker.com/repository/docker/bertcarnell/lhs_revdep) built from [here](https://github.com/bertcarnell/r-debug)\n\n## Installation\n\nYou can install the released version of `lhs` from [CRAN](https://CRAN.R-project.org) with:\n\n```{r install1, echo=TRUE, eval=FALSE}\ninstall.packages(\"lhs\")\n```\n\nYou can also install the development version of `lhs` from github with:\n\n```{r install2, echo=TRUE, eval=FALSE}\nif (!require(devtools)) install.packages(\"devtools\")\ndevtools::install_github(\"bertcarnell/lhs\")\n```\n\n## Quick Start\n\nCreate a random LHS with 10 samples and 3 variables:\n\n```{r random, echo=TRUE}\nrequire(lhs)\nset.seed(1776)\nX \u003c- randomLHS(n = 10, k = 3)\n```\n\nCreate a design that is more optimal than the random case:\n\n```{r compare, echo=TRUE}\nX_gen \u003c- geneticLHS(10, 3, pop = 100, gen = 5, pMut = 0.1)\nX_max1 \u003c- maximinLHS(10, 3, method = \"build\", dup = 5)\nX_max2 \u003c- maximinLHS(10, 3, method = \"iterative\", optimize.on = \"result\", eps = 0.01, maxIter = 300)\nX_imp \u003c- improvedLHS(10, 3, dup = 5)\nX_opt \u003c- optimumLHS(10, 3, maxSweeps = 10, eps = 0.01)\n```\n\n```{r compare.table, echo=FALSE}\ndf1 \u003c-   data.frame(\n  method = c(\"random\",\"genetic\",\"maximin\",\"maximin\",\"improved\",\"optimum\"),\n  mean_dist = c(mean(dist(X)), mean(dist(X_gen)), mean(dist(X_max1)),\n                mean(dist(X_max2)), mean(dist(X_imp)), mean(dist(X_opt))),\n  min_dist = c(min(dist(X)), min(dist(X_gen)), min(dist(X_max1)),\n               min(dist(X_max2)), min(dist(X_imp)), min(dist(X_opt))))\nknitr::kable(df1[order(df1$min_dist, decreasing = TRUE),],\n             col.names = c(\"Method\", \"Mean Distance\", \"Minimum Distance\"),\n             digits = 4)\n```\n\nAugment an existing design:\n\n```{r augment, echo=TRUE}\nY \u003c- randomLHS(10, 5)\nZ \u003c- augmentLHS(Y, 2)\ndim(Z)\n```\n\nBuild an orthogonal array LHS:\n\n```{r oalhs, echo=TRUE}\n# a 9 row design is returned because a 10 row design is not possible with these algorithms\nW9 \u003c- create_oalhs(10, 3, bChooseLargerDesign = FALSE, bverbose = FALSE)\ndim(W9)\n\n# a 16 row design is returned because a 10 row design is not possible with these algorithms\nW16 \u003c- create_oalhs(10, 3, bChooseLargerDesign = TRUE, bverbose = FALSE)\ndim(W16)\n```\n\n## Help\n\nR-Help Examples of using the LHS package\n\n- [Latin hyper cube sampling from expand.grid()](https://stat.ethz.ch/pipermail/r-help/2007-January/124143.html)\n- [Latin Hypercube Sampling with a condition](https://stat.ethz.ch/pipermail/r-help/2011-June/279906.html)\n- [Latin Hypercube with condition sum = 1](https://stat.ethz.ch/pipermail/r-help/2008-November/180929.html)\n- [Latin hypercube sampling](https://www.mail-archive.com/r-help@r-project.org/msg192704.html)\n- [Latin Hypercube Sample and transformation to uniformly distributed integers or classes](https://stat.ethz.ch/pipermail/r-help/2013-October/361263.html)\n- [Latin hypercube sampling from a non-uniform distribution](https://stat.ethz.ch/pipermail/r-help/2017-August/448475.html)\n- [Latin Hypercube Sampling when parameters are defined according to specific probability distributions](https://stat.ethz.ch/pipermail/r-help/2017-June/447266.html)\n\nStackExchange Examples:\n\n- [Latin Hypercube around set points](https://stats.stackexchange.com/questions/370983/latin-hypercube-around-set-points)\n- [Latin hypercube sampling with categorical variables](https://stats.stackexchange.com/questions/388963/latin-hypercube-sampling-with-categorical-variables)\n- [Are Latin hypercube samples uncorrelated](https://stats.stackexchange.com/questions/147789/are-latin-hypercube-samples-uncorrelated)\n- [Stopping rule for Latin hypercube sampling (LHS)](https://stats.stackexchange.com/questions/407262/stopping-rule-for-latin-hypercube-sampling-lhs)\n- [Is a group of random hypercube samples equivalent to a single latin hypercube with more samples?](https://stats.stackexchange.com/questions/411085/is-a-group-of-random-hypercube-samples-equivalent-to-a-single-latin-hypercube-wi)\n- [Taking samples of data using Latin Hypercube Sampling](https://stats.stackexchange.com/questions/439271/taking-samples-of-data-using-latin-hypercube-sampling)\n- [Number of parameter sets generated by latin hyercube sampling](https://stats.stackexchange.com/questions/460918/number-of-parameter-sets-generated-by-latin-hyercube-sampling)\n- [Is there a way to check if sample obeys the Latin Hypercube Sampling rule?](https://stats.stackexchange.com/questions/465492/is-there-a-way-to-check-if-sample-obeys-the-latin-hypercube-sampling-rule)\n- [Effectiveness of Latin Hypercube Sampling](https://stats.stackexchange.com/questions/468202/effectiveness-of-latin-hypercube-sampling)\n- [Dividing CDF rather than PDF equally in Latin Hypercube Sampling](https://stats.stackexchange.com/questions/468293/dividing-cdf-rather-than-pdf-equally-in-latin-hypercube-sampling)\n- [Stratified sampling / QMC simulation for compound Poisson rv](https://stats.stackexchange.com/questions/469963/stratified-sampling-qmc-simulation-for-compound-poisson-rv)\n- [Using Latin Hypercube Sampling with a condition that the sum of two variables should be less than one](https://stats.stackexchange.com/questions/474911/using-latin-hypercube-sampling-with-a-condition-that-the-sum-of-two-variables-sh)\n- [How to generate a design for a response surface with a discrete input random variable?](https://stats.stackexchange.com/questions/444997/how-to-generate-a-design-for-a-response-surface-with-a-discrete-input-random-var)\n- [Is it necessary to shuffle X coordinates in Latin hypercube Sampling?](https://stats.stackexchange.com/questions/498492/is-it-necessary-to-shuffle-x-coordinates-in-latin-hypercube-sampling-lhc)\n\n## Other\n\nlhs package announcement:  [R-pkgs New R-Packages: Triangle and LHS](https://stat.ethz.ch/pipermail/r-packages/2006/000715.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbertcarnell%2Flhs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbertcarnell%2Flhs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbertcarnell%2Flhs/lists"}