---
title: "Hierarchical inference with selection effects on public GWTC-3 samples"
description: "Derive the population likelihood with its selection term, reweight event samples and injections, and fit a mass slope and maximum to 23 public O3b events."
canonical_url: "https://sandboxphysics.com/stories/gravitational-wave-populations/hierarchical-inference-with-selection/"
language: "en"
page_type: "story"
alternate_languages:
  zh-CN: "https://sandboxphysics.com/zh/stories/gravitational-wave-populations/hierarchical-inference-with-selection/"
last_modified: "2026-11-14"
---

[Gravitational-wave populations: mass gap, pairing and selection](https://sandboxphysics.com/stories/gravitational-wave-populations/)

# Hierarchical inference with selection effects on public GWTC-3 samples

Sandbox Physics · 2026-11-14

The population likelihood is a product over events of each event's evidence under the population model, divided by the detectable fraction once per event. Each evidence is estimated by reweighting that event's posterior samples by the population density over the prior used to make them; the detectable fraction is estimated by reweighting simulated signals that the searches found. Applied to 23 public O3b binary black holes with a power law from 5 solar masses to a sharp maximum, this gives a slope $\alpha=2.56$ (90% interval 1.84 to 3.17). Leaving out the selection term gives $\alpha=0.26$.

This chapter assumes Bayes' theorem, the Poisson distribution and Monte Carlo integration. It builds on the [observation model](https://sandboxphysics.com/stories/gravitational-wave-populations/building-the-population-model/) of the previous chapter. All numbers come from the frozen analysis described in the [method tutorial](https://sandboxphysics.com/stories/gravitational-wave-populations/recompute-the-mass-spectrum-inference/).

## Why event posteriors cannot simply be multiplied

Parameter estimation for event $i$ returns samples from its posterior

$$
p(\theta_i\mid d_i)=\frac{p(d_i\mid\theta_i)\,\pi_{\mathrm{PE}}(\theta_i)}{p(d_i)},
$$

where $\pi_{\mathrm{PE}}$ is the prior the analysts chose, broad and uninformative about the population. Two shortcuts are tempting and both are wrong.

The first multiplies the event posteriors by the population density, $p(\theta_i\mid d_i)\,p(\theta_i\mid\Lambda)$. That counts a prior twice: $\pi_{\mathrm{PE}}$ is still inside the posterior. The population must replace the parameter-estimation prior, not sit on top of it, so each sample is weighted by $p(\theta\mid\Lambda)/\pi_{\mathrm{PE}}(\theta)$. [Mandel, Farr and Gair, 2019, Eqs. 8 and 9](https://arxiv.org/abs/1809.02063v2)

The second treats the catalog histogram, or the stack of event posteriors, as the source distribution. It is the selected distribution $p(\theta\mid\mathrm{det},\Lambda)$ from the first chapter, smeared by measurement errors. Mandel, Farr and Gair also show that inserting $P_{\mathrm{det}}$ into the numerator, or dropping the normalization, biases the result. [Mandel, Farr and Gair, 2019, Section 5](https://arxiv.org/abs/1809.02063v2)

## Deriving the likelihood

Model mergers as an inhomogeneous Poisson process with expected number density $N\,p(\theta\mid\Lambda)$. A merger is detected with probability $P_{\mathrm{det}}(\theta)$, so the expected number of detections is $N\,\xi(\Lambda)$. The probability of the observed data sets $\{d_i\}$, with $N_{\mathrm{obs}}$ detections and none elsewhere, is

$$
p(\{d_i\}\mid N,\Lambda)\propto e^{-N\xi(\Lambda)}\prod_{i=1}^{N_{\mathrm{obs}}}N\int p(d_i\mid\theta)\,p(\theta\mid\Lambda)\,\mathrm d\theta .
$$

Take the scale-invariant prior $\pi(N)\propto1/N$ and integrate over $N$. Since $\int_0^\infty N^{N_{\mathrm{obs}}-1}e^{-N\xi}\,\mathrm dN=\Gamma(N_{\mathrm{obs}})\,\xi^{-N_{\mathrm{obs}}}$,

$$
p(\{d_i\}\mid\Lambda)\propto\prod_{i=1}^{N_{\mathrm{obs}}}\frac{\int p(d_i\mid\theta)\,p(\theta\mid\Lambda)\,\mathrm d\theta}{\xi(\Lambda)} .
$$

This is Mandel, Farr and Gair's Eq. 7; they note that the correspondence with the rate-marginalized form holds for the $1/N$ prior. The GWTC-3 population analysis uses the same likelihood. [Abbott and colleagues, 2023, Appendix A](https://doi.org/10.1103/PhysRevX.13.011048)

## Monte Carlo estimates and their effective sizes

With $S$ posterior samples $\theta_{ij}$ for event $i$ and $N_{\mathrm{found}}$ found injections $\theta_k$ drawn from a known density $p_{\mathrm{draw}}$ out of $N_{\mathrm{draw}}$ generated,

$$
\hat L_i(\Lambda)=\frac1S\sum_{j=1}^{S}\frac{p(\theta_{ij}\mid\Lambda)}{\pi_{\mathrm{PE}}(\theta_{ij})},\qquad \hat\xi(\Lambda)=\frac{1}{N_{\mathrm{draw}}}\sum_{k=1}^{N_{\mathrm{found}}}\frac{p(\theta_k\mid\Lambda)}{p_{\mathrm{draw}}(\theta_k)},
$$

$$
\ln\hat{\mathcal L}(\Lambda)=\sum_{i=1}^{N_{\mathrm{obs}}}\ln\hat L_i(\Lambda)-N_{\mathrm{obs}}\ln\hat\xi(\Lambda) .
$$

Both are importance-sampling averages, so both can fail when a few weights dominate. For weights $w$, the effective sample size $(\sum w)^2/\sum w^2$ counts how many samples effectively contribute. Farr defines the selection version as $N_{\mathrm{eff}}=\hat\xi^2/\sigma^2$, with $\sigma^2$ the Monte Carlo variance of $\hat\xi$, and shows that the likelihood can only be trusted when $N_{\mathrm{eff}}>4N_{\mathrm{obs}}$. [Farr, 2019, Eqs. 9 to 11](https://arxiv.org/abs/1904.10879v1) GWTC-3 adopts this condition and also requires every event term to have at least $N_{\mathrm{obs}}$ effective samples, setting the likelihood to zero elsewhere. [Abbott and colleagues, 2023, Appendices A and B](https://doi.org/10.1103/PhysRevX.13.011048)

## The model and the frozen data

The restricted model has two free parameters:

$$
p(m_1\mid\alpha,m_{\max})\propto m_1^{-\alpha}\ \ (5\le m_1\le m_{\max}),\qquad p(m_2\mid m_1)\propto m_2^{1.1}\ \ (5\le m_2\le m_1),\qquad p(z)\propto\frac{\mathrm dV_c}{\mathrm dz}(1+z)^{1.7}\ \ (z\le1.9).
$$

The redshift exponent is $\kappa-1$ with $\kappa=2.7$ fixed. The grid runs over $\alpha$ from 0 to 7 in steps of 0.05 and $m_{\max}$ from 40 to 100 solar masses in steps of 0.5, with flat priors.

The data are real public products of the LIGO, Virgo and KAGRA collaborations. The events are the 23 O3b candidates in the GWOSC GWTC-3 list with false-alarm rate below one per year and median secondary mass above 3 solar masses, each with 1500 samples of the mixed cosmological posterior. [GWTC-3 parameter-estimation release, Zenodo 5546663](https://zenodo.org/records/5546663) The selection term uses 20 000 of the 39 069 injections found with false-alarm rate below one per year in the O3b binary black hole sensitivity release; the number generated is scaled to $1.705\times10^7$. [O3 search sensitivity release, Zenodo 5546676](https://zenodo.org/records/5546676)

The cosmological samples were reweighted to a prior uniform in detector-frame masses and in comoving volume and source time. Changing variables to source-frame masses gives

$$
\pi_{\mathrm{PE}}(m_1,m_2,z)\propto(1+z)^2\times\frac{1}{1+z}\frac{\mathrm dV_c}{\mathrm dz}=(1+z)\frac{\mathrm dV_c}{\mathrm dz} .
$$

## Results

**Table 3.1** Restricted inference on 23 O3b events. Medians with 90% intervals; masses in solar masses.

| Analysis | Slope $\alpha$ | Maximum $m_{\max}$ |
| --- | --- | --- |
| With selection (reported) | $2.56$ ($1.84$ to $3.17$) | $54$ ($46$ to $75$) |
| Without selection | $0.26$ ($0$ to $0.76$) | $57$ ($48$ to $71$) |
| Cells with an event below 20 effective samples removed | $2.68$ ($2.06$ to $3.24$) | $58$ ($52$ to $79$) |
| Power law fitted to detected median masses | $0.75$ | fixed at $100$ |

The selection term changes the slope by more than two. Without it, the likelihood is maximized by populations whose heavy end is common, because that is what the catalog shows. The naive fit to the detected medians repeats the same mistake in another way.

The checks behave as follows. At the posterior peak ($\alpha=2.45$, $m_{\max}=50.5$) the detectable fraction is $1.0\times10^{-3}$ and the selection effective size is about 9800, far above $4N_{\mathrm{obs}}=92$; its smallest value on the whole grid is 142, at $\alpha=7$ and $m_{\max}=40$. Two independent halves of the injections give detectable fractions that agree within 0.6 standard errors at five test points.

The event terms are the weak point. GW191109\_010717 has a primary near 65 solar masses. When $m_{\max}$ cuts into its posterior, few of its 1500 samples survive: at the peak it has only 12.5 effective samples. 36% of the reported posterior mass lies in cells where some event has fewer than 20. Removing those cells, as GWTC-3's data-dependent cut would, moves the median $m_{\max}$ from 54 to 58. We report the uncut result and show the cut beside it, because a cut that depends on the data also changes the posterior. Three events have samples above 100 solar masses, where the injections stop and the model gives zero weight; the largest share is 5.4%, for GW191127\_050227.

## Does the method recover a known answer?

An independent test uses synthetic catalogs with a known truth. Even-indexed found injections are resampled to a population with $\alpha=3.5$ and $m_{\max}=70$ and become synthetic detections. Each gets a mock posterior, Gaussian in the logarithms of detector-frame chirp mass, mass ratio and redshift; odd-indexed injections estimate the selection term, so the two halves never share a signal.

**Table 3.2** Coverage over 100 synthetic catalogs per row. The binomial standard error of a 90% coverage is 0.03.

| Events per catalog | Selection term | $\alpha$: 68% / 90% coverage | $m_{\max}$: 68% / 90% coverage |
| --- | --- | --- | --- |
| $23$ | yes | $0.61$ / $0.91$ | $0.79$ / $0.95$ |
| $23$ | no | $0.00$ / $0.00$ | $0.73$ / $0.93$ |
| $92$ | yes | $0.51$ / $0.83$ | $0.52$ / $0.82$ |
| $92$ | no | $0.00$ / $0.00$ | $0.47$ / $0.74$ |

Without the selection term the true slope is never inside the interval. With it, 23-event catalogs cover close to nominal, although a test of the truth percentiles still finds a small shift. At 92 events the coverage falls: the Monte Carlo error of the event terms grows with the number of events, and synthetic binaries close to the sharp 5 solar-mass edge have few effective samples. Larger catalogs need more samples per event or a smooth lower edge.

## How this compares with GWTC-3

The full GWTC-3 analysis fits a power law plus a Gaussian peak to all confident events from three observing runs and finds $\alpha=3.5^{+0.6}_{-0.56}$, a peak at $34^{+2.6}_{-4.0}$ solar masses holding a fraction $\lambda=0.038^{+0.058}_{-0.026}$ of mergers, and 99% of primaries below $44^{+9.2}_{-5.1}$ solar masses. [Abbott and colleagues, 2023, Section VI A](https://doi.org/10.1103/PhysRevX.13.011048) Our single power law has no peak. To cover the excess between 30 and 40 solar masses it must fall more slowly, so a flatter slope is the expected consequence of the simpler model, not a contradiction. Our sharp support edge $m_{\max}$ marks where this model's probability drops to zero. The published 99th percentile marks where its remaining tail carries one percent.

## Lab tasks

Open the [population Lab](https://sandboxphysics.com/labs/gravitational-wave-population-selection/).

1. Predict, then watch: choose the selection pile-up preset. Before looking, predict the catalog median from the first chapter's Euclidean estimate with $\alpha=2.35$. Compare with the readout.
2. Change one condition: in that preset, raise the slope from 2.35 to 3.5. Watch the universe curve and the catalog curve. Which one changes shape more?
3. Compare: read the catalog median for slopes 2.35, 2.6 and 3.5. Explain why an analysis that fits the catalog curve directly, without the detection-probability curve, would return a slope that is too small.
4. Explain: the Lab's default uses $\alpha=3.5$ plus a peak, while the frozen inference gives $2.56$ without one. Use the Lab to show how a peak at 34 changes the catalog above 30 solar masses.

## Exercises

1. Show that the prior $\pi(N)\propto1/N^2$ does not lead to the form above. What extra power of $\xi$ appears?
2. In the frozen analysis $N_{\mathrm{obs}}=23$. With only 500 found injections, the selection effective size at $\alpha=2.6$ is 212, and the Farr condition first fails at $\alpha=3.15$. Is the analysis safe? What would you report?
3. The three weights of one event are $(1,1,1)$ for one $\Lambda$ and $(10,0.1,0.1)$ for another. Compute the effective sample size for each.
4. Why is a sharp lower edge at 5 solar masses hard on the event terms, even though every detected primary is well above 5?

Answers

1. With $\pi(N)\propto N^{-2}$, $\int N^{N_{\mathrm{obs}}-2}e^{-N\xi}\,\mathrm dN=\Gamma(N_{\mathrm{obs}}-1)\,\xi^{-(N_{\mathrm{obs}}-1)}$. The likelihood then carries $\xi^{-(N_{\mathrm{obs}}-1)}$, one power of $\xi$ fewer, which shifts the population posterior slightly toward larger detectable fractions.
2. Not everywhere. At the reported peak it passes, since $212>92$, but part of the posterior lies above $\alpha=3.15$ where it fails. Either use more injections or restrict and report the region where the condition holds. With 20 000 injections it holds on the whole grid.
3. $(1+1+1)^2/3=3$. $(10.2)^2/(100+0.01+0.01)\simeq1.04$: one sample carries almost all the weight.
4. The edge also applies to the secondary. In the frozen data six events have between 1.3% and 6.3% of their samples with $m_2<5$, the largest share for GW200316\_215756. Those samples get zero weight, so the event term rests on fewer samples and its Monte Carlo error grows. Synthetic binaries drawn right at the edge lose a much larger share of their mock samples, which is why the 92-event catalogs suffer most.

## Sources

1. [Mandel, Farr and Gair, 2019, Eqs. 8 and 9](https://arxiv.org/abs/1809.02063v2)
2. [Abbott and colleagues, 2023, Appendix A](https://doi.org/10.1103/PhysRevX.13.011048)
3. [Farr, 2019, Eqs. 9 to 11](https://arxiv.org/abs/1904.10879v1)
4. [GWTC-3 parameter-estimation release, Zenodo 5546663](https://zenodo.org/records/5546663)
5. [O3 search sensitivity release, Zenodo 5546676](https://zenodo.org/records/5546676)

## Keep reading

Gravitational-wave populations · Reading path

### From a biased catalog to a corrected mass spectrum

1. [Article **Are the black holes we detect a fair sample of the universe?**](https://sandboxphysics.com/stories/gravitational-wave-populations/are-detected-black-holes-a-fair-sample/)
2. [Article **Detection probability, redshifted mass and the pair-instability gap**](https://sandboxphysics.com/stories/gravitational-wave-populations/detection-probability-and-the-mass-gap/)
3. [Article **Build a population model from mass, redshift and detector range**](https://sandboxphysics.com/stories/gravitational-wave-populations/building-the-population-model/)
4. [You are here **Hierarchical inference with selection effects on public GWTC-3 samples**](https://sandboxphysics.com/stories/gravitational-wave-populations/hierarchical-inference-with-selection/)
5. [Article **Recompute the black-hole mass spectrum from frozen GWTC-3 data**](https://sandboxphysics.com/stories/gravitational-wave-populations/recompute-the-mass-spectrum-inference/)
6. [Article **What GW190521 says about the mass gap and repeated mergers**](https://sandboxphysics.com/stories/gravitational-wave-populations/reading-gw190521-formation-channels/)
