search for: randomlh

Displaying 13 results from an estimated 13 matches for "randomlh".

Did you mean: randomly
2017 Aug 04
2
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 07
2
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 07
0
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 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 eac...
2017 Aug 08
0
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 u...
2013 Oct 08
3
Latin Hypercube Sample and transformation to uniformly distributed integers or classes
...binations for my model input 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. So...
2017 May 27
2
Latin Hypercube Sampling when parameters are defined according to specific probability distributions
...o contact the package maintainer first. set.seed(1) # I don't think your model has only one parameter, so I will include multiple input_parameters <- c("dispersal_distance", "temperature", "pressure") N <- 50 exponential_rate <- 1/30 library(lhs) X <- randomLHS(N, length(input_parameters)) dimnames(X) <- list(NULL, input_parameters) # X is now a uniformly distributed Latin hypercube head(X) hist(X[,1], breaks=5) hist(X[,2], breaks=5) hist(X[,3], breaks=5) # now, transform the dispersal_distance paramter to an exponential sample Y <- X Y[,"disp...
2008 Nov 23
2
Latin Hypercube with condition sum = 1
Hi I want to du a sensitivity analysis using Latin Hypercubes. But my parameters have to fulfill two conditions: 1) ranging from 0 to 1 2) have to sum up to 1 So far I am using the lhs package and am doing the following: library(lhs) ws <- improvedLHS(1000, 7) wsSums <- rowSums(ws) wss <- ws / wsSums but I think I can't do that, as after the normalization > min(wss) [1]
2007 Jan 22
1
Latin hyper cube sampling from expand.grid()
Dear R experts I am looking for a package which gives me latin hyper cube samples from the grid of values produced from the command "expand.grid". Any pointers to this issue might be very useful. Basically, I am doing the following: > a<-(1:10) > b<-(20:30) > dataGrid<-expand.grid(a,b) Now, is there a way to use this "dataGrid" in the package
2011 May 31
2
Latin Hypercube Sampling with a condition
Hello all, I am trying to do a Latin Hypercube Sampling (LHS) to a 5-parameter design matrix. I start as follows: library(lhs) p1<-randomLHS(1000, 5) If I check the distribution of each parameter (column), they are perfectly uniformly distributed (as expected).For example, hist(p1[,1]) Now the hard (maybe strange) question. I want the combination of the first three parameters to sum up to 1 (which obviously do not) s<-p1[,1]+p1[...
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_distan...
2017 Jun 01
0
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 > &...
2013 Feb 19
1
latin hypercube sampling
Hi all, I am attempting to use latin hypercube sampling to sample different variable functions in a series of simultaneous differential equations. There is very little code online about lhs or clhs, so from different other help threads I have seen, it seems I need to create a probability density function for each variable function, and then use latin hypercube sampling on this pdf. So far, I