samplr | R Documentation |
facilitates the generation of a Latin hypercube for a set of variables based on inputs specified in a spreadsheet table.
samplr( myfilename = NULL, mytestspervariable = 10, myseed = 12345L, mymaxsweeps = 4, myeps = 0.01, mydup = 5, mypop = 1000, mygen = 8, mypmut = 0.1, mygraphsize = 1000, mypch = 19, mycol = "blue", mycex = 0.5 )
myfilename |
is the name of the input Excel file |
mytestspervariable |
the number of tests per variable in the input file |
myseed |
the random number seed to be used |
mymaxsweeps |
see lhs package documentation |
myeps |
see lhs package documentation |
mydup |
see lhs package documentation |
mypop |
see lhs package documentation |
mygen |
see lhs package documentation |
mypmut |
see lhs package documentation |
mygraphsize |
pixel dimension to be used for scatter graph matrices. see "width" and "height" in png grDevices. |
mypch |
see "pch" in par graphics |
mycol |
see "col" in par graphics |
mycex |
see "cex" in par graphics |
The spreadsheet should have only one sheet with the following columns and one row for each variable to be simulated:
Index (numeric)
Variable (character)
codename (character)
Base (numeric)
Minimum (numeric)
Mode (numeric)
Maximum (numeric)
Distribution (character) - Uniform, Triangular, or PERT.
Shape (numeric) - only needed if distribution is "PERT"
Six types of optimisation algorithm are tested:
randomLHS
optimumLHS
maximinLHS
improvedLHS
geneticsLHS - genetic algorithm with "S" criterium
geneticmLHS - genetic algorithm with "Maximin" criterium
The algorithm that minimises the maximum correlation ("max_corr") is selected to produce the recommended Latin hypercube. The details of the selected algorithm and the other algorithms tested are added to the sheet "optimisation_summary" of the results workbook.
myinputfile <- system.file("extdata", "risk_variable_distributions.xlsx", package = "humblr") mytest1 <- samplr(myinputfile, mytestspervariable = 10, myseed = 12345L, mymaxsweeps = 4, myeps = 0.01, mydup = 5, mypop = 1000, mygen = 8, mypmut = 0.1, mygraphsize = 1000, mypch = 19, mycol = "blue", mycex = 0.5) mytest1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.