# [R] Latin Hypercube Sampling when parameters are defined according to specific probability distributions

Nelly Reduan nell.redu at hotmail.fr
Fri May 26 17:55:28 CEST 2017

```Hello,

I would like to perform a sensitivity analysis using a Latin Hypercube Sampling (LHS).

Among the input parameters in the model, I have a parameter “dispersal distance” which is defined according to an exponential probability distribution.

In the model, the user thus sets a default probability value for each distance class.

For example, for distances ([0 – 2]; ]2 – 4]; ]4 – 6]; ]6 – 8]; ]8 – 10];……; ]48 – 50],

respective probabilities are 0.055; 0.090; 0.065; 0.035; 0.045;………; 0.005.

Here is the code to represent an exponential probability distribution for the parameter “dispersal distance”:

set.seed(0)
foo <- rexp(100, rate = 1/10)
hist(foo, prob=TRUE, breaks=20, ylim=c(0,0.1), xlab ="Distance (km)")
lines(dexp(seq(1, 100, by = 1), rate = 1/mean(foo)),col="red")
1/mean(foo)

When a parameter is defined according to a specific probability distribution, how can I perform a LHS ?
For example, should I sample N values from a uniform distribution for each distance class (i.e., [0 – 2]; ]2 – 4]; ]4 – 6]; ]6 – 8]; ]8 – 10];……; ]48 – 50])
or sample N values from exponential distributions with different rates ?

Here is the code used to perform a LHS when the parameter “dispersal distance” is defined by  one default value in the model:

library(pse)

factors <- c("distance")

q <- c("qexp")

q.arg <- list( list(rate=1/30) )

uncoupledLHS <- LHS(model=NULL, factors, 50, q, q.arg)

head(uncoupledLHS)

Thanks a lot for your time.
Have a nice day
Nell

[[alternative HTML version deleted]]

```

More information about the R-help mailing list