Convenient helper function, which creates an initial sample - either based on random (uniform) sampling or using latin hypercube sampling.

createInitialSample(n.obs, dim, control)

Arguments

n.obs

[integer(1)] Number of observations.

dim

[integer(1)] Number of dimensions.

control

[list] Control argument. For further information refer to the details.

Value

[matrix]. A matrix, consisting of n.obs rows of dim-dimensional observations.

Details

Per default, this function will produce n.obs observations of size dim in the range from 0 to 1. If you want to create a more specific initial sample, the following control arguments might be helpful:

  • init_sample.type: Should the initial sample be created based on random uniform sampling ("random") or on a latin hypercube sample ("lhs")? The default is "random".

  • init_sample.lower: The lower bounds of the initial sample. Either a vector of size dim or a scalar (if all lower bounds are identical). The default is 0.

  • init_sample.upper: The upper bounds of the initial sample. Either a vector of size dim or a scalar (if all upper bounds are identical). The default is 1.

Examples

# (1) create a simple initial sample: X = createInitialSample(300, 5) summary(X)
#> V1 V2 V3 V4 #> Min. :0.0009579 Min. :0.002401 Min. :0.008509 Min. :0.0006031 #> 1st Qu.:0.2429917 1st Qu.:0.245017 1st Qu.:0.253667 1st Qu.:0.2406380 #> Median :0.4928397 Median :0.492408 Median :0.482884 Median :0.4880612 #> Mean :0.4993741 Mean :0.495573 Mean :0.500302 Mean :0.4919303 #> 3rd Qu.:0.7380544 3rd Qu.:0.725750 3rd Qu.:0.759592 3rd Qu.:0.7402251 #> Max. :0.9964129 Max. :0.995568 Max. :0.996453 Max. :0.9970272 #> V5 #> Min. :0.005146 #> 1st Qu.:0.233525 #> Median :0.467263 #> Mean :0.477459 #> 3rd Qu.:0.722433 #> Max. :0.999062
# (2) create a more specific initial sample: ctrl = list(init_sample.type = "lhs", init_sample.lower = c(-5, 2, 0), init_sample.upper = 10) X = createInitialSample(200, 3, control = ctrl) summary(X)
#> V1 V2 V3 #> Min. :-4.945 Min. : 2.016 Min. :0.007931 #> 1st Qu.:-1.222 1st Qu.: 4.001 1st Qu.:2.517489 #> Median : 2.512 Median : 6.010 Median :4.988256 #> Mean : 2.500 Mean : 6.001 Mean :5.000196 #> 3rd Qu.: 6.244 3rd Qu.: 7.989 3rd Qu.:7.495977 #> Max. : 9.927 Max. :10.000 Max. :9.954831