Manuscript Offprint
arXiv:2609.10534Likelihood-free inference with nuisance parameters through normalizing flows
Abstract
We present a simple decomposition of a neural-network-based normalizing flow that naturally uncovers a pivotal statistic (or something close) in the presence of nuisance parameters, based only on a sample generator from the distribution of interest. We show that the statistic is near-pivotal in the sense of minimum average KL-divergence of its -values versus uniform and we argue that it can be expected to have good power when the dimension of the statistic equals the dimension of the parameter. It is able to incorporate prior knowledge about group invariances such as translation and scale. It can discover the one-sample -test almost exactly, outperforms the Welch test in terms of worst-case size over a constrained variance-ratio range and achieves good calibration on partial biserial correlations, while showing higher power (and being much faster) on small-to-moderate samples than profile likelihood-ratio techniques.
Keywords: pivotal statistic, nuisance parameters, likelihood-free inference, simulator-based inference
1 Introduction
On the other hand, a number of more “general” approaches do exist, whose goal is to be able to perform inference across a broad range of parametric parent distributions. Owing to the complexity of the problem of finding a similar test across an entire space of nuisance parameters, these each rely on different constraints or approximations.
The profile likelihood ratio (LR) is the basis for many of these. The profile LR compares the likelihood at the maximum likelihood estimate (MLE) to that at a null-constrained MLE, where the interest parameter is constrained to equal some null value. In the large sample limit, it can be shown that converges in distribution to a distribution (Wilks 1938). That is, its limiting distribution is, to first order, independent of nuisance-parameter values.
An alternative general approach is the parametric bootstrap (Davison and Hinkley 1997), in which many samples are drawn from a fitted model, and used to approximate the sampling distribution. One may, for example, draw many datasets from a model using the MLE as its parameters, and map each dataset to a given scalar statistic; the spread of these bootstrap statistics can be used to estimate the standard error of that statistic. Alternatively, sampling from a model with parameter set to the null-constrained MLE can be used to generate a -value against a given null hypothesis.
One popular statistic to bootstrap is the profile LR, since it is known to be highly informative about the interest parameter and also to have a limiting distribution that is pivotal. This effectively combines the bootstrap and LR approaches: using the powerful and asymptotically-pivotal LR, without relying on the large-sample assumption required for the approximation.
Nevertheless, the bootstrap is still only an approximation: the bootstrap distribution is drawn from the MLE, rather than the true population parameter. Higher order refinements and iterating bootstraps-within-bootstraps can improve accuracy in some settings, but at the cost of substantially increased computation (Hall and Martin 1988).
In recent years, there has been growing interest in applying machine learning techniques to this problem. A deep neural network (DNN) is an extremely flexible, differentiable function approximator that can be quite efficiently trained to optimize some loss function. For example, Coccaro et al. (2020) use DNNs as surrogates for complex likelihood functions, so that they may be used in LR or Bayesian approaches, among other possibilities.
Cranmer et al. (2015) show that a neural net trained by cross-entropy to distinguish between samples generated under two different parameter values encodes (up to a transformation) the LR statistic, without needing to model the likelihood directly. Instead it is trained on samples drawn from the model of interest; in many real-world cases, such a simulator is available where an explicit likelihood function is not. In the presence of nuisance parameters, the same classifier-based ratio idea can be embedded in a profile-LR construction. Heinrich (2022) trains a model to distinguish data from any given null vs data from any of a mixture of alternatives, all at an equal Fisher-metric distance from the given null. He notes that this should target the test statistic with best average power (for this mixture) and show that it recovers the profile LR in cases where that is known to be most powerful.
For the final step from statistic to p-value, Dalmasso et al. (2024) present a framework in which learned test statistics (such as their classifier-based LR-approximator called ACORE) are mapped to critical values (for confidence intervals/regions) by quantile regression and p-values by a probabilistic binary classifier. They refer to this framework as “Likelihood-free Frequentist Inference” (LF2I), again stressing the broader range of applications where no likelihood function is required; only a simulator. Al Kadhim et al. (2024) take this a step further to model the entire curve of critical values by training a binary classifier to model the CDF of the test statistic given the parameter. More specifically, they train the net by least squares to model the expectation of a binary indicator on whether samples are greater or less than a given threshold.
Particularly relevant to our work, however, is that of Louppe et al. (2017). They, like us, attempt to train directly a neural net that will, by its design, identify a pivotal statistic. They do this by adapting the concept of generative adversarial networks (GANs) from Goodfellow et al. (2014). A secondary “adversary” net attempts to predict, by maximum likelihood, the values of the nuisance parameters from the output of the pivot-learning “classifier” net; the latter, in turn, aims to minimize the same predictive log likelihood, while simultaneously maximizing the log likelihood of a target label given the observed data. In the context of frequentist statistical inference, this target label could encode the hypothesis or parameter value of interest. By optimizing both objectives, the net uncovers a statistic that is pivotal with respect to the nuisance parameters while remaining optimally predictive of the target label.
Training a neural network can be computationally expensive. However, in many cases, once fit, the same network can be reused over and over again very cheaply, effectively paying off the initial investment. For this reason, such approaches are often referred to as “amortized” (Zammit-Mangion et al. 2025).
1.2 Introducing NeuralCIs
In the following, we will introduce the first phase of a project called NeuralCIs, whose ultimate goal will be to use neural models to generate confidence intervals and regions. In this first phase, we focus on the generation of p-values in the presence of nuisance parameters, but these are expected to be quite readily converted into confidence intervals by a further training step (see Section 8.2.1) and we hope will be generalizable to simultaneous confidence intervals and confidence regions over vector-valued interest parameter. The code for the project can be followed on GitHub at github.com/philassheton/neuralcis.
The idea is to train a single neural net that can solve an entire class of problems; once trained (this currently takes two to four hours on a modest RTX 3060 laptop GPU), the net can very quickly convert any dataset into a p-value (and ultimately confidence interval) against any of a range of values for the interest parameter; that is, the initial training cost is amortized.
Using a neural model in this way feels quite natural. To generate a single p-value one must anyway effectively compare the one dataset of interest to all datasets that are probable under one null hypothesis; to generate a confidence interval extends this search out to many “null hypotheses”. Whereas bootstrapping would start afresh for each new dataset, fitting a single neural net to model all possible outcomes at all of a wide range of parameters means that that broad “search” across many samples from many parameter values can be shared and reused each time a new dataset arrives that fits a given problem; that initial cost is amortized.
Furthermore, neural networks are quite efficiently differentiable, which makes them great for optimisation; we will take advantage of this in Section 8.2.1 to propose a method to extend our -values quite cleanly to confidence intervals.
Our work adapts the idea of the normalizing flow (Papamakarios et al. (2021)), which we will summarize in Section 2. The key novel contribution is a decomposition of the normalizing flow that automatically yields an on-average near-pivotal statistic (Section 3). We show that this statistic is near-pivotal in the sense that -values derived from it have minimal average KL-divergence to uniform. We further argue that it can be expected to be reasonably powerful by an implicit bias argument that becomes more concrete for transformation models at one extreme and in the large sample local asymptotic normal (LAN) limit at the other. We assess both the calibration and power through simulation.
In Section 2, we introduce the normalizing flow, how we implement it in NeuralCIs (somewhat different than normal), and how we can flip its input and output roles to provide amortized sampling from an unnormalized target density. In Section 3, we detail the core decomposition that we will use to identify near-pivotal quantities, and how that can be used to generate -values. In Section 4, we explore the formal statistical properties of this decomposition, in particular, its expected false-positive rate behaviour as well as an implicit bias argument that it might be expected in many practically useful contexts to achieve good true-positive rates. In Section 5, we outline further technical points central to our architecture (invariances, adding known values such as sample size, parameter sampling and neural network design). In Section 6, we present experimental methodology on one toy and three classical statistical problems, whose results we present in Section 7 and discuss in Section 8. A final conclusion is in Section 9.
2 Normalizing flows
Normalizing flows are highly flexible probability density models that can approximate almost any continuous density encountered in practice on . The idea is very simple: use a neural network to model an invertible change of variables, such that the distribution in the new variables is a simple one, commonly a standard normal.
2.1 Core concept
We will abbreviate and write a neural network mapping as . Denote the true distribution of the inputs as and of the net outputs as . We optimize the weights of the network to bend samples from the true distribution as close as possible in distribution to the theoretical target distribution . This induces a theoretical approximate distribution on x:
whose fit we can optimize by minimizing the sum of the negative log likelihood across a large number of samples :
This maximization of across samples from is in the large-sample limit equivalent to minimizing the Kullback-Leibler (KL) divergence (Papamakarios et al. 2021).
2.2 Invertibility and tractability
In order to have tractable Jacobian determinants, a typical normalizing flow constrains each network layer to have a trivial Jacobian determinant (for example, by designing each layer to have a triangular Jacobian matrix), and to be invertible by construction.
We instead compute Jacobians by back-propagation (chain-rule backward through the net) and enforce approximate invertibility by punishing zero and negative Jacobian determinant. The latter is achieved by replacing the absolute value of the Jacobian determinant in (1) with , with and chosen to be small, without being small enough to erase the gradients of below numerical precision.
This approach is quite computationally expensive ( in the number of statistics ) but our flows still train in a few hours on a very modest laptop GPU (RTX 3060 mobile). We tolerate this extra cost because it affords us incredible flexibility in terms of introducing conditioning variables (Section 2.3) and decomposing our flow (Section 3), without the need to experiment with exotic constrained architectures. The key here is that the traditional normalizing flow (with those architectural constraints described above) is designed to work well at very high dimensions. Ours is instead (at present) designed for high flexibility with relatively low-dimensional problems.
We may in later iterations of the project experiment with higher dimensional problems. Apart from such architectural constraints, one particularly promising approach is offered in recent work by Draxler et al. (2024). They propose an approximation method for fitting free-form flows that is instead per data-point. Furthermore, they are able to target a global diffeomorphism via an extra inverse flow whose role is to reconstruct the input. (Our approach can only at present target a local diffeomorphism, which does leave scope for dysfunctional flows to be fitted, for example, by wrapping coordinates around a circular path back onto themselves.)
2.3 Conditional Normalizing Flows
With this more naïve approach, we can very easily make our normalizing flow model a conditional probability density , by simply adding as extra inputs to the network. This allows it to fit a different mapping at each value of , each representing that particular conditional “slice” of distribution. Training proceeds as before, but with the extra inputs playing no role in the Jacobian computed in the loss function (1).
2.4 “Denormalizing flows” for amortized sampling
During training, we will need to generate a huge number of samples, which we hope to draw approximately according to a Jeffreys’ prior, (further details in Section 5.3). We can invert the logic of a traditional normalizing flow to train a model that, once fitted, can rapidly draw an unlimited supply of samples from such a differentiable unnormalized target density (Rezende and Mohamed 2015; Papamakarios et al. 2021).
We will again use and to refer to the true distribution of our and samples and , to mean some theoretical target distribution that we want to bend them toward. The key intuition here is that we reverse all the roles, compared with the core normalizing flow concept described in Section 2.1. The samples we feed into the net are standard normal , and the outputs will aim to be distributed according to some distribution , where we only know up to some multiplicative constant . We aim then to learn the mapping .
We rewrite (1) as
and we may discard the constant term without affecting the optimal value for .
As with the regular normalizing flow, maximizing across a large enough sample of is equivalent to minimizing . Intuitively, the determinant encourages the outputs to spread out and explore the region of support of , while the component encourages them to cluster wherever is high.
In the literature, this is still viewed as a normalizing flow, but fit by minimizing reverse KL divergence. As a shorthand in this paper, we will refer to this architecture as a “denormalizing flow”, to signify that it maps samples from a normal distribution to the target, rather than vice versa. This name distinguishes it from the form described in Section 2.1, which forms the basis of most of the work in this paper; the “denormalizing flow” is used only for parameter sampling during training.
3 Decomposing the normalizing flow
The key novel contribution of this paper is a very simple decomposition of the normalizing flow that naturally uncovers pivotal quantities and their distributions.
Suppose that the parameter has dimension with scalar interest parameter ; all other dimensions of are to be considered nuisance parameters. We constrain ourselves here to the case where the dimension of our dataset summary is the same as that of ; that is, . We hope to explore the extension to in future work (see Section 8.2). A pure normalizing flow to describe the distribution of x, given parameter is simply a neural net mapping , with the Jacobian determinant computed only versus the first inputs.
We propose to decompose this into two separate neural nets, a pivoting net and a nuisance net :
The key point here is that the first net is not aware of all parameters , but only of the scalar interest function of them . The two outputs are concatenated,
so that .
From here, the same normalizing flow training outlined in Section 2 is followed, to coerce to follow a standard normal distribution, by maximizing the sum across (1). Under a few assumptions about the nature of and of the broader sampling distribution, will be, on average across the training distribution of , as close as possible to standard normal (in terms of KL-divergence, see Section 4), while the mapping required to generate it requires knowledge of only through .
3.1 One further constraint
We also add one further constraint,
This constraint helps to prevent from flipping orientation and/or folding with respect to (which would otherwise be technically possible, as long as compensates to keep the entire mapping a diffeomorphism). It also helps to encourage a clean alignment of with the underlying nuisance-free component of the -action on the data (see, for example, Appendix C.2.2), thereby improving our argument that our architecture should provide reasonable power.
This constraint is enforced in our architecture by adding to the loss
with chosen large enough to have a large impact at small positive , without causing numerical overflows.
3.2 Obtaining p-values from
We convert to a one-tailed -value by the standard normal CDF, . In Section 4.2, we show that (under certain assumptions) will be (on average across the training distribution of ) as close to standard normal as the model permits (minimal in KL-divergence from normal). Equivalently, the average KL divergence between and uniform is minimized. These are then converted to equal-tailed two-tailed -values by .
3.3 An example: the one-sample -test
As a simple example, we might want to reproduce the one-sample -test. In this case, our parameters represent the population mean and standard deviation, with interest parameter . Our statistics would be the sample mean and standard deviation . We would train simultaneously
and in our loss function, .
We may then obtain a one-tailed -value for a given sample against null hypothesis , by and a two-tailed -value by .
4 Formal properties
4.1 Assumptions
Let denote the random vector of statistics used by the method, with realized value . We train our model over a large set of parameter values , and make inferential claims on a smaller region (see Section 5.3). All assumptions below are assumed to hold across .
4.1.1 Suitable models
We constrain our attention to a certain subset of models, for which we believe this architecture in its current form is most promising. We first assume that the statistic has the same dimensionality as the parameter , that is .
We further assume that the interest parameter is a clean, unfolded coordinate in ; concretely that can be smoothly and one-to-one reparameterized as
and in this section we write , with .
In particular, we developed our architecture with models in mind of the form
for error that is relatively concentrated and varies smoothly, and slowly, in . We do not at present restrict ourselves exclusively to these models, but our arguments regarding power in Section 4.3 in particular will be more easily understood in this context.
In particular, we will assume not only that , but also that the transport of the density , induced by perturbations of , is full-rank. That is to say, at each , perturbing each dimension of transports the probability mass in a direction linearly independent of that induced by perturbing any other dimension. As shorthand, we will refer to such dimension-matched and full-rank-transported models as “full-rank models”.
4.1.2 Standard regularity assumptions
We assume that has a smooth density . We work on a single regular coordinate patch of the model, excluding regions where the model becomes locally singular, folds back on itself, or wraps around so that the same local model is represented by multiple parameter values.
Denoting the log likelihood by , we assume that the score , exists with finite variance. The Fisher information, , is assumed to exist and have full rank throughout the region considered.
For the formal arguments below, we will additionally assume that the learned transformation is one-to-one on the relevant support (and defines a valid change of variables). Our present implementation encourages local invertibility through the Jacobian penalty, but does not guarantee global invertibility, as discussed in Section 2.2.
4.2 Near-uniformity (by KL) of -values (type I error)
In the limit of infinite samples, maximizing the likelihood of our constrained normalizing flow has the effect of minimizing the Kullback-Leibler (KL) divergence between our and the normal distribution , averaged across the distribution used to sample during training.
Let be the random variable that instantiated into individual samples and
and let represent a -dimensional standard normal variable.
By the Kullback-Leibler chain rule, we have:
Assuming that is sufficiently flexible to Gaussianize the conditional distribution , the final term here can be made (approximately) zero. In this case, fitting our model, finds the model that minimizes the first term: . (Of course, our neural network is probably not sufficiently flexible to make the final term exactly zero, but we assume it to be sufficiently flexible to make it negligible.)
Furthermore, KL divergence is invariant under a bijective change of variables, such as conversion of our standard normal into a one-tailed -value, . This means that our -values are optimized to have a minimum average KL divergence,
versus a uniform distribution, . (Note that we are using the random variable here to refer to a -value to avoid confusion with our densities and .)
4.2.1 Suitability of KL optimization
If there truly exists a perfect pivot, we expect our KL divergence to be minimized at the point where is indeed pivotal. However, in the case where one does not exist, the model must make trade-offs. In this case KL is a somewhat unnatural loss function. Minimizing KL divergence does not focus on the sort of tail-specific calibration, or worst-case guarantees that we would ideally want for -values.
Nevertheless, it has some nice properties in that direction. With a uniform target , we have ; for close to uniform, we can expand around ,
and given that when , we have
That is, when is close to uniform, will trade improvements at one part of the distribution for deviations at another according to the distance between the true density and uniform.
When generating -values, we are most interested in how the cumulative distributions compare; unfortunately, relatively small deviations in density can accumulate across into relatively large discrepancies in cumulative distribution. On the other hand, our interest is particularly in comparing these cumulative distributions in the tails. In the tails, there is much less space for small discrepancies in density to accumulate; the only way to drastically inflate the error rate at is to squash a considerably increased density of -values into the small space , which would be detected by the Kullback-Leibler divergence.
So, while an ideal method might specifically target CDF uniformity in the tails, optimizing the Kullback-Leibler divergence should nonetheless give a result whose tail CDF is nudged into the right ballpark. Nonetheless, this is still on-average near-pivotal. It must be stressed that this leaves open a gap for severely non-pivotal behaviour at some parameter values to be traded off against consequently improved behaviour at others. This is particularly possible at low-probability parameter values, where very poor calibration may nonetheless have a very small impact on the loss. On the other hand, if a true pivot exists, we have good reason to expect that our model will find it.
4.3 Power (type II error)
Identifying a pivot does not in itself guarantee that that pivot contains any information whatsoever about the interest parameter . Unlike the GAN approach from Louppe et al. (2017), our net makes no explicit attempt to retain information in our pivot. Particularly in cases where (but not limited to these), there may be many ancillary statistics that contain information neither about nor . However, in the full-rank models (defined in Section 4.1.1) that we are focussed on, we believe that in general, identifying a pivot does recover a useful test statistic. We make this argument by analogy to the profile likelihood ratio (LR) and its gradient, the efficient score.
The profile LR achieves excellent power on nuisance parameter problems by starting with the most powerful simple-vs-simple test (the plain LR) and removing by choosing it at its optimal value. This has the effect of narrowing the LR for any parts of the data that both and could equally well explain. The result is that any contribution of that equally could have come from is absorbed away in the optimisation, leaving only the pure -information behind. In our model, has a similar role: it absorbs the nuisance directions, so that contains only pure -information that cannot be mimicked by changing . In a “full-rank” model (Section 4.1.1), there are no redundant dimensions available for to inhabit other than this one.
We make this more concrete below by reference first to transformation models (in which this effect is quite clean) in Section 4.3.1, before attempting to extend this logic to a broad subset of non-transformation models, first somewhat heuristically in Section 4.3.2 and then more concretely based on asymptotics in Section 4.3.3.
4.3.1 Transformation models
We can make this link between and the profile LR quite tangible in transformation models, where the parameters and corresponding data can be indexed over by the action of a group with full rank (). This case covers a huge range of classical examples, such as inference on means and standard deviations of normal models, differences of means and ratios of variances in normal models, linear regression, the ratio of two exponential rates, etc.
In Appendix C, we show how the most natural would also be (close to) profile LR sufficient; that is, the profile LR would depend on (almost) only via . We argue this first by summarizing previous work showing (Appendix C.1) that in such models, the profile LR must be a function of the maximal invariant of under the action of . We further argue (Appendix C.2) that the most natural destination for is the same maximal invariant, with the only loss-minimizing alternative being highly globally organized deviations that
-
are neither encouraged nor discouraged by our loss function,
-
tend to average out to be very small across a random initialisation, and
-
occupy such a small volume in the space of possibilities, that random steps along these directions under stochastic gradient descent are expected to be negligible.
In Section 7.4, we present results of an experiment to demonstrate this effect. We also show in Appendix C.2.3, that small deviations of this kind would not degrade power significantly.
4.3.2 Near-transformation models
In general, non-transformation models have no maximal invariant to hang these arguments on. However, the core intuition behind the expected power performance in transformation models is: if absorbs the nuisance directions, then what remains is the pure information about , unpolluted by . We will argue here that the same intuition may be applied to a broad class of non-transformation models also.
At the infinitesimal level, the analogy to transformation models is strong: assuming (as we did with our transformation models) that each parameter transports the probability mass in a linearly independent direction, there is a quotient direction that contains the “pure information”, after removal of any information which could have been accounted for by . And, since movement induced by produces, to first order, no displacement along this local quotient direction, it is locally pivotal with respect to and thereby, locally appealing to .
However, globally, must stitch together these local quotient directions. Transformation models are the special case where these directions are mutually consistent; each is a local view on the same global coordinate, the maximal invariant. In general models, the local quotient directions may be inconsistent with each other and the learned is there best viewed as a smooth global compromise, with its alignment to the local quotient directions depending on the regions of parameter space emphasized by the training distribution and likelihood. Formulating a condition under which these local invariants are “consistent enough” is a work in progress; such models we refer to here informally as “near-transformation models”.
As with type I error, this does again leave open the possibility for the architecture to trade poor power in one region of parameter space (particularly one with lower weighting) for improved power at another. There is no specific component to the loss that rewards an informative pivot and, as such, we will again rely on simulation of the resulting architecture, to understand its properties in this regard.
This argument can be made much more concrete as sample size increases:
4.3.3 The local and asymptotic case
Treating the -dimensional supplied to the architecture as the observed data, suppose that its distribution is locally asymptotically normal (LAN). This occurs, for example, when is an efficient estimate of based on a growing underlying dataset. However the class of asymptotically normal estimators for which this holds is far broader.
As the underlying sample size increases, the local region of that is relevant for a given sample x shrinks, and on that shrinking local scale, the likelihood loses its higher-order shape, converging effectively to a Gaussian shift experiment. We explore such an experiment in Appendix C.1.1, and summarize the conclusions here, adapted as they relate to this local asymptotic normal (LAN) case:
- Local to parameter , the likelihood function is approximately quadratic,
where and are the score and Fisher information (respectively), evaluated at fixed close to , and is the constant likelihood at the peak of the quadratic.
-
Here is the random variable in our local asymptotic Gaussian-shift experiment, . But it also plays the role of a simple conversion of into a more intuitive form, which locates the at the turning point of the quadratic, so that it can be expressed as a perfect square. Computing this way is also the only adaptation necessary to convert the Gaussian location experiment in Appendix C.1.1 into its LAN equivalent here.
-
Profiling this quadratic absorbs any information that can be explained by , to leave a one-dimensional quadratic profile likelihood that has the same form as the marginal likelihood for : it is centred at the same as the - dimension of the full likelihood , but with potentially reduced curvature, capturing information lost to . Subtracting the maximum, (a constant in ), gives the log profile LR ,
where is the - (first-) element of ,
is the efficient score, is the efficient information
and is the constant profile likelihood value at the peak of the quadratic.
- The maximal invariant of this local Gaussian location experiment is
We can see that the data enters the maximal invariant (the natural target for , see Appendix C.2) only through the efficient score: an object known to be highly informative about . Furthermore (and as expected), the powerful profile LR is a function of this maximal invariant.
What is more, after a simple local rescale, this maximal invariant is known to converge in distribution, , making it asymptotically pivotal and so an ideal target for . (The limiting distribution of results directly from this.) This convergence in part reflects the shrinking local region over which the nuisance effects must be unified. The same benefit can be expected for : consistency between the local maximal invariants is required over a progressively smaller neighbourhood, making the job of combining them into a global progressively easier.
The efficient score, profile LR and local maximal invariants all then embody precisely the intuition we are aiming at: that removal of -information distils the pure -information. In the LAN limit, all three draw from the same local information about , and we might expect to converge to their performance in terms of power.
5 Further considerations
In Section 5.1 we discuss how we incorporate invariances into our model and in Section 5.2 we further add extra “known values” (like sample size) to allow our model to work over a wider range of inputs. In Section 5.3, we discuss how to sample parameters so that we have confidence in our -values. Finally in Section 5.4, we discuss small tweaks to the neural network design that we have found anecdotally to be helpful.
5.1 Incorporating invariances
In many cases, there are invariances in the structure of our model that we can exploit. In the one-sample -test example (Section 3.3), we expect the same behaviour irrespective of location and scale. If we can incorporate these invariances into our neural network mappings, we can reduce their complexity (reducing their dimensionality), while simultaneously expanding the domain over which they can produce valid -values (across all locations on a given orbit; in many cases this makes the domain infinite in one or more dimensions).
Suppose that the model we wish to fit is invariant (up to the corresponding Jacobian factor ) under the action of a transformation group ; specifically ,
where represents the absolute Jacobian determinant of the mapping , and has dimensions.
We introduce a canonicalization rule , which chooses a mapping, based on the statistics , onto a single canonical representative from the orbit on which lies. In doing so, it also reduces the dimensionality of to . Since the canonicalization rule is chosen based on , no dimensions are lost from and its dimensionality remains .
Then we replace each of our normalizing flows by the canonicalization transform followed by a network with smaller input dimension:
Critically, when the Jacobian is computed for the loss in (1), it is still computed with respect to the full (pre-canonicalization) , by chain rule through ,
One might wonder whether our Jacobian can still be nonsingular, given that we first transform to a lower dimensional . The key intuition is that some of the gradient with respect to is also transferred via , which now also depends on . We must have by definition and we have by assumption (Section 3), so there will always be at least enough dimensions in our neural network for a full-rank Jacobian to be possible.
Again the -test represents a simple example: we can capture scale invariance by and . We can even reduce to zero dimensions by further incorporating location invariance: and . Even though there are no inputs to our net that directly represent , the Jacobian with respect to is still transferred via by
We reproduce exactly this example in practice in Section 6.1 and present in Section 6.2 promising numerical results from an example where and , so that here also the Jacobian must flow via the parameters.
5.2 Conditioning on further known values
As described in Section 2.3, adding extra conditioning variables to our normalizing flows can be achieved simply by adding those conditioning variables as further inputs to the network. We use this to allow further “known values” (of dimension ) to be added to the model. Again referring to the t-test example, we might take the sample size as a known value, so that our net can model the t-test problem over a range of sample sizes.
Then our full normalizing flow decomposition (2) is expanded to
(6)
and likewise for the G-invariant version in (5).
5.3 Sampling an appropriate range of parameters for training
If is to learn how to pivot, then every that is likely to arise from a given set of parameters must compete with the same value arising from every other set of parameters with the same that are “likely” to give rise to it.
Therefore, the choice of parameter samples to be included in training the net is rather important.
Define to be the set of all for which we want to be able to generate valid -values. Further, for any , define to be the set of all that have non-negligible probability of arising from one or more . Parameter samples for testing and training our net are then drawn respectively from:
-
, an “inner” set of parameters, which represent all that might generate values in — we want our model to generate valid -values for all and use this for testing;
-
, an “outer” set of parameters, which represent all that might generate that coincide with any of those generated by — we train our model on .
Within the respective sets and , we would like to sample our parameters according to the Jeffreys prior . Since the Fisher information is somewhat expensive to estimate in our setup, we instead note that for maximum likelihood estimators of , and approximate from the covariance matrix of a series of estimates computed from samples drawn from . We then use the square root determinant of these approximate to train one denormalizing flow (Section 2.4) each to model and and allow rapid sampling from them.
We further use the same mapping from data to parameter estimates, , to define as a bounding box around these estimates. We refer to this bounding box as the “estimates box”. The procedure for achieving all of the above is currently a little , and we hope to refine it in future work. It is described in Appendix A.
5.4 Neural Network Design
A neural network typically consists of simple differentiable functions “stacked on top of each other”. The most common format for each “layer” is the fully-connected layer, which looks rather like a series of parallel generalized linear models:
for some non-linearity and with the matrix of weights and vector of biases representing the learnable parameters for that layer. Then the entire neural network is made of the composition of a series of these layers:
In NeuralCIs, our input and output layers are based on the classic fully connected layer, but with all intermediate (“hidden”) layers incorporating an extra multiplication and addition with a standardisation in-between:
(8) where represents the Hadamard product. Our now represents a “layer-norm”, which standardizes the elements of its input vector by their combined mean and standard deviation.
The key intuition behind the incorporation of the extra Hadamard product is that it should allow each input more easily to moderate (“interact with”) the effect of another. In a classic fully-connected layer (7), a variable can moderate the effect of another only by means of cancellations of effects across different neurons. In our design (8), a given input can directly moderate the effect of any other input that is directed into its output path by .
Furthermore, the extra multiplication and layer-norm provide a clean, simple non-linearity, thereby removing the need for an artificially chosen . The standardization helps to keep values from exploding or vanishing as they are propagated, as well as gradients as they are propagated backwards by chain rule. The final addition similarly helps to stop the gradients from dying out as they are propagated backwards, by providing a form of “skip connection”.
Anecdotally, this has performed somewhat better for our models. Removing the multiplication and instead adding an ELU activation in our tests in Section 6 provided slightly less accurate test sizes across the board (re-checked at various stages in the project). For Behrens-Fisher, standard deviation of test sizes at in our latest simulation (across 10000 parameter samples, each with one million -values) was 0.0032 with multiplication vs 0.0035 with the ELU. For partial biserial correlation (the no-comparison run in Section 6.3.4, again 10000 samples each of one million -values), these were 0.0033 (multiplication) vs 0.0038 (ELU). We might expect the effect to be more pronounced the larger the input dimension and the more complex the interaction structure between those inputs. But we leave a full analysis of this for a later paper.
Inputs to the nets are transformed as appropriate for the type of variable (log for SDs, atanh for correlations) and rescaled to focus their distribution very roughly onto . Our model uses classic fully-connected layers at input and output to expand/shrink the dimension to/from a hidden dimension of 50. These layers have no non-linearity (). Between these two layers are sandwiched 7 hidden layers following (8) with dimension 50. The full model design has not yet been fully optimized; we leave that also to future work.
Each net was optimized using Keras' Nadam optimizer, with an initial learning rate of 0.0025, decayed by a ratio of 0.9 after 8 epochs with no improvement in training loss, to a minimum learning rate of . The batch size was 1024; the nets were (except the toy problem in Section 6.4) trained with 1000 epochs of 200 steps, and all other nets with 500 epochs of 100 steps.
6 Experimental Methodology
To evaluate the performance of NeuralCIs, we ran Monte Carlo simulations to compare to standard approaches on three classic statistics problems with nuisance parameters: normal mean with unknown variance, the Behrens-Fisher problem and partial biserial
Adam with Nesterov gradients.
correlations. We further ran a toy simulation to illustrate the convergence of to the maximal invariant.
In each simulation, we ensure that the same random samples are used for each method (for example by using stateless random number generators) so that the data is truly paired. Power values are size-adjusted: that is, they are computed based on thresholding each -value at an “idealized” value that corrects for the test being conservative or liberal. Without such a correction, a very liberal test can easily achieve higher power, without having detected anything more of substance.
This size adjustment is achieved by adding a further simulation that (i) draws samples from the alternative hypothesis instead of the null, (ii) computes a -value for each such sample against a null hypothesis equal to this alternative, and (iii) finds the quantile of these -values and uses this as the threshold, rather than . If the size of the particular method is correct, this should simply yield as the threshold, but if the test is liberal, it will result in a lower threshold and correspondingly lower power, which represents the power the test would achieve, if the test were correctly calibrated and therefore right-sized.
6.1 t-Test
According to Section 4.3.1, we expect to align with the maximal invariant of in a transformation model. As an example, we fit the classical one-sample t-test, described in Section 3.3. To test this, we compare one-tailed -values for a range of samples via the classical t-test with those generated via NeuralCIs. We fit two different NeuralCIs models for this. The first does not account for location and scale invariance (we will refer to this as the “non-canonicalized” model); the second (the “canonicalized” model) does, as described in Section 5.1.
In the non-canonicalized model, we draw sample sizes and aim to be able to correctly generate -values for parameter estimates and . To be able to generate well-calibrated -values for these samples, we might hope that any that could generate such samples would generate uniform -values across all samples, even those outside of the estimates box. This is the basis of our definition of in Section 5.3. Our sampling scheme at present does not successfully reach to the very edge of , see Appendix D.1, so in the main text of this first version of the paper, we present results for the reduced problem, where are drawn from parameters drawn from the estimates box, with , rather than the full problem .
Specifically, we draw samples uniformly and and samples log-uniformly. We then draw one pair randomly at each parameter; that is, a total of 50000 samples. We hope to be able to expand this to the full in a subsequent version of the paper soon.
In the canonicalized model, we hope to obtain valid -values with any drawn from any and with . We test this by drawing and samples; we then draw a sample each from the sampling distributions at these parameters.
6.2 Behrens-Fisher
The Behrens-Fisher problem is a perfect example to test this on. Data for each of two groups are assumed to have been drawn from one normal distribution per group, each having its own mean and standard deviation . The goal is to infer the difference between the means of the two normal distributions. Finding a test statistic for the Behrens-Fisher problem that is near-pivotal with a known reference distribution, while retaining good power, has long been an active area of research: Paul et al. (2019) review and simulate a number of alternatives and ultimately recommend the very widely used approximation developed by Welch (1947) in most small-to-moderate sample-size configurations.
We train our model on the parameters , and with statistics , and based on their unbiased and sufficient statistics. We further add the group sample sizes as “known values” as per Section 5.2. We model location and scale invariance by subtracting from both and and dividing all parameters and statistics by . This reduces the set of statistics that will enter our net to just one: . We train our network to target valid -values for any .
We aim to select a wide and representative sample of parameters to test the model. We do not use either of the denormalizing flows that are trained according to Section 5.3 and used in training the net, as these might conceal holes in the training data. Instead we sample a fresh set of 10,000 parameter combinations as described in Table 1, with which we would like to stress-test the invariance logic, by being far outside of the range of parameters encountered within training.
However, as with the -test example in Section 6.1, we currently draw samples from parameters that have rather than any parameter that can produce statistics in that range. Again, this relates to a slight weakness at the very edges in the current parameter sampling scheme, see Appendix D.1, which we are working to fix. We hope to expand this to the full in a subsequent revision soon.
| Parameter | Distribution | Comment |
|---|---|---|
| Sample size group 1 | Floored (integer 3-100) | |
| Sample size group 2 | Floored (integer 3-100) | |
| SD group 1 | ||
| SD group 2 | ||
| Mean difference |
Table 1 Sampling distributions of Behrens-Fisher parameters in our test.
For each parameter sample , we further compute a corresponding value that aims crudely to target a power drawn uniformly in the range , when applied to statistics sampled from the corresponding null parameters at a -value threshold of :
For standard deviations, we use the square root of the unbiased estimator of the variance, and is the difference of the two further sufficient statistics: the sample means.
where is the standard normal quantile function; where is randomly assigned to addition or subtraction; and where is a target power value uniformly sampled from [0.05, 0.90].
At each sampled , we compute the following three sets of -values:
-
At , we draw samples of statistics , and pass into our model to generate null-hypothesis -values.
-
To assess power, we also pass the same samples into our model as .
-
To further size-adjust this power, we repeat step 1 with in place of , for a smaller sample of size-adjust -values.
We pass the same values across the three steps into the Welch test.
6.3 Partial biserial correlation
As a stress test for the architecture, we also chose to model the partial biserial correlation, where a latent partial correlation between two normal random variables and , conditioned on a third , is masked by one of the former two variables only being observable through its binarization , where for some threshold value .
We model the simplified case, where all normal variables are known to have zero mean and unit standard deviation. In that case, the parameters to the model are the correlations between the three normal variables as well as the binarization threshold . We find it more intuitive to model the threshold as a binarization probability . Importantly, it is also cleaner to model the correlation by its partial correlation , so that each of the three correlation parameters can take any value without losing positive definiteness. As with our Behrens-Fisher model, we also add the sample size as a “known value”.
We choose a set of cheap statistics: the observed (e.g. point biserial) correlations between the three observable variables along with the observed prevalence in , . Note that the statistics here are direct estimates of the parameters, as the correlations with are point biserial correlations with binary . They are also not known to be sufficient statistics. However, under the latent Gaussian threshold model, the prevalence and point-biserial correlations are in one-to-one correspondence with the threshold and latent biserial correlations; see for example Olsson et al. (1982) for the relationship between biserial and point-biserial correlations.
This represents a stress test for two reasons in particular. Firstly, our statistics do not form a sufficient statistic for the parameter vector of the model. Secondly, one of these statistics, is discrete rather than continuous. Since the entire theory is based on diffeomorphisms on continuous statistics, it raises the interesting question: can our model approximate in the discrete case?
We compare our approach with two widely used likelihood-ratio (LR) -based approximations: the likelihood-ratio test and the bootstrap likelihood-ratio test:
6.3.1 Likelihood ratio (LR) tests
A -value simulation involving likelihood ratios must find the maximum likelihood estimate (MLE) of the parameters (once constrained to , once unconstrained) for every one of hundreds to millions of sampled datasets per parameter set that we wish to simulate from. Any dataset whose MLE lands at the boundary of our space (i.e. correlations close to , prevalence close to 0 or 1) can be problematic, both for our optimizer and (particularly for directly-on-the-boundary samples) for our interpretation of the likelihood ratio. We aim to keep the number of boundary cases per parameter to a rate that is negligible, by selecting parameters to simulate that are sufficiently far themselves from the boundary. We then track and report non-convergence and boundary case rates, allowing each of these to remain in our -value curve, rather than excluding them.
In Appendix B, we outline a sampling scheme for that aims to keep boundary correlation cases () and degenerate prevalence cases () rare, to the order of approximately or less. For low , this tends to mean quite a narrow range for our parameters (for , we have , , , ), and this gradually fans out to a fairly broad range for higher (for , , , , ). We further pair each parameter sample with a corresponding value, used to compute power against the same sampled statistics with just one extra likelihood optimization; this is sampled to very roughly target a uniform distribution for power , but constrained to the same range.
Prevalences parameterizing the likelihood surface were mapped from to and all parameters were then atanh-transformed. In this transformed space, there is quite a wide spread at the boundaries, leading occasionally to very slow convergence for extreme samples (delays, which are then multiplied across many parallel runs). To speed up convergence, the likelihood surface corresponding to extreme correlation values, was (in the optimization phase) swapped for a steep downward slope, so that the optimizer would not wander into this region. The same was applied to the transformed prevalences, i.e. a ramp was applied at . This ramp was removed when computing likelihood ratios, but had the effect of clipping extreme values around . We explore the rates at which samples ended up caught on this fold (“boundary samples”) or with all-equal values (“degenerate samples”) in Appendix D.2.
6.3.2 Likelihood ratio -test
In the large sample limit, is asymptotically distributed. This then allows for a relatively cheap test to be performed, in which two MLEs are evaluated and converted into an LR and directly into a -value.
Nonetheless, optimizing to find the MLE twice in each case is far more computationally expensive than NeuralCIs, so we have to constrain ourselves to just
1000 parameter samples (compared with 10000 for Behrens Fisher, Section 6.2). As before, we generate one million sampled datasets at each parameter, to produce stable estimates of error rates and power. (This large number was achieved by running parallelized optimisations on an RTX 3060 Mobile GPU, using the Tensorflow-Probability BFGS optimizer.) The size-adjust is again based on a smaller sample of ten thousand.
6.3.3 Bootstrap likelihood ratio test
An alternative, and quite general approach to converting the profile LR to a -value is to approximate its null distribution by parametric bootstrap. Samples are generated from our model, with and nuisance parameters fixed at their constrained MLEs. (This is the same constrained MLE described in Section 6.3.1, optimized for the dataset in question.) For each sample, the profile LR is computed as described in Section 6.3.1, and the resulting bootstrap LR statistics are used as an approximation to the true null distribution. This is only an approximation, because we cannot guarantee (and often do not expect) that the null distribution of the LR will be the same across all relevant values of the nuisance parameters.
This is computationally several orders of magnitude more costly than the LR test, because each bootstrap sample costs as much as a single LR test. For this comparison, we ran 500 parameter samples, generating 500 -values per parameter sample, each with 2000 bootstrap samples. We use the same number of samples and simulations again for the size-adjust.
6.3.4 Performance of NeuralCIs alone
Comparing NeuralCIs with bootstrap LR imposes a number of constraints, in particular a constrained parameter range (to avoid boundary statistics) and the small number of simulations that can be run (due to computational cost). Therefore, we will also present false positive rates of NeuralCIs without comparison to another method, with a much larger sample (as with Behrens-Fisher, one million -values at each of 10,000 parameter samples), drawn much closer to the boundary.
To avoid overemphasizing the boundaries (and giving negligible probability mass to the important zero-correlation centre), we approximate drawing parameters at uniformly sampled angle and as follows. First a point is chosen uniformly from the 4D hypercube and turned to a unit vector by dividing by its magnitude. This “angle” is then multiplied by a uniformly sampled magnitude in . The fourth dimension is remapped and the four dimensions are assigned to and , respectively. Finally, any correlation greater in absolute value than 0.9 and any not in the range is excluded.
6.4 Toy problem: measuring deviation from maximal invariant
In Appendix C.2.1, we show that a model that is shift-uniform in the nuisance-orbit coordinate would allow construction of a pivot that can be contaminated by a periodic dependency on (that is, depend on other than through the maximal invariant). We make an implicit-bias argument that such a solution is highly unlikely to be discovered when fitting .
To test this, we further fit a toy problem that has exactly this shift-uniform structure and monitor how closely depends on the maximal invariant at each training epoch. We fit our architecture to the following two-dimensional model, with scalar parameters :
In this model, the maximal invariant and the nuisance orbit coordinate U are
Before training, we construct a set of reference values of , , and . For , we use 32 evenly spaced quantiles of the normal distribution, divided by their standard deviation to give them exact standard deviation of 1. For , we use a uniformly distributed random sample of 64 values drawn between -0.5 and 0.5. For parameters we use 16 linearly spaced values each, for in and for in .
Let denote means and variances across the respective fixed grids defined above. After each epoch, we compute and from these the following metrics.
- A measure of the proportion of -variance contributed by , estimated by the proportion of -variance not accounted for by :
- A measure of how similar the curve mapping to is across different :
- A measure of the variance of :
- An estimate of the Kolmogorov-Smirnov distance between the one-tailed p-values obtained from and the uniform distribution:
We repeated this across 250 training runs, each with a different random initialisation, 500 epochs each of 100 steps. This is one quarter the training used in each of the other examples presented in this paper, where a full training run is 1000 epochs of 200 steps.

