rmvbin(n, margprob, commonprob=diag(margprob), bincorr=diag(length(margprob)), sigma=diag(length(margprob)), colnames=NULL, simulvals=NULL)
commonprob
,
bincorr
and sigma
may be specified. Default are
uncorrelated components.
n
samples from a multivariate normal distribution with mean and
variance chosen in order to get the desired margin and common
probabilities are sampled. Negative values are converted to 0,
positive values to 1.
commonprob2sigma
,check.commonprob
,
simul.commonprob
# uncorrelated columns: rmvbin(10, margprob=c(0.3,0.9)) # correlated columns m <- cbind(c(1/2,1/5,1/6),c(1/5,1/2,1/6),c(1/6,1/6,1/2)) rmvbin(10,commonprob=m) # same as the second example, but faster if the same probabilities are # used repeatedly (coomonprob2sigma rather slow) sigma <- commonprob2sigma(m) rmvbin(10,margprob=diag(m),sigma=sigma)