Importance sampling (reweighting) an analysis
Often we want to perform the analysis with a simplified model, e.g., using an ROQ approximation or a less-sophisticated waveform approximant. However, we also want to know what result we would have got without the simplifying assumptions.
In order to facilitate this, we provide an option to specify modifications to
the run configuration as an additional argument
----reweighting-configuration
. This should be either a json
file
or string containing a new prior-file
or any of the likelihood arguments
that can be passed to the bilby_pipe
parser.
If you are specifying a new prior file, the parameterization should remain the
same, reweighting to include new parameters will generally not work with this
implementation and should be done on a case-by-case basis. The exception to this
is adding calibration marginalization which can be included by specifying a new
calibration-model
as described in
arXiv:2009.10193.
If you are using the file transfer option, you must list this configuration file and any other needed files, e.g., a new prior file/calibration envelopes.
Reweighting nested samples
If the initial sampling is done with a nested sampler, it is possible to apply the importance sampling directly to the nested samples. This can lead to larger reweighting efficiency as the nested samples probe the tails of the posterior more deeply. To enable this, set reweight-nested-samples=True.
Example
In this example, we perform the initial analysis with the “relative binning”
method and a waveform without higher-order emission modes (IMRPhenomXAS
)
and then we reweight to the full likelihood with a waveform with higher-order
modes (IMRPhenomXHM
).
The configuration file for the initial analysis is a modified version of the injection example in the examples page.
spline-calibration-amplitude-uncertainty-dict {H1: 0.1, L1: 0.1}
spline-calibration-phase-uncertainty-dict {H1: 0.1, L1: 0.1}
calibration-lookup-table = {H1: outdir_bbh_injection/data/calibration_H1.h5, L1: outdir_bbh_injection/data/calibration_L1.h5}
accounting = ligo.dev.o4.cbc.pe.bilby
label = bbh_injection
outdir = outdir_bbh_injection
detectors = [H1, L1]
duration = 64
sampler = dynesty
sampler-kwargs = {'nlive': 1000}
additional-transfer-paths = outdir_bbh_injection/data/calibration_H1.h5,outdir_bbh_injection/data/calibration_L1.h5
prior-file = bbh_injection.prior
injection = True
gaussian-noise = True
injection-dict = {"mass_1": 41, 'mass_2': 39, 'a_1': 0, 'a_2': 0, 'tilt_1': 0, 'tilt_2': 0,
'phi_12': 0, 'phi_jl': 0, 'luminosity_distance': 1000, 'dec': -0.2, 'ra': 1.4,
'theta_jn': 0.2, 'psi': 0, 'phase': 0, 'geocent_time': 0}
injection-waveform-approximant=IMRPhenomXHM
n-simulation = 1
n-parallel = 1
request-cpus = 4
osg = True
likelihood-type = bilby.gw.likelihood.relative.RelativeBinningGravitationalWaveTransient
fiducial_parameters = {"mass_1": 41, 'mass_2': 39, 'a_1': 0, 'a_2': 0, 'tilt_1': 0, 'tilt_2': 0,
'phi_12': 0, 'phi_jl': 0, 'luminosity_distance': 1000, 'dec': -0.2, 'ra': 1.4,
'theta_jn': 0.2, 'psi': 0, 'phase': 0, 'geocent_time': 0}
waveform-approximant = "IMRPhenomXAS"
frequency-domain-source-model = bilby.gw.source.lal_binary_black_hole
reweighting-configuration=reweight.json
reweight-nested-samples=False
Since we are changing the likelihood used, we need to specify a new
likelihood-type
and frequency-domain-waveform-model
.
To change the waveform approximant, we just specify the new model.
{
"likelihood-type": "bilby.gw.likelihood.GravitationalWaveTransient",
"waveform_approximant": "IMRPhenomXHM",
"calibration-model": "CubicSpline",
"calibration-marginalization": true
}