gwinferno.pipeline.analysis.hierarchical_likelihood#

hierarchical_likelihood(pe_weights, inj_weights, total_inj, Nobs, Tobs, surveyed_hypervolume=None, categorical=False, marginal_qs=False, indv_weights=None, rngkey=None, pop_frac=None, reconstruct_rate=True, marginalize_selection=False, min_neff_cut=True, max_variance_cut=False, posterior_predictive_check=False, param_names=None, pedata=None, injdata=None, m2min=3.0, m1min=5.0, mmax=100.0, log=False)[source]#

Performs the hierarchical likelihood calculation using importance sampling over injections and PE samples from each event’s posterior samples assuming a fiducial prior density.

Parameters:
pe_weightsjax.DeviceArray

Array of weights evaluated at PE samples to integrate over. If log=True this is expected to be the log of the weights. Expected size of (N_events,N_samples).

inj_weightsjax.DeviceArray

Array of weights evaluated at found injections to integrate over. If log=True this is expected to be the log of the weights. Expected size of (N_found_injections,).

total_injint

Total number of generated injections before cutting on found.

Nobsint

Total number of observed events analyzing.

Tobsfloat

Time spent observing to produce catalog (in yrs).

surveyed_hypervolumefloat

Total VT (normalization of the redshift model).

categoricalbool, optional

If True use latent categorical parameters to assign each event to one of many subpopulations. Defaults to False.

marginal_qsbool, optional

TODO: add description!

indv_weightsjax.DeviceArray

TODO: add description!

rngkeyjax.random.PRNGKey, optional

RNG Key to be passed to sample categorical variable. Needed if categorical=True. Defaults to None.

pop_fractuple of floats, optional

Tuple of true astrophysical population fractions. Shape is number of categorical subpopulations, needs to sum to 1, and is needed if categorical=True. Defaults to None.

marginalize_selectionbool, optional

Flag to marginalize over uncertainty in selection monte carlo integral. Defaults to True.

reconstruct_ratebool, optional

Flag to reconstruct marginalize merger rate. Defaults to True.

min_neff_cutbool, optional

Flag to use the min_neff cut on the likelihood ensuring Monte Carlo integrals converge. Defaults to True.

max_variance_cutbool, optional

Flag to use a cut on the maximum allowed variance < 1 estimated for the total log likelihood. If this is True, then marginalize_selection and min_neff_cut must be False. Defaults to False.

posterior_predictive_checkbool, optional

Flag to sample from the PE/injection data to perform posterior predictive check. Defaults to False.

param_namesiterable, optional

Parameters to sample for PPCs. Defaults to None.

pedatadict, optional

Dictionary of PE data needed to perform PPCs. Defaults to None.

injdatadict, optional

Dictionary of found injection data needed to perform PPCs. Defaults to None.

m2minfloat, optional

Minimum mass for secondary components (solar masses). Defaults to 3.0.

m1minfloat, optional

Minimum mass for primary components (solar masses). Defaults to 5.0.

mmaxfloat, optional

Maximum mass for primary components (solar masses). Defaults to 100.0.

logbool, optional

Flag to perform calculations in log space. Interprets weights as log weights. This is slower but more numerically stable. Defaults to False.

Returns:
float

Marginalized merger rate in units of Gpc^-3 yr^-1.