param_diff
This module contains functions to obtain the parameter difference posterior given posterior samples from two independent chains.
For further details we refer to arxiv 2105.03324.
- tensiometer.mcmc_tension.param_diff.parameter_diff_chain(chain_1, chain_2, boost=1, param_names=None, periodic_params=None, fixed_params=None, **kwargs)[source]
Compute the chain of the parameter differences between the two input chains. The parameters of the difference chain are related to the parameters of the input chains, \(\theta_1\) and \(\theta_2\) by:
\[\Delta \theta \equiv \theta_1 - \theta_2\]This function only returns the differences for the parameters that are common to both chains. This function preserves the chain separation (if any) so that the convergence of the difference chain can be tested. This function does not assume Gaussianity of the chain. This functions does assume that the parameter determinations from the two chains (i.e. the underlying data sets) are uncorrelated. Do not use this function for chains that are correlated.
- Parameters:
chain_1 –
MCSamplesfirst input chain with \(n_1\) sampleschain_2 –
MCSamplessecond input chain with \(n_2\) samplesboost – (optional) boost the number of samples in the difference chain. By default the length of the difference chain will be the length of the longest chain. Given two chains the full difference chain can contain \(n_1\times n_2\) samples but this is usually prohibitive for realistic chains. The boost parameters wil increase the number of samples to be \({\rm boost}\times {\rm max}(n_1,n_2)\). Default boost parameter is one. If boost is None the full difference chain is going to be computed (and will likely require a lot of memory and time).
param_names – (optional) list with the names of the parameters to use for the difference chain. By default this tries to use all parameters.
periodic_params – (optional) dictionary with the names of the parameters that are periodic. The keys are the names and the values are the ranges of the parameters.
fixed_params – (optional) dictionary with the names of the fixed parameters. The keys are the names and the values are the values of the parameters.
- Returns:
MCSamplesthe instance with the parameter difference chain.
- tensiometer.mcmc_tension.param_diff.parameter_diff_weighted_samples(samples_1, samples_2, boost=1, indexes_1=None, indexes_2=None, periodic_indexes=None)[source]
Compute the parameter differences of two input weighted samples. The parameters of the difference samples are related to the parameters of the input samples, \(\theta_1\) and \(\theta_2\) by:
\[\Delta \theta \equiv \theta_1 - \theta_2\]This function does not assume Gaussianity of the chain. This functions does assume that the parameter determinations from the two chains (i.e. the underlying data sets) are uncorrelated. Do not use this function for chains that are correlated.
- Parameters:
samples_1 –
WeightedSamplesfirst input weighted samples with \(n_1\) samples.samples_2 –
WeightedSamplessecond input weighted samples with \(n_2\) samples.boost – (optional) boost the number of samples in the difference. By default the length of the difference samples will be the length of the longest one. Given two samples the full difference samples can contain \(n_1\times n_2\) samples but this is usually prohibitive for realistic chains. The boost parameters wil increase the number of samples to be \({\rm boost}\times {\rm max}(n_1,n_2)\). Default boost parameter is one. If boost is None the full difference chain is going to be computed (and will likely require a lot of memory and time).
indexes_1 – (optional) array with the indexes of the parameters to use for the first samples. By default this tries to use all parameters.
indexes_2 – (optional) array with the indexes of the parameters to use for the second samples. By default this tries to use all parameters.
periodic_indexes – (optional) dictionary with the indexes of the parameters that are periodic. The keys are the indexes and the values are the ranges of the parameters.
- Returns:
WeightedSamplesthe instance with the parameter difference samples.