CovarianceToyMC¶
Description¶
Generates a random sample distributed according to multivariate normal distribution.
Uses boost::mt19937
random generator.
The sample becomes frozen upon generation. One has to manually taint the transformation
for the next sample by calling nextSample
method.
Limitations¶
Be careful with generatining random numbers with high level of correlation. Presence of correlation coefficients of order of 0.9 will most likely cause the distribution width to be invalid. So test the generator prior the actual usage.
Inputs¶
Average model vector \(\mu_1\).
First model covariance matrix \(V_1\) Cholesky decomposition \(L_1\).
Average model vector \(\mu_2\).
Second model covariance matrix \(V_2\) Cholesky decomposition \(L_2\).
etc.
etc.
Inputs are added via add(theory, cov)
method.
Outputs¶
'toymc'
— output vector \(x\) of size of concatination of \(\mu_i\).
Tests¶
Use the following commands for the usage example and testing:
./tests/elementary/test_random_transformations.py -n 100000 -o output/random.pdf
Implementation¶
For the random variable vector \(x\) of size \(N\), distributed around \(\mu\) with covariance matrix \(V\) the p.d.f. is:
For the decomposed covariance matrix \(V=LL^T\) the exponent power reads:
One can define the variable \(z\):
Since the transition Jacobian \(|dx/dz|=|L|=\sqrt{|V|}\) each \(z_i\) is distributed normally with \(\sigma=1\) with central value of \(0\).
The algorithm generates normal vector \(z\) and transforms it to \(x=Lz + \mu\).
By \(\mu\) we mean the concatenation of vectors \(\mu_i\).