Fig. 1 Comparison of NeuralCIs to traditional t-test.
7 Results
In the following sections we present the results from these experiments: NeuralCIs for the one-sample mean vs the t-test in Section 7.1, for Behrens-Fisher vs Welch in Section 7.2, for partial biserial correlation vs profile likelihood ratio tests in Section 7.3 and finally the toy problem measuring deviation from the maximal invariant in Section 7.4.
7.1 t-Test
In Figure 1, we scatter the difference between the NeuralCIs one-tailed p-value and that of the t-test, against that baseline t-test p. Each plot is coloured according to sample size. Both models produce one-tailed p-values close to those generated by the t-test. For the non-canonicalized model, the absolute differences between the two were less than 0.0020 in 99.5% of samples and less than 0.0033 in 100% of samples; for the canonicalized model they were less than 0.0012 in 99.5% and less than 0.0013 in 100% of samples.
7.2 Behrens-Fisher
Figure 2 compares false-positive rates and power between the NeuralCIs (top in each plot) and Welch (reflected below). Although Welch shows a very slightly narrower peak, its size error in the worst cases is considerably worse than that of NeuralCIs. The power difference between the two is negligible: less than one tenth of one percentage point in NeuralCIs' favour.
7.3 Partial biserial correlation
Results for the likelihood ratio test, presented in Figure 3, show that, at these quite small sample sizes (), the test is consistently rather liberal, where NeuralCIs is quite neatly clustered around the target rate. Furthermore, NeuralCIs achieves on average 1.2 percentage points greater power.
Results for the bootstrap likelihood ratio are presented in Figure 4. Error rates are this time well centred around for both tests (mean proportions below alpha are 0.010 and 0.049 for NeuralCIs and 0.010 and 0.050 for the bootstrap LR, at

Fig. 2 Comparison of NeuralCIs to traditional Welch test.
and , respectively). Again, NeuralCIs has a size-adjusted power advantage of 1.2 percentage points.
The error rates for the bootstrap LR appear to be quite widely spread, but with only 500 -values per parameter sample, we already expect these error rates to be widely spread simply by chance variation. Table 2 shows that the spread (in terms of standard deviation) is close to the value expected from chance variation alone for both NeuralCIs and bootstrap LR; with only 500 -values per parameter in the bootstrap comparison, modest variation in true test size would contribute very little to this spread and therefore be hard to detect. However, combining our knowledge from Figures 3 and 4, we know that NeuralCIs has reasonable control of error rates and a power advantage over bootstrap LR. And importantly, it achieves this at speeds several orders of magnitude faster. Generating a half a million -values for this run, spread across null and power -values, took a total of 39 hours even highly parallelized on a GPU; generating ten billion -values (20,000 times as many) for our stand-alone neural simulation (Section 6.3.4) took only fifteen minutes.
The comparison to the two profile LR approaches is much clearer when broken down by sample size. Figure 5 shows that the advantages of NeuralCIs in terms of power and error rates are strongest in small to moderate sample sizes (sample sizes 20 to 70 in particular) and progressively narrowed or even reversed as the sample size approaches 100. Between sample sizes 30-50, the power advantage appears to be around 3 percentage points on average. We must be careful in interpreting these results, because the parameter sampling region in our test also grows with sample size, but the overall pattern is consistent with expectations: profile LR is asymptotically optimal in
Note that the two would combine in terms of variance, rather than standard deviation.
Furthermore, the boundary, to which extreme values of are clipped is different at each n.

