Table of Contents

Class PolarStudentTFactorSampler<TUrng>

Namespace
NanoQL.Experimental
Assembly
NanoQL.dll

A Student t latent model's factor sampler by polar Student t draws, bypassing the copula: one generator per systemic factor, and one for every idiosyncratic factor. QuantLib's LatentModel::FactorSampler specialized on RandomSequenceGenerator<PolarStudentTRng>.

[Experimental("NQL0001")]
[WorkingType]
public sealed class PolarStudentTFactorSampler<TUrng> : IRsg where TUrng : class, IRng

Type Parameters

TUrng

The uniform generator.

Inheritance
PolarStudentTFactorSampler<TUrng>
Implements
Inherited Members

Remarks

A mutable working type (§2.7), not for a multithreaded simulation: the polar method is a rejection method. Its seed constructor is Create<TUrng>(TCopulaPolicy, long), a seed in [1, 4294967295] with no default, where QuantLib's defaults to 0, the clock; a generator given instead is copied.

One uniform stream feeds the t generators in turn, and each draw is scaled by its factor's variance factor √((ν − 2)/ν), so that the factors are independent and of unit variance, as the policy's are. QuantLib's gives each t generator its own copy of one uniform generator, so the systemic draw k equals the idiosyncratic stream's draw k, and leaves its draws raw, of variance ν/(ν − 2) (latentmodel.hpp:779-794, polarstudenttrng.hpp:86): at ν 5 and a weight √0.3 a 1% default threshold simulates 2.65%. A documented divergence (Divergences/PolarStudentTSamplerTests.cs).

Constructors

PolarStudentTFactorSampler(TCopulaPolicy, TUrng)

Initializes a new instance of the PolarStudentTFactorSampler<TUrng> class.

public PolarStudentTFactorSampler(TCopulaPolicy copula, TUrng urng)

Parameters

copula TCopulaPolicy

The Student t copula policy.

urng TUrng

The uniform generator, which the sampler copies.

Exceptions

ArgumentNullException

urng is null.

InvalidOperationException

copula is the zero value.

ArgumentException

copula was built without its variables, so its factors are fewer than its t generators, past whose sequence QuantLib's writes.

Properties

Dimension

Gets the dimension of each sequence.

public int Dimension { get; }

Property Value

int

Methods

Clone()

Copies the sampler deeply, its one uniform stream included.

public PolarStudentTFactorSampler<TUrng> Clone()

Returns

PolarStudentTFactorSampler<TUrng>

The copy.

LastSequence()

Gets the sequence the last draw gave (QuantLib's lastSequence()).

public Sample<ReadOnlyMemory<double>> LastSequence()

Returns

Sample<ReadOnlyMemory<double>>

The sequence, a view of the generator's buffer valid until its next draw, and its weight.

NextSequence()

Draws a sample of every factor, each of unit variance: the systemic ones, then the idiosyncratic ones.

public Sample<ReadOnlyMemory<double>> NextSequence()

Returns

Sample<ReadOnlyMemory<double>>

The sample, a view of the sampler's buffer valid until its next draw, of weight 1.