## The expected proportion of draws from component 1. alpha = 0.05 ## The variance of component 1. tau2 = 100 ## The variance of component 2. sig2 = 1 ## A 1000x50 array of iid true/false values in which each entry has ## probability alpha of being true. A = array((runif(1000*50) < alpha), c(1000,50)) ## The component 1 draws. B = array(sqrt(tau2)*rnorm(50*1000), c(1000,50)) ## The component 2 draws. C = array(sqrt(sig2)*rnorm(50*1000), c(1000,50)) ## These are the contaminated normal draws. X = A*B + (1-A)*C