©
Acceptance-rejection method
Applies the acceptance-rejection transform method of simulation to a certain (parabolic) target distribution.
2024.Nov.25 04:22:26
ntrials × 106 No. of ("accepted") trials from distribution (→ ≤ 2 millions).
method Transform method. •
.repeat Repeatability (0 | 1: yes | no).
μ, a Mean and (positive) half breadth [x ∈ (μ ± a)].
klasses, ymax No. of classes (points) for graph. •
.L, U Lower and upper limits for probability verification.
Show values Show the values of the graph coordinates.

Applies the acceptance-rejection method of Monte Carlo simulation to a certain given target distribution, with density f ≡ 'pdf_x', through an instrumental density, g ≡ 'pdf_i' having a G ≡ 'cdf_i' with simple inverse. The "hat function" for  f will be h = c.g, such that it is c.g ≥ f, with c the smallest possible constant [as the rejection fraction will be (c − 1) ⁄ c]. Algorithm:

  1. Generate V, uniform. Calculate X = Ginv(V).
  2. Generate U, uniform. If  U . c . g(X) ≤ f(X), accept X; otherwise reject, go to step 1.

Graphs will be drawn for: {1} the simulation (fsim), {2} the target density, pdf_x (f), {3} the hat function, c.pdf_i (fhat); and {4} cdf_x  (F). [If F, the (original) 'cdf_x', is indeed known, a verification of theoretical results is made.]

(For inversion transform, the useless fhat is drawn coincident with f.)

In this (paradigm) case, the target density is the "parabolic" (or Epanechnikov) density,  f(x) = [3⁄(4a)](1 − z²), |z| ≤ 1, with z = (xμ) ⁄ a, and the hat function, c.g, comes from: g = [π ⁄ (4a)] cos[(π⁄2) z], c = 12 / π². The difficulty in deriving the inverse of F ≡ cdf_x in this case (a cubic) makes it a suitable candidate for the rejection method.

References: Plate AcceptReject

• L'Ecuyer, Pierre, 2004, pdf (=), at Univ. de Montréal, Montréal (Québec, Canada).

• Devroye, Luc, 2004, pdf (=), Computational Geometry Lab, Carlton Univ., Ottawa (Ontario, Canada).

• The Wolfram Integrator, © 2008 Wolfram Research, Inc. [on 'Created' date].

• Epanechnikov, V. A. (В. А. Епанечников, codes).

• Online Style Guide, Times Online, "The Times and The Sunday Times" (or The Guardian's) [on "created" date].

• Random Number Bibliography, RandomNumber.org .

• 1797-02-05: Duhamel, Jean Marie C..

 
 
Valid HTML 4.01! IST http://web.ist.utl.pt/~mcasquilho/compute/or/Fx-simrejpar.php
Created: 2008-02-05 — Last modified: 2018-11-19