Fig. 3 Comparison of NeuralCIs to traditional likelihood-ratio test in partial biserial correlation problem. Power is size-adjusted, targeted at .

Fig. 4 Comparison of NeuralCIs to the bootstrapped likelihood-ratio test in partial biserial correlation problem. Power is size-adjusted, targeted at .
| LR distribution | SD of error rate | Mean power difference | |||
|---|---|---|---|---|---|
| Expected | NeuralCIs | LR | |||
| 0.01 | 0.0001 | 0.0010 | 0.0022 | 0.011 | |
| 0.05 | 0.0002 | 0.0028 | 0.0054 | 0.012 | |
| Bootstrap | 0.01 | 0.0044 | 0.0043 | 0.0044 | 0.016 |
| 0.05 | 0.0097 | 0.0100 | 0.0099 | 0.012 | |
| None (only | 0.01 | 0.0001 | 0.0011 | ||
| NeuralCIs) | 0.05 | 0.0002 | 0.0033 | ||
Table 2 NeuralCIs and profile LR approaches compared. Expected standard deviation (SD) of error rates represents the standard deviation that would be expected, based on and number of -values per null parameter, if the error rate were perfectly calibrated to . This is just the standard deviation of a binomial distribution divided by ,
Expected SD = . Mean power difference is NeuralCIs minus Profile LR.

