NormalVarianceMeanMixturePDF

Variance-mean mixture of normals. Unstable algorithm.

abstract
class NormalVarianceMeanMixturePDF : PDF!T(
T
) if (
isFloatingPoint!T
) {}

Constructors

this
this(PDF!T pdf, T beta, T mu, const(T)[] subdivisions = null, T epsRel = 1e-6, T epsAbs = 0)

Examples

1 class MyGHypPDF(T) : NormalVarianceMeanMixturePDF!T ///$(RED Unstable) algorithm.
2 {
3 	import atmosphere.moment;
4 	this(T lambda, GHypEtaOmega!T params, T mu)
5 	{
6 		with(params)
7 		{
8 			auto pgig = ProperGeneralizedInverseGaussianSPDF!T(lambda, eta, omega);
9 			auto e = mu + properGeneralizedInverseGaussianMean(lambda, eta, omega);
10 			super(pgig.toPDF, params.beta, mu, [e]);				
11 		}
12 	}
13 }
14 
15 import atmosphere.params;
16 immutable double lambda = 2;
17 immutable double mu = 0.3;
18 immutable params = GHypEtaOmega!double(2, 3, 4);
19 auto pghyp = new GeneralizedHyperbolicPDF!double(lambda, params.alpha, params.beta, params.delta, mu);
20 auto pnvmm = new MyGHypPDF!double(lambda, params, mu);
21 foreach(i; 0..5)
22 	assert(approxEqual(pghyp(i), pnvmm(i)));

Meta