# Latin hypercube sampling with categorical variables

I would like to run sensitivity analyses on my agent-based model. My model has 20 parameters that I need to vary. I generated 8 artificial landscapes that vary in resource aggregation (r) and my model runs on these landscapes. I used a Latin Hypercube Sampling design (LHS) to generate sets of parameters (N = 100) used as inputs for the simulations. I chose a LHS design rather a full factorial design in order to reduce the number of simulations. However, I have doubts about how to perform sensitivity analyses using artificial landscapes. Is it more appropriate:

1) To run the model using the 100 sets of parameters on each artificial landscape ?, or

2) To include the resource aggregation parameter (r) as an input parameter for the simulations, then to run the model using the 100 sets of parameters? In this case, how can I vary the parameter r from the LHS given that this parameter is a factor with 8 levels?

Next, I am planning to perform a random forest analysis.

• Regarding your last question, how is the discrete nature of $r$ an obstacle? R's ParamHelpers, at least, allows you to define discrete parameters and then generate Latin hypercube samples with them (even when the parameter set that includes continuous parameters, too). Jan 24 '19 at 18:57

> require(lhs)
> X <- randomLHS(100, 21)
> # e.g. parameter 1 is a normally distributed variable with mean 5 and sd 2
> Y <- as.data.frame(X)
> names(Y) <- c(paste("V",1:20,sep=""), "r")
> Y$$v1 <- qnorm(X[,1], 5, 2) > # continue with each of your 20 parameters > # now for the resource aggregation... > Y$$r <- floor(X[,21]*8) + 1
>
> hist(Y$$v1) # fine > table(Y$$r) # not uniformly distributed because 100 %% 8 != 0, but close

1  2  3  4  5  6  7  8
13 12 12 13 13 12 13 12

`