Fig. 5 Results from Figures 3 and 4, broken down by sample size. This must be interpreted with caution, as the parameter sampling distribution is different at each sample size.
terms of local power and the approximation is asymptotically correctly sized, but may be liberal and/or underpowered in finite samples. The bootstrap can correct the size compared to the approximation, but with a very similar power disadvantage at smaller sample sizes (also to be expected, since the test statistic itself is the same).
In Figure 6, we present false positive rates of NeuralCIs without comparison to another method. NeuralCIs does not become degenerate at the boundaries in the same



Fig. 6 NeuralCIs false positive rates at and and Kolmogorov-Smirnov distances vs uniform for partial biserial correlation example. Total of null hypothesis parameter samples plotted, each computed from datasets simulated at that null.
way as likelihood approaches, so these results can capture a broad range of possible null parameters. The error rates are consistently quite close to the desired . The ten billion p-values generated for Figure 6 took fifteen minutes to run.
In Section D.2, we present rates of non-convergence and boundary and degenerate samples in the two profile-LR approaches. In the approximation, rates of non-convergence are mostly well below one in a thousand (or slightly above in a few cases). Boundary samples are also almost entirely well below one in a thousand, except less than 1% of parameter samples which were slightly above that and degenerate samples (prevalence of 0% or 100%) were almost all below one in ten thousand. For the bootstrap LR, we have far less ability to pre-plan avoiding boundary samples and most parameter samples have at least 1% of their p-values based on non-convergence rates between 0.001 and 0.03, with the worst cases being occasionally as high as ten percent non-converged. This applies only to the bootstrap distribution, since the same samples were used as the starting samples as in .
So, while the convergence rates on the approximation look very comfortable, we urge a little caution in interpreting the bootstrap LR results. Nonetheless, the pattern looks clean: both bootstrap LR and NeuralCIs are centred at the nominal , and the power advantage of NeuralCIs is consistent with that seen in the approach.
7.4 Deviation from the maximal invariant
Results of the u-dependence toy problem are shown in Figure 7. The proportion of variance not accounted for by the maximal invariant (the “U proportion”) rapidly becomes negligible and continues to become smaller as training progresses, and the mapping becomes very stable. All runs converge well to an output variance of 1 and a low KS-distance of p-values versus uniform. Note that there is a floor to the KS-distances, imposed by the small grid-sample of ; they cannot in this case be reduced below 0.02.
Of the 250 random initializations, 7 converged noticeably less cleanly than the others, all having final smoothed U-proportion above (coloured in Figure 7). While these higher final U-proportions are still effectively negligible, we trained these seven models for a further set of 500 epochs of 100 steps and present those results in Appendix D.3; all converge as expected after a further round of training.
Most were even well below this: 81% of main runs and 75% of size-adjust runs had fewer than one in ten thousand boundary samples.

