Analyzing simulated non-informative posteriors
A powerful test of population inference is to use non-information posteriors (i.e., prior samples) as the input. If the analysis is unbiased, we should recover the prior distribution on our hyperparameters.
We can perform such an analysis with the following bash script.
#!/usr/bin/env bash
RUNDIR=prior
LOGDIR=$RUNDIR/logs
LABEL=simluation
RESULT_FILE=$RUNDIR/result/${LABEL}_result.json
SAMPLE_FILE=$RUNDIR/result/${LABEL}_samples.hdf5
touch empty.txt
gwpopulation_pipe_collection empty.txt\
--run-dir $RUNDIR --log-dir $LOGDIR --label $LABEL --data-label $LABEL\
--parameters mass_1 --parameters mass_ratio --parameters a_1 --parameters a_2 --parameters redshift --parameters cos_tilt_1 --parameters cos_tilt_2\
--n-simulations 10 --samples-per-posterior 1000 --sample-from-prior True
gwpopulation_pipe_analysis empty.txt\
--run-dir $RUNDIR --log-dir $LOGDIR --label $LABEL --data-label $LABEL\
--prior-file test.prior --sampler pymultinest --sampler-kwargs "{nlive: 100}"\
--enforce-minimum-neffective-per-event True\
--vt-function ""
gwpopulation_pipe_plot empty.txt --run-dir $RUNDIR --result-file $RESULT_FILE --samples $SAMPLE_FILE
gwpopulation_pipe_to_common_format -r $RESULT_FILE -s $SAMPLE_FILE
Note
In this example, we use the pymultinest
sampler rather than the default dynesty
.
This does not install automatically with gwpopulation_pipe
, however it can be simply installed with
$ conda install -c conda-forge pymultinest
pymultinest
can’t be simply installed using pypi
as it relies on the fortran
package MultiNest
.
This will create a directory prior
with two subdirectories data
and result
.
The data
directory contains the simulated posterior and violin plots of the input parameters.
The result
directory contains the output of the sampler and various plots produced in post-processing.