runif_outside_range {ICSClust} | R Documentation |
Uniform distribution outside a given range
Description
Draw from a multivariate uniform distribution outside a given range. Intuitively speaking, the observations are drawn from a multivariate uniform distribution on a hyperrectangle with a hole in the middle (in the shape of a smaller hyperrectangle). This is useful, e.g., for adding random noise to a data set such that the noise consists of large values that do not overlap the initial data.
Usage
runif_outside_range(n, min = 0, max = 1, mult = 2)
Arguments
n |
an integer giving the number of observations to generate. |
min |
a numeric vector giving the minimum of each variable of the initial data set (outside of which to generate random noise). |
max |
a numeric vector giving the maximum of each variable of the initial data set (outside of which to generate random noise). |
mult |
multiplication factor (larger than 1) to expand the
hyperrectangle around the initial data (which is given by |
Value
A matrix of generated points.
Author(s)
Andreas Alfons
References
#' Alfons, A., Archimbaud, A., Nordhausen, K., & Ruiz-Gazen, A. (2022). Tandem clustering with invariant coordinate selection. arXiv preprint arXiv:2212.06108.
Examples
## illustrations for argument 'mult'
# draw observations with argument 'mult = 2'
xy2 <- runif_outside_range(1000, min = rep(-1, 2), max = rep(1, 2),
mult = 2)
# each side of the larger hyperrectangle is twice as long as
# the corresponding side of the smaller rectanglar cut-out
df2 <- data.frame(x = xy2[, 1], y = xy2[, 2])
ggplot(data = df2, mapping = aes(x = x, y = y)) +
geom_point()
# draw observations with argument 'mult = 4'
xy4 <- runif_outside_range(1000, min = rep(-1, 2), max = rep(1, 2),
mult = 4)
# each side of the larger hyperrectangle is four times as long
# as the corresponding side of the smaller rectanglar cut-out
df4 <- data.frame(x = xy4[, 1], y = xy4[, 2])
ggplot(data = df4, mapping = aes(x = x, y = y)) +
geom_point()