Fig. 7 Is a function of the maximal invariant alone? Each curve is smoothed using a uniform moving average with window size 10 epochs. All -axes are log-axes. Those finishing with a smoothed -proportion above are coloured.
8 Discussion
8.1 Interpretation of results
The Behrens-Fisher problem, with continuous sufficient statistic of dimension , represents a perfect example of the sort of problem NeuralCIs aims at. Its performance is comparable to the Welch test, achieving considerably better worst-case false positive rates, with very similar power. This is, of course, within pre-specified bounds on .
On the other hand, our experiments with partial biserial correlation try to answer the question of whether this approach might be generalized to a cruder scenario, where “ball-park estimates” supplant sufficient statistics and even one of those estimates is not continuous. In this particular case, NeuralCIs performs comparably with the bootstrap profile LR, but at a tiny fraction of the computational cost and with a small power advantage (1.2 percentage points on average), particularly at small sample sizes (a power advantage of around 3 percentage points for sample sizes from 30-50). Notably, this was at sample sizes where the traditional Chi-squared approximation to the profile LR was quite inaccurate. So, while the net must surely approximate (since one statistic is non-continuous), the approximation appears to be very effective.
Generating -value distributions close to the boundary was a significant problem in the profile LR framework, so much so that we had to abandon attempts to do so. But in NeuralCIs, these can be generated quite readily and performed well.
Finally, the -test example shows how close NeuralCIs can come to discovering the classical pivot for a transformation model, while the toy problem (“deviation from the maximal invariant”) shows that this occurs consistently, even when other pivots do exist.
8.2 Limitations and future work
We hope this to be the first of a line of steps in the NeuralCIs project, each step representing a current limitation of the project in its present form:
-
Fix the edge-of- sampling issue highlighted in Appendix D.1.
-
The neural net dimensions have so far been chosen somewhat arbitrarily / in an fashion. Optimizing the hyper-parameters to the net, such as number of layers, size of layers, number of training epochs, and learning rate schedule is an important next step.
-
Invert our -value net to train a further net that can generate confidence intervals for . See Section 8.2.1.
-
Assess seed-to-seed variability in training.
-
Train and evaluate several models relating to interesting core statistical problems (as with partial biserial correlation) and wrap these up in an R package for true amortization of the training process.
-
Switch from explicitly differentiating and punishing Jacobians to training via the free-form flows (FFF) approach of Draxler et al. (2024), to provide more scalable training and global diffeomorphism targeting (see Section 2.2).
-
Currently only a single scalar interest parameter is supported. We would like to extend this to capturing simultaneous confidence intervals and/or confidence regions on a vector-valued interest parameter. One might, for example, make multidimensional, or model the combined distribution of several different NeuralCIs models, each trained on a different .
-
The current architecture makes the severely limiting assumption that . When , there may be multiple pivotal directions, some that are not informative about . The subtractive argument made in Section 4.3 was that the single remaining dimension after subtraction of nuisance parameters is expected to be highly informative; this no longer holds. Expanding the framework to accept a higher-dimensional statistic would make it considerably more general.
-
A longer term extension would be to replace and with recurrent neural networks (RNNs), that process individual i.i.d. observations sequentially while updating an internal state representing the accumulated evidence for or against the null. This would depend on resolving point 8 above and would nonetheless
Or, possibly, deep set architectures.
require the fixed-dimensional learned state of the RNN to be able to hold sufficient information from an arbitrarily large sample.
8.2.1 Confidence intervals
Generating confidence intervals from our current -values approach will (we hope) be achieved by training a further net, using as a differentiable loss function. The essence is to train a new net that maps statistics , and a target , to a value that represents the boundary of a confidence interval. Specifically, if we feed the value output by back into , the output from this,
should aim to equal the input value for all and plausible . In doing so, it inverts the -value implied by into a confidence interval made up of the values at which would have the desired -value. By plausible , we mean specifically , see Section 5.3.
We can achieve this by repeatedly
-
sampling parameter using the denormalizing flow trained in Section 5.3;
-
sampling each from our simulator;
-
randomly sampling values;
-
computing ;
-
adjusting the weights in the net to minimize some discrepancy metric between these two.
One may then obtain, say, a 95% CI for given as
where the values are the values corresponding to a two-tailed -value of 0.05.
9 Conclusion
We have seen that a simple decomposed normalizing flow-style neural network structure can extract near-pivotal statistics along with their distributions and that they can perform inference on three classical problems to an accuracy level that is competitive with classical approaches, and even with some advantages. The -test is retrieved almost exactly, the Welch-test is bettered in terms of worst case error over a constrained variance-ratio range and the profile likelihood ratio for the partial biserial correlation is beaten in our simulation in terms of size-adjusted power.
The net can incorporate invariance information, making it more robust and giving it wider reach. Furthermore, once the expense of fitting the net has been invested, the fitted net can then be used extremely cheaply thereafter (much cheaper than bootstraps or likelihood surface optimizers). There are still considerable limitations, in particular the limitation that (if we are to have reasonable power). Nevertheless, the work so far suggests that neural density methods based on normalizing flows could form a basis for a very general approach to frequentist inference.
Acknowledgements
This paper is dedicated to the memory of my mother, Marion, who died during the final stages of its preparation.
Declarations
Use of generative AI. The core contribution of this paper (the decomposition of the normalizing flow presented in Section 3) and the accompanying codebase were initially developed independently by the author. Anthropic's Claude and OpenAI's ChatGPT were used extensively throughout the theoretical development that followed, as a sounding board and as a critic: for brainstorming, for adversarial checking of the mathematical arguments, for directing the author towards relevant existing literature and theory (including, for instance, the classical theory of transformation models, which underpins the arguments in Appendix C), and for proofreading. A few short utility functions in the simulation code were also drafted with AI assistance. All arguments, experiments and conclusions have been verified by the author, who takes full responsibility for the content of this paper.
Code availability. The code for this project is available at github.com/philassheton/neuralcis.
Funding. This work was carried out by the author independently and received no external funding.
Competing interests. The author declares no competing interests.
References
Al Kadhim A, Prosper HB, Prosper OF (2024) Amortized simulation-based frequentist inference for tractable and intractable likelihoods. Machine Learning: Science and Technology 5(1):015020
Barndorff-Nielsen O, Jupp PE (1988) Differential geometry, profile likelihood, l-sufficiency and composite transformation models. The Annals of Statistics 16(3):1009–1043
Coccaro A, Pierini M, Silvestrini L, et al (2020) The DNNLikelihood: enhancing likelihood distribution with deep learning. The European Physical Journal C 80(7):664. https://doi.org/10.1140/epjc/s10052-020-8230-1
Cranmer K, Pavez J, Louppe G (2015) Approximating likelihood ratios with calibrated discriminative classifiers. URL https://arxiv.org/abs/1506.02169, arXiv:1506.02169
Dalmasso N, Masserano L, Zhao D, et al (2024) Likelihood-free frequentist inference: Bridging classical statistics and machine learning for reliable simulator-based inference. Electronic Journal of Statistics 18(2):5045–5090
Davison AC, Hinkley DV (1997) Bootstrap methods and their application. 1, Cambridge university press
Draxler F, Sorrenson P, Zimmermann L, et al (2024) Free-form flows: Make any architecture a normalizing flow. In: International Conference on Artificial Intelligence and Statistics, PMLR, pp 2197–2205
Goodfellow IJ, Pouget-Abadie J, Mirza M, et al (2014) Generative adversarial nets. Advances in neural information processing systems 27
Hall P, Martin MA (1988) On bootstrap resampling and iteration. Biometrika 75(4):661–671
Heinrich L (2022) Learning optimal test statistics in the presence of nuisance parameters. arXiv preprint URL https://arxiv.org/abs/2203.13079
Louppe G, Kagan M, Cranmer K (2017) Learning to pivot with adversarial networks. Advances in neural information processing systems 30
Olsson U, Drasgow F, Dorans NJ (1982) The polyserial correlation coefficient. Psychometrika 47(3):337–347
Papamakarios G, Nalisnick E, Rezende DJ, et al (2021) Normalizing flows for probabilistic modeling and inference. Journal of Machine Learning Research 22(57):1–64
Paul S, Wang YG, Ullah I (2019) A review of the Behrens–Fisher problem and some of its analogs: Does the same size fit all? REVSTAT – Statistical Journal 17(4):563–597. https://doi.org/10.57805/revstat.v17i4.281
Rezende D, Mohamed S (2015) Variational inference with normalizing flows. In: International conference on machine learning, PMLR, pp 1530–1538
Welch BL (1947) The generalization of ‘student’s’ problem when several different population variances are involved. Biometrika 34(1-2):28–35
Wilks SS (1938) The large-sample distribution of the likelihood ratio for testing composite hypotheses. The Annals of Mathematical Statistics 9(1):60–62. https://doi.org/10.1214/aoms/1177732360
Zammit-Mangion A, Sainsbury-Dale M, Huser R (2025) Neural methods for amortized inference. Annual Review of Statistics and Its Application 12(1):311–335
A Parameter sampling details
The following section is a rather terse “engineering decisions” section, and not necessary to a rough understanding of the model. Furthermore, we hope to improve the methodology below in future work. For the reader wanting only to understand the key innovations in this paper, this section could reasonably be skipped.
It should also be noted that this sampling scheme is designed for the ultimate goal to use NeuralCIs to generate confidence intervals, rather than directly -values. With a confidence interval, one starts at the sample, and explores compatible values. On the other hand, with a -value, one may choose a wildly inappropriate null for a given sample. Our architecture does not currently employ effort to guard against such misadventure, since its goal is anyway a different destination.
To define in a compact way, we define a bounding box over the parameter estimates and define . In fact, we simplify each step by working in terms of (and which parameters produce that overlap) rather than .
To obtain a denormalizing flow (Section 2.4) that can cheaply sample from (as well as one that can sample cheaply from ), a series of Metropolis-Hastings-style random walks, neural networks and denormalizing flows are fit to the sampling function:
-
Since should be an estimator of , a number of MCMC chains are initialized starting at . At each Metropolis-Hastings-style step, a large number of samples are drawn and an approximate bounding box, is computed as a Bonferroni-adjusted multiple of each estimate's respective standard deviation (Bonferroni-adjusted to capture 99.5% of probability mass). For where , the covariance matrix of the is used to compute an approximate Fisher information, which will be used as the target distribution for the denormalizing flow in the following, while the proposal distribution for the following MCMC-jump is normal with the same covariance matrix.
-
A neural net is trained to model a surface that is a large negative number for inputs where in step 1, and to return the approximate square root Fisher information determinant from step 1 otherwise.
-
A denormalizing flow is fit to the surface from step 2. This can be used to draw unlimited samples from .
-
Samples are drawn from the denormalizing flow fit in step 3, and values are sampled at each. A neural net is trained to produce higher values where these values land and lower values where they do not. This is done by assigning target 1 to the drawn from and 0 to a set of samples drawn from a uniform distribution, and fitting a neural net with sum squared error. This net then represents by all at which the net returns a value higher than.
In later versions, we will experiment with cross-entropy error for this part of the net. This value we need to make dependent on the square root Fisher information modelled in Step 2; it is one of the two issues raised in Appendix D.1 that makes the parameter sampling ineffective for particularly wide-sampled .
- Steps 1 to 3 are repeated, except that generated are compared not to but instead to , according to the net in step 4. The resulting denormalizing flow is a very cheap sampler from .
In practice, maximum likelihood estimates can be rather expensive to compute. We allow the use of other estimators . Although these might not yield precisely the right volumes at each parameter, they should nonetheless scale in a “close-enough” way to provide “good enough” parameter sampling. The one condition that is critical, if invariances are to be incorporated (Section 5.1) is that the distribution of is also transported by the group action.
B Experimental sampling for Partial biserial correlation
The following are the details of the parameter sampling scheme used in the evaluation of NeuralCIs in comparison with the two likelihood-ratio techniques. Importantly, this is not the parameter sampling scheme used for training and it is rather narrow for smaller . The reason for the narrow selection of parameters is to avoid those parameters at which the likelihood optimisation (in the baseline likelihood ratio methods) will hit a large number of boundary values.
The maximum and minimum values for each parameter are defined as follows. Firstly, defining a target rate of hitting any given “boundary” as , we compute the maximum prevalence in by inverting the probability that all values in will equal 1:
We further compute maximum and minimum values for the correlation according to the Fisher r-to-z transform:
where the division is to account for the fact that this is an approximation (even more so as it is used below).
Meanwhile, the maximum value for the biserial correlation is computed by treating from (9) as point-biserial and computing a conversion factor based on
Olsson et al. (1982):
Finally, for the partial biserial correlation , we further subtract one from n:
with minimum values again set as the negative of the maximum.
Since this sampling scheme tends anyway to bias samples towards the centre (particularly for low n), and also to cover a narrower region at lower n, we are satisfied to sample each parameter uniformly between its maximum and minimum values, including the sample size n.
B.1 Targeting power
As with Behrens-Fisher problem, we also sample separate values, which approximately target power uniformly sampled from , when used to assess the samples drawn under the null. Equivalently, we draw and:
where is computed as in (15) and the in (17) is randomized (except where only one of the two is within valid range). Intuition note: dividing by here transforms our s from Fisher -to- scale to “standard-deviation-equals-one” scale. This makes the intermediate calculations much more intuitive. Note also that in we use rather than , because our correlation is partial.
C Dimension-matched transformation models and the learned scalar coordinate
Let
The normalizing flow learns the mapping
with
so that the scalar coordinate has no direct nuisance input. The remaining coordinate
may depend on the full parameter and absorbs the remaining directions.
In this section, we examine the link in regular, full-rank, dimension-matched transformation models, between and the profile likelihood ratio (LR). In Section C.1, we review the classical result that, in such transformation models, the profile likelihood ratio is a function of the maximal invariant. Then in Section C.2, we argue that can reasonably be expected to land very close to this same maximal invariant, thereby closely linking to the profile likelihood ratio in such models.
C.1 Profile LR is a function of maximal invariant
The link between the profile LR and the maximal invariant in a transformation model is well established; see, for example, Barndorff-Nielsen and Jupp (1988). Here we present a simplified derivation, focussed on the particular case we have in mind for our architecture. The core intuition is that transforming our data and parameters by multiplies both the numerator and denominator of the profile LR by the same Jacobian factor, which then cancels; so the profile LR itself is invariant under the group action and it must be a function of the maximal invariant.
Assume the model is a transformation model. An -dimensional Lie group acts smoothly on the data space and parameter space:
Assume the interest parameter is equivariant:
Thus acts jointly on pairs by
Assume the density is invariant up to the Jacobian factor :
where is the Jacobian factor and does not depend on . Finally assume the joint action (22) on is regular and full rank. Since
and
the quotient is locally one-dimensional. Let
denote a scalar maximal invariant of the joint action (22).
Define the profile likelihood
and the profile likelihood ratio
Then
Similarly,
(That is, for fixed g, we find the supremum across all .)
Therefore the Jacobian factor cancels in the likelihood ratio:
So is invariant under the joint group action on . Since is maximal invariant,
for some scalar function h.
C.1.1 Gaussian location and other examples
For the simple Gaussian location model, , with fixed covariance matrix , the unrestricted MLE of is :
The group action is a translation
with a simple maximal invariant
and quadratic log likelihood surface
where is a constant (independent of ) and represents the central (peak) log likelihood value at .
Writing also , then the profile log likelihood , and thereby the log likelihood ratio , is obtained by a simple optimization across this quadratic,
where is again a constant and is the efficient information, which is constant across this quadratic log likelihood function.
This simple transformation model illustrates the profile log likelihood ratio as a function of the maximal invariant of .
C.2 Why we think will tend towards
A Gaussianization of the maximal invariant is a very natural target for . Define to be the -dimensional nuisance subgroup of that leaves stationary. Then defines a foliation of such that probability mass is only moved by within each given leaf, and never between. The foliation provides the perfect structure to model with , leaving the distribution across the leaves , which is a pivot independent of .
In this section we will consider whether there are other viable targets for . Transform at fixed as
and correspondingly overload
We want to know if a that depends not only on , but also on can still be standard normal for all .
The short answer is: yes, there are sometimes loss-optimal forms of that depend not just on but also on , but all require considerable coordination of cancellations across -space that is unlikely to arise in any substantial form from the combination of a random initialisation and stochastic gradient descent optimisation.
In Section C.2.1, we start by assuming that is monotone increasing in . In this case, any dependence on must be removed in expectation as slides around space, with any -dependence lost at the back end of the distribution, counterbalanced by a coordinated opposite dependence at the front end of the -induced movement of the probability mass.
We give a simple two-dimensional example (that is, with scalar ): , . In this case, a dependence on that is periodic (with period 1) will average out to a constant across the uniform at all . This clearly shows the cancellation concept: as the uniform distribution is moved along, the portion of that is no longer supported is replaced by exactly the same shape in a new region of that previously had not been supported. The loss is blind to such a specific, coordinated -dependence and will neither encourage nor discourage it: without the appearance of such a coherent, coordinated pattern in the random initialization, it can only be arrived at during training by random drift in that direction. But the component of any random drift in such an extremely specific direction could be expected to be negligible, as could the probability of it appearing in any significant proportion in the random initialization in the first place.
In Section C.2.2 we then explore the possibility that is non-monotone in . This would make it possible for pairs of local -dependencies to cancel each other, without needing the same level of global coordination. However, for to be non-monotone in , satisfying our architectural constraint in (3) while the full map still remains a diffeomorphism, itself requires similarly complex, large-scale coordinated patterns. These are, similarly, unlikely to arise from our random initialization and training.
So, in summary, while it is technically possible for to stray far from the maximal invariant , it would require accidental construction of such high levels of coordination in the random initialization, that we consider it highly unlikely, except perhaps for a very small component. Under the simple independent-noise benchmark in Section C.2.3, a small contamination like this should have a very mild effect on power (only second-order in the contamination amplitude).
C.2.1 Dependence on U that disappears after marginalization
Assume that is strictly increasing in for each fixed . Define the inverse of at each as according to
We know that one excellent target for would be a Gaussianization of , call it . In this case the inverse is independent of , call it :
for all and .
In order that be pivotal, we need that have the same distribution as for all . If we think of for any fixed as a boundary that is straight in , and as a boundary that is wiggly in , they must cross each other so that can exchange increased probability mass in one region of for decreased probability mass in another. We can represent these regions of gained or lost probability mass as regions of (with zero everywhere else),
and pivotality requires that the same amount of probability is always exchanged between positive and negative regions,
for all and .
The final bolded part, that this must hold for all and is the critical part. Since our group acts in a full-rank way on the data, is constantly moved around space by , and certain regions gain probability mass, while others lose it. These two must be constantly offset and the result is that any dependence on (if a feasible one should exist at all) must be highly globally structured across space.
This argument does not depend on the scale of the -component, since is defined only up to a monotone transformation. It may be made arbitrarily weak while still requiring the same cancellation in -components as moves probability mass around space. In the limiting case where becomes independent of altogether, the -induced motion of in all directions would demand the same globally coordinated cancellations, to maintain pivotality at all , if such a construction can be made pivotal at all.
The argument is most easily visualized with an example. Suppose that is scalar, under each scalar and
If we choose a wiggly boundary such that, when fed through the CDF of M, it generates a sine wave in u,
at any integer frequency and any set of amplitudes , such that the right-hand side remains in and increasing in , then
This example is a very clean illustration of the broader point: as the uniform distribution is translated along by , the wiggle that it leaves behind at the back must be compensated by another picked up at the front. In this case, that means that the dependence on must be periodic (with period 1) across the whole of .
As the example shows, such solutions may exist, but they also require global coordination of the dependence on . If some such globally coordinated dependence is already present in the random initialisation, the KL loss may have no incentive to remove it. However, this is highly unlikely to form more than a very small part of the initial -dependence. Most randomly initialized -dependencies will fail to produce the required cancellations for all and , and will therefore be ironed out during training.
The loss itself is ambivalent to such structures, so training may allow a random walk in that direction, but we could expect in most cases that the component of any random drift that is directed so specifically in that direction should be negligible. Furthermore, against the ambivalence of the loss, the architecture itself may well prefer a simpler solution (flat in ).
C.2.2 Folding in M
If is not monotone in m, then, for fixed , the set
may contain several disjoint intervals. Probability gained on one branch by a detour of the -contour through can then be offset by probability lost on another, while retains the information needed to keep the full transformation invertible.
Such a fold cannot stand alone. Since the full map
is a diffeomorphism, the contours of are smooth, non-intersecting surfaces: they cannot terminate or cross, but rather form continuous “snakes” in space, enclosing volumes that encode how the model is distributed. A turning point can therefore only occur where the contour runs out through , turns back and returns at a different value of . A single fold has a ripple effect, requiring a coordinated family of “snaking” contours over at least a substantial neighbourhood, to maintain a diffeomorphism that still captures the model densities.
Furthermore, our architectural constraint
from (3) is evaluated at fixed : increasing moves every point downward in . Write . Then calibration must be preserved, while the data distribution itself moves under the infinitesimal interest action . Along this movement, we require that the flux (denoted below) of probability density into and out of a given level set, as is tweaked, must be tracked/counterbalanced by a shift in the value of (denoted ):
(23)
for all , and .
Because the interest transformation is not entirely contained within the nuisance orbits, its motion has a non-zero component in the -direction; we choose the orientation of so that
In the case where is strictly increasing in , there can be a natural pointwise cancellation between terms and in (23). On the other hand, wherever is decreasing in , the -component of term reinforces term , which must then be cancelled by motion in or by coordination with other that are mapped to the same .
A folded solution is therefore not impossible and it can in principle hide u-dependencies from our loss, since gains and losses associated with different m sharing the same can be cancelled. But it must coordinate the geometry of an entire family of contours with compensating motion in u or on other branches, consistently across z, and . This is then (as with Section C.2.1) a highly organized construction, rather than a local perturbation, that random initialization and gradient training would naturally struggle to produce.
C.2.3 Consequence of contamination for power
Our conclusion is that there may be a very small u-dependent component in , which may be rather uninformative about ; indeed it may be pure noise. But there is unlikely to be a larger one. To illustrate the likely scale of this effect, we consider below the simple benchmark in which the contaminating component is independent standard normal noise carrying no -signal. We show that noncentrality in this case is attenuated only quadratically with the amplitude of the mixed-in noise.
First, consider the canonical , which depends only on . Suppose that under the alternative hypothesis, is translated by :
so that is the noncentrality of .
Suppose we mix in some -derived standard normal noise , such that and carries no -signal at all, then
So the non-centrality of itself is divided by the denominator . Or, expanding around , its non-centrality is multiplied by
So the loss of noncentrality, and hence the resulting loss of power (which is a smooth function thereof), is only second-order in .
D Further results
Here we present further results to support and further develop those presented in the main sections.
D.1 t-Test: the edges of
In Figure 8, we compare the results for the t-test model with no canonicalization, across a number of different parameter testing regions. Top left reproduces Figure 1 from the main text, where parameters were drawn only from the estimates bounding box . Of course, our goal is to generate valid -values for all .
To test performance outside of the bounding box, we draw a Bonferroni-adjusted parameter sampling quadrilateral at each , that extends beyond the estimates box. At a given , consider the two-dimensional space , on which the estimates box is drawn. At each point in this space, we compute a separate -value in each dimension and , taking the coordinates at that point as the respective nulls, and the closest point on the bounding box as the estimates . These

