R/rmulti.R

rmulti <-
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)
}

Try the MaskJointDensity package in your browser

Any scripts or data that you put into this service are public.

MaskJointDensity documentation built on May 2, 2019, 8:28 a.m.