Generate random observations from the normal mixture distributions.
rmix(n, pi, mu, sigma, ncov =2)
Arguments
n: Number of observations.
pi: A g-dimensional vector for the initial values of the mixing proportions.
mu: A p×g matrix for the initial values of the location parameters.
sigma: A p×p covariance matrix if ncov=1, or a list of g covariance matrices with dimension p×p×g if ncov=2.
ncov: Options of structure of sigma matrix; the default value is 2; ncov = 1 for a common covariance matrix; ncov = 2 for the unequal covariance/scale matrices.
Returns
Y: An n×p numeric matrix with samples drawn in rows.
Z: An n×g numeric matrix; each row represents zero-one indicator variables defining the known class of origin of each.
clust: An n-dimensional vector of class partition.