50% off: Unlimited data and AI learning.
State of Data and AI Literacy Report 2025

bayesm (version 3.1-6)

rmixture: Draw from Mixture of Normals

Description

rmixture simulates iid draws from a Multivariate Mixture of Normals

Usage

rmixture(n, pvec, comps)

Value

A list containing:

x:

an nx length(comps[[1]][[1]]) array of iid draws

z:

an nx1 vector of indicators of which component each draw is taken from

Arguments

n

number of observations

pvec

ncompx1 vector of prior probabilities for each mixture component

comps

list of mixture component parameters

Warning

This routine is a utility routine that does not check the input arguments for proper dimensions and type.

Author

Peter Rossi, Anderson School, UCLA, perossichi@gmail.com.

Details

comps is a list of length ncomp with ncomp = length(pvec).
comps[[j]][[1]] is mean vector for the jth component.
comps[[j]][[2]] is the inverse of the cholesky root of Σ for jth component

See Also

rnmixGibbs