45k 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 ...
85 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 ...
33 views

331 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 ...
1k 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 ...
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...
676 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 ...
1k 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 \$...