Generating samples on a 2-D composite binomial distribution

In summary, the goal of this process is to generate samples from a probability density function that looks like the model, is easy to understand and implement, and is fast.
  • #1
Swamp Thing
Insights Author
908
572
TL;DR Summary
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?
 
Physics news on Phys.org
  • #2
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:
  • #3
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 Swamp Thing
  • #4
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.
 

1. What is a 2-D composite binomial distribution?

A 2-D composite binomial distribution is a probability distribution that describes the likelihood of obtaining a certain number of successes in two independent trials, where each trial has a binary outcome (success or failure) and the probability of success remains constant throughout the trials.

2. How is a 2-D composite binomial distribution different from a regular binomial distribution?

A regular binomial distribution only considers one trial with a binary outcome, while a 2-D composite binomial distribution considers two independent trials with a binary outcome each. This means that the probability of success in the regular binomial distribution remains constant throughout the entire trial, while in the 2-D composite binomial distribution, the probability of success can vary between the two trials.

3. What is the formula for calculating the probability of a 2-D composite binomial distribution?

The formula for calculating the probability of a 2-D composite binomial distribution is P(x,y) = n!/(x!(n-x)!)(p1^x)(p2^(n-x)), where n is the total number of trials, x is the number of successes in the first trial, y is the number of successes in the second trial, p1 is the probability of success in the first trial, and p2 is the probability of success in the second trial.

4. How can a 2-D composite binomial distribution be used in scientific research?

A 2-D composite binomial distribution can be used in scientific research to model and analyze data from experiments with two independent trials and binary outcomes. It can help researchers understand the probability of obtaining a certain number of successes in both trials and make predictions about future experiments.

5. Are there any limitations or assumptions when using a 2-D composite binomial distribution?

One limitation of using a 2-D composite binomial distribution is that it assumes the two trials are independent and the probability of success remains constant throughout the trials. Additionally, it may not accurately model data that deviates significantly from a binary outcome or has a small sample size. It is important for researchers to carefully consider the applicability of this distribution to their specific data before using it in their analysis.

Similar threads

  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
964
  • Set Theory, Logic, Probability, Statistics
Replies
9
Views
1K
  • Calculus and Beyond Homework Help
Replies
4
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
6K
  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
846
  • Set Theory, Logic, Probability, Statistics
Replies
11
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
17
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
9
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
2K
Back
Top