Fig. 8 Comparison of Figure 1 (parameters drawn from the estimates bounding box) with results obtained when extending the parameter sampling distribution into the edges of . Other plots draw parameters from a union of Bonferroni confidence regions computed around the boundary points of the bounding box; percentages in individual plot titles represent the confidence levels of these confidence regions.
-values are then combined by Bonferroni. Those with a -value greater than one-minus-confidence-level are allowed for inclusion in the plot, and the first 50000 in each case are retained for plotting.
It is striking that the larger sample sizes perform relatively well at all confidence levels, where the small cases perform progressively worse towards the edge of the box. Our current hypothesis is that the current sampling scheme has two weak-points with regard to parameters with wider spread estimates (as is the case with low in the -test example):
-
Step 4 in Appendix A, which models the distribution of samples that can be drawn from , is based effectively on the absolute height of the probability density, which is much lower for a parameter with wider spread estimates (e.g. large at small in the -test). This leads to such parameters being sampled less broadly than those with a tighter sampling distribution. We might remedy this by making use of the net trained in step 2, which encodes the inverse of the volume occupied by the estimates and is a proxy for the height of the density.
-
The current sampling scheme, based on the Jeffreys prior, only takes account of the volume of the sampling distribution at that parameter, but does not take account of the relative volume of space that it can fill. If either of or is large compared to the spread of the sampling distribution of the estimates, our parameter sampling will overweight parameters with more tightly spread estimates, potentially catastrophically. We might remedy this by weighting each parameter relative to probability of collision of the sampling distribution with or , rather than (as at present) the probability of the collision of the sampling distribution with a single point.
Point 2 is more easily understood with a concrete example. In this -test example, we do need a higher probability of drawing small values, since their sampling distributions reach less far through space, and so a smaller volume of them overlap the bounding box; with equal sampling probability, they would then be underweight.
If the region we were aiming to overlap with were a single point, the Jeffreys prior would correct for this exactly: we would pull the same proportion of small parameters as large . But as we extend the bounding box outwards, these up-weighted small- values start to dominate, as the same amount of space inside the bounding box can accommodate far more small- parameter samples than large- ones. This disproportionately impacts small sample sizes, because, particularly for , the sample estimate is quite noisy and so a comparatively huge range of values must be modelled.
We are developing an improved sampling scheme, that takes account of the size of the estimates box when weighting , and of the size of when weighting , as well as attempting to address point 1 through the use of the modelled Cholesky determinants.
D.2 Non-converged, boundary and degenerate cases (partial biserial correlation)
In Figures 9 and 10, we plot, across the one thousand parameter samples, convergence, boundary and degenerate sample rates, each computed on either one million main or ten thousand size-adjust simulations. Non-convergence (Figure 9) is broken down by each of the three types of likelihood fitted. The three boundary and degenerate sample plots in Figure 10 count cases of the following, respectively:
-
At least one correlation MLE lay sufficiently close to the artificially imposed boundary at that it may have been distorted. We define this as any sample with final .
-
The prevalence MLE lay sufficiently close to the artificially imposed boundaries at 0.005 and 0.995, that its likelihood may have been distorted. After accounting for the transform of prevalences onto the range , we define this similarly as any sample with final .
-
All binary values were of the same value, zero or one. That is to say, . In this case, the biserial correlation is undefined.
The cutoff of 0.988 in step 1 was defined conservatively, based on Figure 11. Quite visible in this plot is a small build-up of samples just inside the 0.99 boundary. That is to say, not all boundary points converged precisely to 0.99. Choosing a threshold of 0.988, then, should be conservative, as this is quite far from the apparent build-up

