R/rmsal.R

Defines functions rmsal

Documented in rmsal

rmsal <-
function(n,p,alpha,sig,mu,pi.g){ 
  x <- matrix(0,n,p+1)
  G <- length(pi.g)
  for(i in 1:n){
    g <- sample(size=1,x=c(1:G),prob=pi.g)
    x[i,] <- c(g,rsal(1,p=p,alpha=alpha[g,],sig=sig[,,g],mu=mu[g,]))
  }
  colnames(x) <- c("Group",paste("V",1:p,sep=""))
  return(x)
}

Try the MixSAL package in your browser

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

MixSAL documentation built on May 2, 2019, 7:04 a.m.