Generating samples on a 2-D composite binomial distribution

Swamp Thing
Insights Author
Messages
1,061
Reaction score
819
TL;DR
How to generate (X,Y) samples having a distribution specified in terms of the sum of a few normal 2-D distributions?
I would like to generate (X,Y) pairs such that they would follow a distribution something like this:
1570588368324.png

This is the sum of three normal distributions. Each distribution could have a different taper along the X and the Y, plus an offset along X and/or Y. So the parameters of these three distributions would be the input for my process.

I don't need to meet any rigorous test of randomness or compliance with the ideal model -- it just needs to look qualitatively like the model and be really EASY to understand and implement. Speed is not too much of an issue either.

What would be a simple algorithm?
 
on Phys.org
that picture doesn't look like a 2-d normal --i.e. it isn't symmetric about the axis that goes from top left to bottom right. This rather obvious skew is a sign of (approximation?) problems looming.
- - - - -
An easy way of generating 2-d normals is start with
##\mathbf x## which is a d dimensional vector with iid components that are standard normals i.e. N(0,1) each

Then consider the 2-d multivariate gaussian given by
##\mathbf y:= A\mathbf x + \mathbf b##
where ##\mathbf b \in \mathbb R^\text{2 x 1}## and translates the mean and ##\mathbf A \in \mathbb R^\text{2 x d}## which controls the (co)variance which will be given by ##AA^T##

edit:
maybe I misread this OP actually wants a mixture model. Frequently people here say adding distributions when they mean adding random variables, so hard to tell. The fact that the thread is titled 2-d composite binomial made me think we are actually dealing with adding normal random variables, not a mixture.
 
Last edited:
Swamp Thing said:
What would be a simple algorithm?

Suppose ##f_1, f_2,f_3## are probability density functions and you want to generate random samples from a probability density function ##g = k_1 f_1 + k_2 f_2 + k_3 f_3##, where the ##0 \leq k_i \leq 1_i## are constants. Since ##g## is a probability density, it must be that ##k_1 + k_2 + k_3 = 1##. So you can use ##k_1,k_2,k_3## as probabilities. To generate a random sample from ##g##, first pick which density ##f_i## to use. Pick ##f_i## with probability ##k_i##, Then generate a random sample ##(x,y)## from the density that was selected.

To deal with your example, we need to know how to generate random samples from a 2-D gaussian distribution. Do you know how to do that?
 
  • Informative
Likes   Reactions: Swamp Thing
Stephen Tashi said:
To generate a random sample from gg, first pick which density fif_i to use. Pick fif_i with probability kik_i, Then generate a random sample (x,y)(x,y) from the density that was selected.

Thanks, that's pretty elegant. I wish I had thought of it :oops:. And it works the way sub-populations would actually contribute to the total stats according to their relative size.

Stephen Tashi said:
To deal with your example, we need to know how to generate random samples from a 2-D gaussian distribution. Do you know how to do that?
I think that part should be OK.

Thanks.
 

Similar threads

  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 1 ·
Replies
1
Views
7K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 17 ·
Replies
17
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 23 ·
Replies
23
Views
4K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K