Linked Questions

34 votes
5 answers
56k views

How to sample from a discrete distribution? [duplicate]

Assume I have a distribution governing the possible outcome from a single random variable X. This is something like [0.1, 0.4, 0.2, 0.3] for X being a value of either 1, 2, 3, 4. Is it possible to ...
user avatar
  • 483
3 votes
2 answers
324 views

Simulating random variables from a discrete distribution II [duplicate]

I have the following discrete probability distribution where $p$, $q$ and $r$ are known constants: $P(X=0)=q$, $0<q<1$ $P(X=1)=1-p-q-r$, $0<p+q+r<1$ $P(X=2)=p$, $0<p<1$ $P(X=3)=...
user avatar
0 votes
0 answers
287 views

How to sample from a joint probability distribution of two variables? [duplicate]

I want to randomly sample from a joint probability distribution characterized by two variables x and y. So, basically, I have the information of the joint PDF which has the dimension 100x50. As per my ...
user avatar
  • 1
0 votes
1 answer
96 views

Randomly generating integers with prior probabilities [duplicate]

I'm after a nice method to draw from a range of integers given known prior probabilities. Say I wanted an 80% chance of drawing 1, a 15% chance of drawing 2, and a 5% chance of drawing 3... I'm ...
user avatar
  • 79
4 votes
2 answers
2k views

Sampling from a piecewise linear probability density function

I have a pdf modelled as a piecewise linear function that I can represent as the sequence of pairs of real numbers standing for the points in the of the piecewise line: $\{(x_{1}, y_{1}), \dots, (x_{n}...
user avatar
  • 421
8 votes
2 answers
419 views

Approaches for generating synthetic survey data with dependent answers?

I would like to produce synthetic survey data. At the moment I produce independent answers between questions according to an arbitrary discrete distribution as in this question. I want to generate ...
user avatar
  • 1,485
6 votes
1 answer
2k views

Generating data with a pre-specified odds ratio

I have to simulate (in javascript) the likelihood that members of a certain population would have a disease, given a contextual value. All information I have comes from papers that show odds ratios ...
user avatar
2 votes
2 answers
1k views

Generate random number from a specific probability mass in R

How can I generate sample from a distribution with probability mass $P(X=x)$ in R? I know that probability mass, but it is not from a known distribution, also it is not linear, instead it has a ...
user avatar
  • 99
4 votes
2 answers
2k views

Choosing a discrete non-uniform distribution for generating random integers

I have a list $l$ containing integers in the range $[1,max]$ On list $l$ I do an operation $isPresent(x)$ which return true if x...
user avatar
1 vote
1 answer
2k views

Generate bivariate random numbers from joint distribution function

I have an empirical joint distribution function $ \hat{F}(x_1,x_2) = Pr(X_1 < x_1, X_2 < x_2) $ Can I generate bivariate random number from this distribution with a certain condition such as $...
user avatar
  • 1,001
1 vote
1 answer
1k views

How to draw random sample from an empirical joint distribution?

I want to draw a random sample from a known joint distribution. what I have now is the number of people in each age and income bracket (as shown in the example below):0.12 0.42 0.06 16 0.08 0.28 0.04 ...
user avatar
  • 71
6 votes
1 answer
357 views

Sampling uniformly from the set of partitions of a set?

In this blogpost, the writer states "It’s easy to sample uniformly from the set of partitions of a set: you pick a number of bins using an appropriate exponential distribution, then randomly i.i....
user avatar
1 vote
1 answer
174 views

Modeling distribution on a dart board

I have statistics for a game similar to lawn dart (3 concentric rings instead of 2) and I wanted to simulate shot distribution. What statistical distribution could I use? The game is throwing a ...
user avatar
  • 37