# Questions tagged [rejection-sampling]

Rejection sampling is a basic technique used to generate observations from a distribution. [Wikipedia]

76 questions
Filter by
Sorted by
Tagged with
6 views

### Plotting a probability density based on the ratio of two random variables in PyMC3

I am trying to graphically represent the ratio of two probability distributions: $$f(x) = \frac{1}{\sqrt{2\pi}} \exp{(\frac{(-x)^2}{2})}$$ $$g(x) = \frac{1}{2} \exp{(-|x|)}$$ I'm a bit confused about ...
24 views

### How to sample in Bayesian inference model?

I have the following problem to model in R. If we have $X_1, ..., X_n \sim N(\theta,1)$ and want to estimate $\theta$, we assume $\theta$ has a prior distribution, and the Bayes estimate of $\theta$ ...
43 views

### Understanding of the acceptance rejection sampling algorithm

Had some fundamental doubts about this algorithm. 1) Instead of trying to find another function g(x) and Uniform variable U , why can't we select random values of x and find f(x). That would ...
54 views

### Simulating Laplace's needle to estimate $\pi$

A recent question sought assistance with computer simulation of Buffon's needle problem in R, with the goal of obtaining a Monte Carlo estimate of $\pi$. This is ...
27 views

### Confused about the sampling method

I want to sample from a density using the rejection method. The density is defined as $$f(x) = \frac{e^x}{e-1},~~~ 0\leq x \leq 1.$$ Following the definition of the rejection method, we can find ...
110 views

### Sampling from Gamma Distribution using the Rejection Method

I'm having some issues working through this practice problem. I have worked through the first portion of it, and I have the solution, but I don't understand how/why the solution does two things at the ...
22 views

### Identifying and understanding algorithm of random number generation

Studying different ways to generate random numbers according to a distribution and the below algorithm describes the "box method". A search on Google led to the Box-Mueller method. Are they related? ...
41 views

### Accept-reject algorithm , why is c>1? [duplicate]

In an accept-reject algorithm, we need to find c such that pj/qj≤ c for all j for which pi > 0 . And, the probability of accepting in any iteration is 1/c. Why is c guaranteed to be more than 1?
33 views

### How the conditional probability is being calculated in Rejection sampling

In a class lecture, the "Acceptance-rejection algorithm" was presented as follows: To generate $𝑋 \sim 𝑓(𝑥)$, Find density $g$ satisfying $\frac{f(t)}{g(t)}<=c$ for some constant $c$ for ...
19 views

### How does the rejection sampling method work in layman's terms?

Suppose that I have no knowledge of sampling methods and that I have some knowledge of probability theory (e.g. probability distribution and marginal distribution). How would you explain the ...
87 views

### Proving the Accepted Samples from Rejection Sampling follows our Posterior Distribution

I get confused how the author gets to line $(1)$ using the indicator functions. If someone can explain this to me or give me a hint that would be greatly appreciated. Thanks! Define the following: ...
45 views

### Optimal distribution for Acceptance Rejection Sampling

For some project I have been sampling from the Gamma distribution. I have been using the exponential distribution intensively. One method I have employed is the Acceptance rejection sampling, ...
168 views

### Can't understand why rejection sampling works

I want to generate sample points $\{z_i\}$ in an arbitrary 2D shape, e.g. a circle centered at the origin with radius 1. Rejection sampling says: Look at 2 uniform random variables over $[0,1]$, $X$ ...
104 views