Arbitrary sampling from 1D RNG functions from R.

Format

R6::R6Class inheriting from Sampler1D.

Construction

smpl = Sampler1DRfun$new(param, rfun, trunc = TRUE)
  • param :: Param
    Domain / support of the distribution we want to sample from.

  • rfun :: function
    Random number generator function, e.g. rexp to sample from exponential distribution.

  • trunc :: logical(1)
    TRUE enables naive rejection sampling, so we stay inside of [lower, upper].

Fields

See Sampler1D. Additionally, the class provides:

  • rfun :: function()
    Random number generator function, e.g. rexp to sample from exponential distribution.

  • trunc :: logical(1)
    TRUE enables naive rejection sampling, so we stay inside of [lower, upper].

Methods

See Sampler1D.

See also