Class TSampler
- java.lang.Object
-
- org.apache.commons.rng.sampling.distribution.TSampler
-
- All Implemented Interfaces:
ContinuousSampler
,SharedStateContinuousSampler
,SharedStateSampler<SharedStateContinuousSampler>
public abstract class TSampler extends Object implements SharedStateContinuousSampler
Sampling from a T distribution.Uses Bailey's algorithm for t-distribution sampling:
Bailey, R. W. (1994) "Polar Generation of Random Variates with the t-Distribution." Mathematics of Computation 62, 779-781.
Sampling uses
UniformRandomProvider.nextLong()
.- Since:
- 1.5
- See Also:
- Student's T distribution (wikipedia), Mathematics of Computation, 62, 779-781
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static TSampler
of(UniformRandomProvider rng, double degreesOfFreedom)
Create a new t distribution sampler.String
toString()
abstract TSampler
withUniformRandomProvider(UniformRandomProvider rng)
Create a new instance of the sampler with the same underlying state using the given uniform random provider as the source of randomness.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.commons.rng.sampling.distribution.ContinuousSampler
sample, samples, samples
-
-
-
-
Method Detail
-
withUniformRandomProvider
public abstract TSampler withUniformRandomProvider(UniformRandomProvider rng)
Create a new instance of the sampler with the same underlying state using the given uniform random provider as the source of randomness.- Specified by:
withUniformRandomProvider
in interfaceSharedStateSampler<SharedStateContinuousSampler>
- Parameters:
rng
- Generator of uniformly distributed random numbers.- Returns:
- the sampler
-
of
public static TSampler of(UniformRandomProvider rng, double degreesOfFreedom)
Create a new t distribution sampler.- Parameters:
rng
- Generator of uniformly distributed random numbers.degreesOfFreedom
- Degrees of freedom.- Returns:
- the sampler
- Throws:
IllegalArgumentException
- ifdegreesOfFreedom <= 0
-
-