Fig. 9 Rates of convergence failures out of one million main samples and ten thousand size-adjust samples at each likelihood fit: respectively, nonconvergence rates in unconstrained MLE, MLE constrained to and MLE constrained to .

Fig. 10 Rates of boundary and degenerate samples out of one million main samples and ten thousand size-adjust samples per parameter sample: respectively, proportion of boundary samples for correlations and prevalences, followed by degenerate samples (those whose has all the same values).

Fig. 11 Close-to-boundary absolute values of maximum likelihood estimates pooled across all correlations fitted by maximum likelihood on all runs. Note that this is very much zoomed in: the y-axis here is severely cropped (the maximum count in this plot is 200, vs 25340 if the y-limits were left free).
and also includes a number of samples that truly converged above 0.988, without ever testing the boundary.
In Figure 12, we summarize the convergence rates across the bootstrap samples generated to convert them into p-values in the bootstrap LR. When bootstrapping, we have 500 parameter samples (index them by i), each made up of 500 p-values v, each in turn made up of 2000 bootstrap profile LR samples b. To summarize these, Figure 12 plots

Fig. 12 Summaries within each parameter sample across the -values generated at each parameter sample of the non-convergence rates of the bootstrap samples within that -value. For example, each datapoint on the “Mean” histogram is for a single parameter sample, the mean across all -values generated for that parameter sample of the non-convergence rate across all bootstrap samples for the respective -value.
for and Summary .
D.3 Deviation from the maximal invariant
In Figure 13 we present the effect of further training the seven slower converging runs from Section 7.4 (that is, the coloured curves in Figure 7) for a fresh set of 500 epochs of 100 steps. Once the training runs find their way into the right direction, they converge as neatly as the other 243 runs did in the first set of training epochs. The further epochs (starting at epoch 500) start again from the initial higher learning rate.

Fig. 13 Training the coloured runs from Figure 7 for a fresh set of 500 epochs of 100 steps.