rnorm.noise | R Documentation |
rnorm.noise
generates n random normal deviates about a mean value with a
specified standard deviation.
rnorm.noise(Data, n, sd)
Data |
frame with two columns. 1st column identifies the group and the 2nd identifies the mean for that group |
n |
integer specifying the number of random normal deviates to generate for each value of x. |
sd |
standard deviation of the random normal deviates to be created. |
An object of class 'data frame' that contains two columns, one
representing the "group" defined by the x
parameter and one
representing individual random normal deviates about the given "group".
# Example rnorm.noise(Data=c(1, 10), n = 10, sd = 0.5) # Example 2 # Signal data x <- seq(0, 4 * pi, length = 241) y <- scales::rescale(cos(seq(0, 4 * pi, length = 241)), to=c(0.2, 0.8)) plot(y ~ seq(0, 24, 0.1), type = "l", xaxt = "n", xlab="Month") axis(1, at = seq(0, 24, 1), labels = c (rep(month.abb, 2),"Jan")) # Noise Data noise <- apply(data.frame(x=seq(0, 24, 0.1), y = y), 1, rnorm.noise, n = 10, sd = 0.1) noise.df <- Reduce(function(...) merge(..., all = TRUE), noise) # Plot Noise plot(noise.df[, 2] ~ noise.df[, 1], pch = 20, ylab = "Proportion", xlab = "Month", xaxt="n") axis(1, at = seq(0, 24, 1), labels = c (rep(month.abb, 2),"Jan"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.