rmvbin                package:bindata                R Documentation

_M_u_l_t_i_v_a_r_i_a_t_e _B_i_n_a_r_y _R_a_n_d_o_m _V_a_r_i_a_t_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     Creates correlated multivariate binary random variables by
     thresholding a normal distribution. The correlations of the
     components can be specified either as common probabilities,
     correlation matrix  of the binary distribution, or covariance
     matrix of the normal distribution. Hence, only one of the
     arguments `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.

_U_s_a_g_e:

     rmvbin(n, margprob, commonprob=diag(margprob),
            bincorr=diag(length(margprob)),
            sigma=diag(length(margprob)),
            colnames=NULL, simulvals=NULL)

_A_u_t_h_o_r(_s):

     Friedrich Leisch

_R_e_f_e_r_e_n_c_e_s:

     Friedrich Leisch, Andreas Weingessel and Kurt Hornik (1998). On
     the generation of correlated artificial binary data. Working Paper
     Series, SFB ``Adaptive Information Systems and Modelling in
     Economics and Management Science'', Vienna University of
     Economics, <URL: http://www.wu-wien.ac.at/am>

_S_e_e _A_l_s_o:

     `commonprob2sigma',`check.commonprob', `simul.commonprob'

_E_x_a_m_p_l_e_s:

     # 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)

