Displaying 8 results from an estimated 8 matches for "randomlhs".

2017 Aug 07

1

Latin hypercube sampling from a non-uniform distribution

> How can I draw a Hypercube sample for the variable mortality_probability so
> that this variable exhibits the same pattern as the observed distribution?
One simple way is to use the uniform random output of randomLHS as input to the quantile function for your desired distribution(s).
For example:
q <- randomLHS(1000, 3)
colnames(q) <- c("A", "B", "mort")
q[, "mort"] <- qpois(q[,"mort"], 1.5)
S Ellison
******************************************...

2017 Aug 07

1

Latin hypercube sampling from a non-uniform distribution

...ty <- round(ppois(seq(0, 7, by = 1), lambda = 0.9), 2)
barplot(mortality_probability, names.arg = seq(0, 7, by = 1), xlab = "Age class", ylab = "Probability")
library(lhs)
set.seed(1)
parm <- c("var1", "var2", "mortality_probability")
X <- randomLHS(100, length(parm))
colnames(X) <- c("var1", "var2", "mortality_probability")
X[, "mortality_probability"] <- qpois(X[, "mortality_probability"], 0.9)
hist(X[, "mortality_probability"])
Thanks for your time
Marine
_____________...

2017 Aug 08

1

Latin hypercube sampling from a non-uniform distribution

...r representing the variable. I think that I need to draw a Hypercube sample for each age class (i.e., for 0, 1, 2, 3, 4, 5, 6, 7) in a given simulation (i.e., N = 1) and the LHS values for all age classes should be like the observed cumulative distribution (see attached figure). Thus, the output of randomLHS should be a matrix with 100 rows (N = 100 simulations) and 7 columns (7 age classes) containing LHS values and each row should exhibit the same pattern as the observed cumulative distribution.
With the command ?qpois(X[, "mortality_probability"], 0.9)?, I don?t obtain a LHS value for each...

2013 Oct 08

3

Latin Hypercube Sample and transformation to uniformly distributed integers or classes

...nput variables.
Therefore I came across an simple example here on the mailing list (
https://stat.ethz.ch/pipermail/r-help/2011-June/279931.html):
Easy Example
Parameter 1: normal(1, 2)
Parameter 2: normal(3, 4)
Parameter 3: uniform(5, 10)
require(lhs)
N <- 1000
x <- randomLHS(N, 3)
y <- x
y[,1] <- qnorm(x[,1], 1, 2)
y[,2] <- qnorm(x[,2], 3, 4)
y[,3] <- qunif(x[,3], 5, 10)
par(mfrow=c(2,2))
apply(x, 2, hist)
par(mfrow=c(2,2))
apply(y, 2, hist)
However, some of my parameters are uniformly distributed integer values
and/or uniformly distributed classes....

2017 Aug 04

1

Latin hypercube sampling from a non-uniform distribution

...tion?
Here is a reproducible code to draw Hypercube samples (my sensitivity analysis includes several parameters and the variables ?var1? and ?var2? follow a uniform distribution):
library(lhs)
set.seed(1)
parm <- c("var1", "var2", "mortality_probability")
X <- randomLHS(100, length(parm))
Any suggestions would be much welcome.
Thanks for your time
Marine
[[alternative HTML version deleted]]

2017 Aug 08

1

Latin hypercube sampling from a non-uniform distribution

...lated from the cumulative distribution function
> of the Poisson distribution.
Then I am afraid I don't know what you're trying to achieve.
Or why.
However, the principle holds; write a function that maps [0,1] to the 'pattern' you want, do that and apply it to the result from randomLHS.
It happens that for generating data that follow a given probability distribution F, that function is the quantile function for F so you often do not need to write it.
*******************************************************************
This email and any attachments are confidential. Any us...

Latin Hypercube Sampling when parameters are defined according to specific probability distributions

2017 Jun 01

1

Latin Hypercube Sampling when parameters are defined according to specific probability distributions

...aste0("d", 1:25), ordered = TRUE,
levels=paste0("d", 1:25))
input_parameters <- c("dispersal_distance", "temperature", "pressure")
N <- 1000
plot(1:25, distance_class_probabilities, type="h", lwd=5)
set.seed(1)
require(lhs)
X <- randomLHS(N, length(input_parameters))
dimnames(X) <- list(NULL, input_parameters)
Y <- X
Y[,"dispersal_distance"] <-
approx(x=cumsum(distance_class_probabilities), y=1:25,
xout=X[,"dispersal_distance"], method="constant", yleft=0)$y + 1
hist(Y[,"dispersal_distanc...

Latin Hypercube Sampling when parameters are defined according to specific probability distributions

2017 Jun 01

1

Latin Hypercube Sampling when parameters are defined according to specific probability distributions

...> levels=paste0("d", 1:25))
> input_parameters <- c("dispersal_distance", "temperature", "pressure")
> N <- 1000
>
> plot(1:25, distance_class_probabilities, type="h", lwd=5)
>
> set.seed(1)
> require(lhs)
> X <- randomLHS(N, length(input_parameters))
> dimnames(X) <- list(NULL, input_parameters)
> Y <- X
> Y[,"dispersal_distance"] <-
> approx(x=cumsum(distance_class_probabilities), y=1:25,
> xout=X[,"dispersal_distance"], method="constant", yleft=0)$y + 1
>
&g...