AcceptanceRejectionRV

class AcceptanceRejectionRV @JvmOverloads constructor(val proposalDistribution: ContinuousDistributionIfc, val majorizingConstant: Double, val pdf: PDFIfc, streamNum: Int = 0, streamProvider: RNStreamProviderIfc = KSLRandom.DefaultRNStreamProvider, name: String? = null) : RVariable(source)

Implements the acceptance/rejection algorithm for uni-variate distributions. The user must supply a continuous distribution that acts as the proposal distribution and the PDF of the distribution from which random variates will be generated. The two distributions must be domain compatible. The proposal distribution's domain must wholly contain the domain of the PDF from which random variates will be generated. If the target PDF's domain is not within the proposal distribution's domain then all proposed values would be rejected.

Since the proposal distribution may generate values outside the domain of the target PDF it is essential that the PDF function return 0.0 for any value of x that is not within its domain.

Parameters

proposalDistribution

the proposal distribution for generating variates that could be rejected

majorizingConstant

the majorizing constant for the rejection process

pdf

the PDF from which random variates are needed

streamNum

the random number stream number, defaults to 0, which means the next stream

streamProvider

the provider of random number streams, defaults to KSLRandom.DefaultRNStreamProvider

name

an optional name

Constructors

Link copied to clipboard
constructor(proposalDistribution: ContinuousDistributionIfc, majorizingConstant: Double, pdf: PDFIfc, streamNum: Int = 0, streamProvider: RNStreamProviderIfc = KSLRandom.DefaultRNStreamProvider, name: String? = null)

Properties

Link copied to clipboard
Link copied to clipboard
val pdf: PDFIfc

Functions

Link copied to clipboard
open override fun instance(streamNum: Int, rnStreamProvider: RNStreamProviderIfc): AcceptanceRejectionRV