This function creates a vector of levels based on a continuous vector. It allows to force all the levels desired for some of the variables respecting the correlation of the variable with other variable in a module.

cut_levels(
  categorical = soil_cat,
  cat_inc_all_levels = c("siteid", "yes_no_sample"),
  levels_inc_all = list(siteid = c(1:16), yes_no_sample = c(1:2)),
  continuous_to_cut = sim_data_cop$simulated,
  corrs = soil_corr
)

Arguments

categorical

categorical variables in a module

cat_inc_all_levels

categorical variables which all levels must be in final simulations

levels_inc_all

levels of above

continuous_to_cut

a matrix containing values simulated from copulas

corrs

a coorelation matrix