Learn R Programming

intrinsicDimension (version 1.2.0)

addNoise: Add Noise to Data Set

Description

Embeds the data in n dimensions and adds normal isotropic noise to the data set. Hence n has to be at least equal to the dimension (the number of columns) of the data set, otherwise the function terminates with an error.

Usage

addNoise(data, n = ncol(data), sd)

Arguments

data

data set. Each row corresponds to a data point.

n

dimension of noise.

sd

standard deviation of noise. The covariance matrix of the noise is \(sd^2 \cdot I\).

Value

Matrix of same size as data.

Examples

Run this code
# NOT RUN {
datap <- hyperCubeEdges(100, 1, 2)
datap <- addNoise(datap, 3, .05)
par(mfrow = c(1, 2))
plot(datap[, 1], datap[, 2])
plot(datap[, 1], datap[, 3])
# }

Run the code above in your browser using DataLab