direct-sampler-ar: Direct sampler with accept-reject

direct-sampler-arR Documentation

Direct sampler with accept-reject

Description

Direct sampler with accept-reject

Usage

direct_sampler_ar(
  n,
  w,
  g,
  tol = 1e-08,
  N = 10,
  max_rejections,
  fill_method = "small_rects",
  priority_weight = 1/2,
  verbose = FALSE
)

Arguments

n

Number of draws to generate.

w

A weight function object.

g

A base distribution object.

tol

Tolerance for step function approximation in customized sampler.

N

Number of knots to use in approximation for p(u). Specifically, N+1 points will be used.

max_rejections

Maximum number of rejections to allow. If this number is reached, an exception will be thrown.

fill_method

Knot selection method for customized sampler. See Stepdown.

priority_weight

TBD

verbose

Return a list with the sample x and the number of rejections rejections.

Details

Direct sampling with accept-reject algorithm can be used to take exact draws from the target distribution, with the added cost that same candidate draws will be rejected.

The function direct_sampler_ar does not adapt the underlying step function using rejections; here, the number of knots N is kept constant throughout sampling.

Value

A vector of length n which represents the sample.


andrewraim/DirectSampling documentation built on June 5, 2024, 4:36 p.m.