1

Given a sampler from a uniform distribution $U(0,1)$ and the target Bernoulli distribution $b(p)$ with two targets $+1,0$ , what kind of sampling technique is:

  1. Sample $u_n\sim U(0,1)$
  2. If $u_n<p$: Accept the sample $+1$

I need to know the sampling technique used above.


My initial guess is Rejection Sampling since the proposal $U(0,1)$ covers the support of a Bernoulli distribution and $1≥x_n$ where $x_n$ is sampled from $b(p)$. Acceptance is done if $u_0<p$.

But they are clearly different since in the sampling above $u_n<p$ while $u_n<x_n\sim b(p)$ for rejection sampling.


Another sampling technique in mind is Metropolis Hastings Sampling with fixed constant proposal $p$. But I have seen that the proposal must be sampled from a distribution (not fixed).

Please help me identify the sampling above.

  • The sampling as described is wrong: it should be, if $u_n<p$ return $1$ and otherwise return $0$. No rejection involved. – Xi'an Jun 18 '23 at 08:00
  • @Xi'an the posterior being sampled is an Ising model whereas $P(x=+1|\theta)=p$. I have seen an implementation where $u_n<p$ returns $+1$ else return $0$. May I ask what form of sampling is this? Because I could have sampled directly from $b(p)$. Thanks – user1176663 Jun 18 '23 at 09:58
  • This is direct sampling, no need to invoke Ising, – Xi'an Jun 18 '23 at 14:46
  • Among other things, this is an example of sampling by inverting the CDF. – whuber Jun 19 '23 at 12:49
  • 1
    Could you let us know whether https://stats.stackexchange.com/questions/579029 addresses your question? It explains this sampling method. – whuber Jun 20 '23 at 15:35
  • Thank you for the reference, I will be reading it in the morning. – user1176663 Jun 20 '23 at 17:08

0 Answers0