Generate and setFor ,which is the distribution function of an exponential distribution with rate one. This is inverse transform sampling.
In one proposal of rejection sampling, the probability of both proposing a value in and accepting it isIntegrating shows that the acceptance probability is . Conditional on acceptance, the density of the proposed value is thereforeEach unsuccessful proposal restarts independently, so the eventual output has the same conditional density:
Take the proposal density . For the target half-normal distribution,The ratio is maximized at , so the sharp envelope constant isGenerate and an independent uniform , and accept when
Each independent proposal is accepted with probability . The number of proposals is therefore a geometric distribution with mean
The accepted has the half-normal distribution, so in distribution for . Multiplying it by an independent random sign that is positive and negative with equal probabilities restores the two symmetric halves of the Gaussian density. Thus
Articles by others on the same topic
There are currently no matching articles.