[R] Latin Hyper cube with condition col1+ col2 < x

Boris Steipe boris.steipe at utoronto.ca
Thu Oct 15 15:19:42 CEST 2015


I don't think the problem is well defined. Otherwise you could just pick very small numbers from a range that is guaranteed to keep the sum < h. 


B.

On Oct 15, 2015, at 8:48 AM, Rainer M Krug <Rainer at krugs.de> wrote:

> Hi
> 
> I need a Latin Hypercube with the following conditions:
> 
> 0 < x[,"a"] < 1
> 0 < x[,"b"] < 1
> 0 < x[,"c"] < 1
> 
> but also
> 
> x[,"a"] + x[,"b"] < h
> 
> The first three are easy:
> 
> --8<---------------cut here---------------start------------->8---
> n <- 1000
> 
> lhc <- lhs::randomLHS(n=n, k=3
> colnames(lhc) <- c("a", "b", "c")
> 
> x <- lhc
> --8<---------------cut here---------------end--------------->8---
> 
> Now the last condition:
> 
> I tried
> 
> --8<---------------cut here---------------start------------->8---
> h <- 28
> x[,"a"] <- x[,"a"] / 2
> x[,"b"] <- x[,"b"] / 2
> --8<---------------cut here---------------end--------------->8---
> 
> But this obviously reduces the individual ranges.
> 
> Using the rowSum as in 
> https://stat.ethz.ch/pipermail/r-help/2013-October/361263.html
> 
> makes the sum of the variables also to 2.
> 
> So how can I create a Latin Hypercube which fulfills the conditions?
> 
> Rainer
> 
> -- 
> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)
> 
> Centre of Excellence for Invasion Biology
> Stellenbosch University
> South Africa
> 
> Tel :       +33 - (0)9 53 10 27 44
> Cell:       +33 - (0)6 85 62 59 98
> Fax :       +33 - (0)9 58 10 27 44
> 
> Fax (D):    +49 - (0)3 21 21 25 22 44
> 
> email:      Rainer at krugs.de
> 
> Skype:      RMkrug
> 
> PGP: 0x0F52F982
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list