Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rmixture

Draw from Mixture of Normals


Description

rmixture simulates iid draws from a Multivariate Mixture of Normals

Usage

rmixture(n, pvec, comps)

Arguments

n

number of observations

pvec

ncomp x 1 vector of prior probabilities for each mixture component

comps

list of mixture component parameters

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

Value

A list containing:

x:

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

z:

an n x 1 vector of indicators of which component each draw is taken from

Warning

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

Author(s)

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

See Also


bayesm

Bayesian Inference for Marketing/Micro-Econometrics

v3.1-4
GPL (>= 2)
Authors
Peter Rossi <perossichi@gmail.com>
Initial release
2019-10-14

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.