MVIndependentMarginals

class MVIndependentMarginals @JvmOverloads constructor(marginals: List<RVariableIfc>, streamNum: Int = 0, streamProvider: RNStreamProviderIfc = KSLRandom.DefaultRNStreamProvider, name: String? = null) : MVRVariable(source)

Represents a multi-variate distribution with the specified marginals The sampling of each marginal random variable is independent. That is the resulting distribution has independent marginals. The supplied marginals may be the same distribution or not. If they are all the same, then use MVIndependentRV instead. All the random variables will share the same stream. The sampling ensures that is the sampling is consecutive within the stream and thus independent.

The marginals draw from this variable's one stream, in turn, whatever its stream number, and so does every marginal of its antithetic instance, whose stream is an antithetic copy of this one. Each marginal must therefore be able to draw from a stream it is given (see canShareStream); the variable refuses one that cannot. Antithetic pairs then correspond coordinate by coordinate when each marginal uses the same number of pseudo-random numbers for every value, as variables generated by inverse transform do; a marginal generated by acceptance-rejection can use a different number in the antithetic instance, which leaves the later coordinates paired with other numbers: still correct samples, with less variance reduction.

Parameters

marginals

must have at least 2 supplied marginals, each able to share a stream

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(marginals: List<RVariableIfc>, streamNum: Int = 0, streamProvider: RNStreamProviderIfc = KSLRandom.DefaultRNStreamProvider, name: String? = null)

Properties

Link copied to clipboard
open override val dimension: Int

the expected size of the array from sample()

Functions

Link copied to clipboard
protected open override fun generate(array: DoubleArray)
Link copied to clipboard
open override fun instance(streamNumber: Int = 0, rnStreamProvider: RNStreamProviderIfc = KSLRandom.DefaultRNStreamProvider): MVIndependentMarginals