Description Usage Arguments Value Author(s) References Examples
Generates noise by selecting from a mixture distribution of normal densities with means, standard deviations and probabilities provided
1 |
n |
Size of the noise vector to be outputted |
mean |
Vector of means corresponding to each component density |
sd |
Vector of standard deviations corresponding to each component density |
p |
Probability of selecting from each component distribution |
Vector of random numbers
Yan-Xia Lin
no references
1 2 3 4 5 6 7 8 9 10 11 12 13 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (n, mean, sd, p)
{
x <- rnorm(n)
u <- sample(1:length(mean), n, prob = p, replace = T)
for (i in 1:length(mean)) x[u == i] = mean[i] + sd[i] * x[u ==
i]
return(x)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.