Learn R Programming

mclustAddons (version 0.10)

hypcube_smc: Simple Monte Carlo Sampling

Description

This function generates a Simple Monte Carlo (SMC) random design matrix over the hypercube.

Usage

hypcube_smc(n, d, lbound = NA_real_, ubound = NA_real_)

Value

A n x d matrix containing the SMC design. Each element is scaled to the range defined by lbound and ubound.

Arguments

n

Integer. The number of samples points of the hypercube.

d

Integer. The the dimension of the hypercube.

lbound

Numeric vector of length d specifying the lower bounds for each dimension of the d-dimensional hypercube.

ubound

Numeric vector of length d specifying the ubound bounds for each dimension of the d-dimensional hypercube.

Examples

Run this code
x = hypcube_smc(100, 2)
plot(x, xlim = c(0,1), ylim = c(0,1))
rug(x[,1]); rug(x[,2], side = 2)
x = hypcube_smc(100, 2, lbound = c(-5,1), ubound = c(10,3))
plot(x, xlim = c(-5,10), ylim = c(1,3))
rug(x[,1]); rug(x[,2], side = 2)

Run the code above in your browser using DataLab