Anytime-Valid Tests of Group Invariance through Conformal Prediction
Abstract
We develop anytime-valid tests of invariance under the action of compact groups. The resulting test statistics are optimal in a logarithmic-growth sense. We apply our method to extend recent anytime-valid tests of independence and to construct tests of normality.
keywords:
Anytime-Validity , Hypothesis Test , Group Invariance , Conformal Martingale[1]organization=Mathematical Institute, Leiden University, addressline=Einsteinweg 55, city=Leiden, country=The Netherlands
[2]organization=Department of Mathematics and Computer Science, Eindhoven University of Technology, addressline= PO Box 513, city=Eindhoven, postcode=5600 MB, country=The Netherlands
1 Introduction
Suppose that we observe data sequentially, and that they take values in a probability space . We are interested in testing the null hypothesis of invariance of the data under the action of a sequence of groups , that is,
(1) |
where signifies equality in distribution and, for each , is a group of transformations of the data—a compact topological group that acts continuously on . In order to avoid pathological situations additional structure is needed (see Section 2). Note that the observations are not assumed to be independent nor identically distributed; they are only assumed to be sampled from a distribution on infinite sequences. Prominent examples of (1) include testing for exchangeability (Vovk et al., 2005; Ramdas et al., 2022), in which case is the group of permutations on elements; and testing for sphericity, in which case is the orthogonal group . The latter can be used to test the Gaussian-error assumption in linear regression, as we will see. We construct anytime-valid tests for that monitor test martingales and randomized versions thereof.
A sequence of statistics of the data is a test martingale if it is nonnegative, starts at one, and is a martingale under every element of . Formally, if is a filtration of -algebras such that , then a sequence of statistics is a test martingale for with respect to if for all and . Test martingales are the central objects for anytime-valid inference (Ramdas et al., 2023). A sequential test can be built using the threshold and the resulting test is anytime valid in the sense that it enjoys the time-uniform type-I error guarantee that for any . Furthermore, it will also be useful to consider randomized test martingales, for which we append an independent random number to each .
We build test martingales using tools from conformal prediction, which is perhaps best known as a framework for uncertainty quantification for point predictors (see Vovk et al. (2005) and Section 3). The test martingales constructed using these methods are known as conformal martingales. Most crucially for our present purposes, Vovk et al. (2005) show that conformal martingales can be used to test whether data are generated by a specific class of generating mechanisms, called online compression models. The key insight of this note is that group-invariant models can be regarded as online compression models. Therefore, conformal martingales can be built using the conformal-prediction machinery to test the hypothesis of invariance in (1).
We further show that the resulting test martingales are optimal in a specific logarithmic sense. The rationale behind this criterion is that, under the alternative distribution, a “good” test martingale should no longer be a martingale and it should grow large to gather evidence against the null. Formally, given a specific alternative of interest and a stop** time for the experiment, the relevant test statistic is —the value of a test martingale at . For example, could be the first hitting time for the threshold as before. A common measure to judge the expected growth of at is , and test martingales that maximize this growth rate are referred to as log-optimal (see Koolen and Grünwald, 2022; Ramdas et al., 2023).
In Section 2, we give additional structure to the problem of sequential group invariance, give the necessary background on online compression models, and we show that sequential group-invariant models define online compression models. Section 3 shows our construction of test martingales using the online-compression structure and conformal prediction. Section 4 shows that our construction is log-optimal against certain alternatives. Section 5 applies the results to test for independence and to test rotational invariance, and Section 6 discusses the limitations of invariance testing in the context of online compression models and modifications of the constructions that are used.
All the proofs can be found in A in the supplementary material.
2 Sequential group actions and online compression models
The hypothesis in (1) is only meaningful if the statements regarding group invariance for each are consistent with each other; without any further restrictions, invariance of the data at one time may contradict the invariance of the data at a later time. We assume that the groups act sequentially on the data to avoid such situations.
Definition 1 (Sequential group action)
The action of the sequence of groups on is sequential if the following conditions hold.
-
(i)
The sequence is ordered by inclusion: for each , there is an inclusion map such that is a continuous group isomorphism between and its image, and the image of under is closed in .
-
(ii)
For all and all , where is the canonical projection map .
-
(iii)
Let , , and . For , denote . Then, if and only if, for all
Here, item (i) gives an ordering of the sequence of groups by inclusion, (ii) ensures that this inclusion does not change the action of the groups on past data, and (iii) implies that the groups do not act on “future” data. As a result, invariance of under is implied by invariance of under and the individual statements of invariance in (1) for each do not contradict each other. The simplest example of a sequential action is when each for some group and acts on componentwise, i.e., . This setting is, among others, discussed in detail by Koning (2023). A more complicated example of a sequential action (testing for sphericity) is given in Section 5.2.
Under the assumption that the group action is sequential, we show that the null hypothesis of invariance is an online compression model. They are models for computing online summaries, or compressed representations, of the observed data. When the data is generated by an online compression model, the techniques developed for conformal prediction can be used to construct a sequence of i.i.d. uniform statistics, which in turn give rise to a test martingale, as we discuss in Section 3. Vovk et al. define online compression models in abstract terms; we use a simplified definition here.
Definition 2 (Online compression model)
An online compression model on is a 3-tuple of sequences where:
-
1.
is a sequence of statistics ; we call a summary of ,
-
2.
is a sequence of functions such that ,
-
3.
is a sequence of conditional distributions for given .
To show how sequential group invariance defines an online compression model, we first recall some group theory. First, the orbit of under the action of is the set of all values that are reached by the action of on , i.e., . In order to identify each orbit, we pick a single element of in each orbit—an orbit representative—and consider the map that takes each to its orbit representative. We call an orbit selector, and we assume that it is measurable. Such measurable orbit selectors are known to exist under weak regularity conditions on and (see Bondar, 1976, Theorem 2) that hold in all the examples of this work. Furthermore, because is a compact group, there exists a unique -invariant probability distribution , called the Haar measure (Bourbaki and Berberian, 2004, Chapter VII). The Haar measure plays the role of a uniform distribution on groups. Finally, it is a well-known fact that , where independently of (Eaton, 1989, Theorem 4.4).
Together with the following proposition, these properties show that the sequential group invariance structure considered here defines an online compression model with .
Proposition 1
There exists a sequence of measurable functions such that , and is a one-to-one function of .
Corollary 1
The tuple , where is the uniform distribution on induced by the Haar measure on , defines an online compression model on .
3 Testing group invariance with conformal martingales
The goal of this section is the construction of test martingales for the null hypothesis of distributional symmetry in (1) any time that a sequence of groups acts sequentially on the data . To this end, the invariant structure of the null hypothesis is used in tandem with conformal prediction to build a sequence of independent random variables with the following three properties:
-
1.
The sequence is adapted to the data sequence with external randomization , that is, for each , .
-
2.
Under any element of the null hypothesis from (1), is a sequence of independent and identically distributed random variables.
-
3.
The distribution of is not uniform when departures from symmetry are present in the data.
The construction of these random variables is the subject of Section 3.1—additional definitions are needed for their construction. In order to guide intuition, Example 1 shows a first example for testing exchangeability. Given their uniform distributions, the statistics have previously been called p-values (e.g. Vovk et al., 2005; Fedorova et al., 2012). We opt against that terminology here, because typically only small p-values are interpreted evidence against the null hypothesis. However, in this context, it is any deviation from uniformity that we interpret as evidence against the null hypothesis.
Once the sequence has been built, test martingales against distributional invariance can be constructed. This is achieved by testing the uniformity of . Indeed, any time that is a sequence of functions such that , the process given by
(2) |
is a test martingale for with respect to , where . This follows from the fact that , where we leverage independence and uniformity. The functions are known as calibrators (Vovk and Wang, 2021). They can be taken to be any sequence of predictable estimators of the distribution of (Fedorova et al., 2012), so that the test martingale is expected to grow if the true distribution of the orbit ranks is not uniform, i.e., the null hypothesis is violated. The optimality of this procedure is discussed in Section 4.
Example 1 (Sequential Ranks)
Consider the case of testing exchangeability, that is, the case when and each group is , the group of permutations on elements. Consider, for each , the random variables —the rank of among . It is a classic observation that each is uniformly distributed on , and that is a sequence of independent random variables (Rényi, 1962). The random variables are called sequential ranks (Malov, 1996). After rescaling and adding external randomization, a sequence of random variables can be built from such that satisfies items 1, 2 and 3 at the start of this section. Furthermore, if we denote the uniform measure on by , then can also be obtained from While this rewriting may seem esoteric at this point, it turns out to be the correct point of view for generalization as there exists an analogue of the uniform probability distribution on every compact group—its Haar measure.
3.1 Conformal prediction under invariance
In general, the statistics will be designed to measure how strange the observations are in contrast to what would be expected under distributional invariance. To this end, the values of are compared to those in the orbit of under the action of . In order to measure the “strangeness” of the observations in their orbit, we use an adaptation of the conformity measures introduced by Vovk et al. (2005).
Definition 3 (Conformity measure of invariance)
We say that is a conformity measure of invariance at time if the following hold:
-
(i)
, where for a function .
-
(ii)
If for , then for all .
Item (ii) in Definition 3 is an addition to the definition by Vovk et al. (2005). It ensures that the action of on induces an action on the conformity measures, that is, it implies that the action of on defined by is well-defined.
The distribution of the conformity measures under the null hypothesis can be obtained by leveraging the distributional invariance. Indeed, as discussed in Section 2, the distribution of conditional on is characterized by the Haar measure. Similar to what happened in Example 1, this distribution can be used to rank the observed value of the conformity score among all its possible values on the orbit of the data. This idea gives rise to the (smoothed) orbit ranks in the next definition.
Definition 4 (Smoothed Orbit Ranks)
Fix and let be a conformity measure of invariance at time . We call , defined by
(3) |
a (smoothed) orbit rank, where denotes the Haar probability measure on and the sequence is independent of .
Note that, if the distribution of conditional on is continuous, then the smoothing plays no role in (3), and . Furthermore, if in Item (i) of Definition 3 is chosen properly, a small orbit rank indicates that the observed value of is strange (not conform) compared to the values it would have attained on different elements in the orbit of the data. Alternatively, one can think of as the CDF of the distribution of conditional on evaluated in the data (with added randomization). It follows—and this is shown in Theorem 1—that each is uniformly distributed on . Vovk et al. (2005, Theorem 11.2) show that, if the data is generated by an online compression model, then are also independent. Since Corollary 1 shows that a sequential group invariance structure defines an online compression model, it follows that the smoothed orbit ranks form an i.i.d. uniform sequence under the null hypothesis. This is stated in the next theorem, for which we provide a direct proof for completeness in A in the supplementary material.
Theorem 1
Suppose that the action of on is sequential and that is generated by an element of . Then for each and the distribution of is given by .
4 Optimality
In this section, we show that any martingale based on the smoothed orbit ranks as in (2) can be thought of as likelihood ratio processes, and that they are log-optimal against the implicit alternative for which they are built. Indeed, let be a distribution such that, conditionally on , has density under for all . Here, we use to denote the distribution with added external randomization, i.e. , where is the uniform distribution on . Analogously, for each , define . Observe that equals the likelihood ratio between and , which equals the uniform distribution for any . Surprisingly, is also the likelihood ratio of the full data between a distribution such that and an appropriately chosen distribution , as shown in the following proposition.
Proposition 2
Suppose that , where is a one-to-one function for each . Furthermore, suppose that is any distribution under which for each . If and each is the conditional distribution of given , then, for ,
(4) |
where denotes the distribution under which the marginal distribution of coincides with that under , and such that , where independently from .
The next theorem uses the representation in (4) to show the log-optimality of . Its proof is heavily inspired by Koolen and Grünwald (2022, Theorem 12).
Theorem 2
Assume that , where is one-to-one all and let be any distribution such that has full support. Denote for the density of under . Let be any stop** time and any test martingale for , both with respect to —the filtration generated by the smoothed ranks. Then, it holds that
(5) |
Moreover, if is such that for all , then for any test martingale for w.r.t. —the full-data filtration—, it also holds that
(6) |
The additional assumption of independence between and is necessary for (6) to hold: if is a distribution under which , then the conformal martingale is not in general a likelihood ratio as in (4). For the deterministic stop** time , the log-optimal statistic is , as it can be written as a likelihood ratio (see also Grünwald et al., 2024; Koning, 2023). However, the sequence does not necessarily give rise to an anytime-valid test. Using tests based on the sequential ranks circumvents this issue for such alternatives.
The optimality of in Theorem 2 is contingent on oracle knowledge of the true distributions , which are unknown in practice. To counter this, past data can be used sequentially to estimate the true density. This ideas has previously been applied for testing exchangeability (Vovk et al., 2005; Fedorova et al., 2012). More precisely, for each , let be an estimator of based on , and consider the martingale defined by . While this is suboptimal with respect to an oracle that knows the true density, there is limited loss asymptotically if is a good estimator of . In order to judge if an estimator is good for the task at hand, consider the difference in expected growth per outcome for fixed , i.e.,
(7) |
where denotes the Kullback-Leibler divergence whenever is absolutely continuous with respect to , and the expectation on the right-hand side of (7) is over past data (on which depends). Estimators under which (7) tends to zero are known to exist under weak conditions on the true density (Haussler and Opper, 1997; Cesa-Bianchi and Lugosi, 2001; Grünwald and Mehta, 2019). Under more stringent assumptions—for example, if the density belongs to an exponential family—sequential Bayesian-update-type algorithms are known to guarantee that (7) tends to 0 as (Kotłowski and Grünwald, 2011).
5 Applications and Extension
In this section, we discuss applications and an extension of the theory developed above.
5.1 Modification for Independence Testing
We now propose a minor modification of the conformal martingales from the previous section that can be used to test for independence. Formally, fix and suppose that at each time point , a -dimensional vector is observed. We are interested in testing the null hypothesis that states that: (1) for each and each the vectors are -invariant, and (2) for all . Under this hypothesis, the data is invariant under the sequential action of given by , acting on rowwise. That is, the first copy of the group acts on , the second on , etc. This action is sequential anytime that the action of is sequential on each of the data streams.
Based on the discussion above, a first idea to test for invariance under is to create test martingales and combine them through multiplication. More specifically, we can treat each of the sequences , as a separate data stream and compute the corresponding statistics in (3), leading to sequences of uniformly distributed random variables . If, for all and , is a density on then, by independence, the sequence defined by is a martingale under the null hypothesis. However, this martingale would not be able to detect alternatives under which the marginals are group invariant, but not independent. This stems from the fact that it only uses that the marginals are uniform under the null, while in fact a stronger claim is true: for each , the joint distribution of , , is uniform on . As a result of this observation, one can choose any sequence of joint density (estimators) on and create a test martingale by considering .
In the case that and , this is the procedure that was recently employed by Henzi and Law (2023). They discuss a specific choice of , a histogram density estimator, that is able to detect departures from independence consistently under the stronger assumption that data are i.i.d. One of their key insights is that independence of the data streams not only implies joint uniformity of the sequential ranks in their setting, but the two are actually equivalent. This equivalence breaks down if one does not assume that are i.i.d. for all . Finding conditions under which the independence of the streams and the joint uniformity of the rank distributions are equivalent so that a histogram density estimator might reliably detect independence in the more general setting, is future work.
5.2 The orthogonal group and linear models
Consider testing whether the data we observe are drawn from a spherically symmetric distribution, i.e., and , where is the orthogonal group in dimension . Testing for spherical symmetry is equivalent to testing whether the data are generated by a zero-mean Gaussian distribution. This follows from the fact that any distribution on for which the marginal of the first coordinates is spherically symmetric for any , can be written as a mixture of i.i.d. zero-mean Gaussian distributions (Bernardo and Smith, 2009, Proposition 4.4). It follows that any process that is a supermartingale under all zero-mean Gaussian distributions is also a supermartingale under spherical symmetry and vice-versa. This implies that, for the purpose of testing with supermartingales, the two hypotheses are equivalent. We show how this fits in our setting, and deffer the application to regression to the Supplementary Material.
We now check that testing spherical symmetry fits in our setting, i.e., that Definition 1 is fulfilled. Consider the inclusion of in given by
for each . Using the canonical projections in , Definition 1 is readily checked. Since the data are real, can be chosen to be the identity for all , i.e., . An orbit selector is given by , where is the unit vector . For simplicity, we assume that the distribution of has a density with respect to the Lebesgue measure for each , so that —no external randomization is needed. Rather than thinking of as a measure on , one can think of it as the uniform measure on . This way, can be recognized to be the relative surface area of the hyper-spherical cap with co-latitude angle . Li (2010) shows that an explicit expression for this area is given by
(8) |
where denotes the regularized beta function, for for .
Note that if and only if and that , so that (8) equals the CDF of the t-distribution with degrees of freedom evaluated in . If , then is the ratio of a normally distributed random variable and an independent chi-squared-distributed random variable. Therefore, has a t-distribution with degrees of freedom, so that we essentially perform a type of sequential t-test.
This example can be extended to testing for centered spherical symmetry, i.e., whether , where is the all-ones -vector, and is spherically symmetric for every . By similar reasoning as above, this is equivalent to testing whether the data is i.i.d. Gaussian with any mean/variance. Even more, by considering different isotropy groups, one can also cover the case where the mean is not fixed, but depends on covariates. The techniques needed in that case are similar; we show them in B of the supplementary material.
6 Discussion
We have discussed how the theory of conformal prediction can be applied to test for symmetry of infinite sequences of data. Here we discuss two topics. First, the relationship to noninvariant conformal martingales. Second, whether smoothing is necessary when defining orbit ranks.
6.1 Noninvariant conformal martingales
Not all online compression models correspond to a compact-group invariant null hypothesis. An interesting example of this phenomenon is when the data are i.i.d. and exponentially distributed. This distribution is invariant under reflections in any line (not necessarily through the origin), but these reflections do not define a compact group and therefore do not fit the setting discussed in this article. Nevertheless, the sum of data points is a sufficient statistic for the data, so this model can still be seen as an online compression model with the sum being the summary. More work is needed to find out whether conformal martingales are log-optimal against certain alternatives in such settings.
6.2 The need for smoothing
In situations when, conditionally on the orbit selector , the conformity measure has a continuous distribution, the smoothing plays no role in (4). This is the case for the rotations discussed in Section 5.2. In certain other scenarios, smoothing can be avoided as well. Indeed, one can always define nonsmoothed orbit ranks, in opposition to the smoothed ranks from Definition 4, by Notice that this nonsmooth version satisfies . For a particular choice of increasing densities on —in the sense that is increasing—, we have that the process is bounded from above by the conformal martingale . Such a choice of increasing is natural when high values of (or ) are associated with departures from the null hypothesis. Then, any sequential test based on an upper threshold on inherits the anytime-valid type-I error guarantees of —exactly because . This was previously noted by Vovk et al. (2003). However, the process may not be a martingale itself. Instead, a test martingale can sometimes directly be associated to . For instance, in the setting of Example 1 (testing exchangeability), the distribution of under the null hypothesis is known—it is uniformly distributed on . Therefore, we can construct likelihood ratio processes for the sequence of nonsmoothed ranks. Even more, there are parametric alternatives under which the exact distributions of the nonsmoothed ranks can be computed. This is the case for Lehmann alternatives where, under the null, each is assumed to be sampled from some continuous distribution with c.d.f. for some fixed ; under the alternative, for some . From Theorem 7.a.1 of Savage (1956) the distribution of can be derived, so that the likelihood ratio process of can be used for testing, thus avoiding external randomization.
7 Acknowledgements
We thank the attendees of the Seminar on Anytime-Valid Inference “E-readers” at Centrum Wiskunde & Informatica in Amsterdam for their input and valuable insights. In particular, we are grateful to Peter Grünwald for feedback on a first version of this article, and Nick Koning for fruitful discussions.
References
- Bernardo and Smith (2009) Bernardo, J.M., Smith, A.F., 2009. Bayesian theory. volume 405. John Wiley & Sons.
- Bondar (1976) Bondar, J.V., 1976. Borel cross-sections and maximal invariants. The Annals of Statistics , 866–877.
- Bourbaki and Berberian (2004) Bourbaki, N., Berberian, S., 2004. Integration II: Chapters 7–9. Springer Berlin Heidelberg.
- Cesa-Bianchi and Lugosi (2001) Cesa-Bianchi, N., Lugosi, G., 2001. Worst-case bounds for the logarithmic loss of predictors. Machine Learning 43, 247–264.
- Eaton (1989) Eaton, M.L., 1989. Group invariance applications in statistics. Regional Conference Series in Probability and Statistics 1, i–133. URL: http://www.jstor.org/stable/4153172.
- Fedorova et al. (2012) Fedorova, V., Gammerman, A., Nouretdinov, I., Vovk, V., 2012. Plug-in martingales for testing exchangeability on-line, in: Proceedings of the 29th International Conference on Machine Learning, Omnipress, New York, NY, USA. pp. 1639–1646.
- Grünwald and Mehta (2019) Grünwald, P.D., Mehta, N.A., 2019. A tight excess risk bound via a unified pac-bayesian–rademacher–shtarkov–mdl complexity, in: Algorithmic Learning Theory, PMLR. pp. 433–465.
- Grünwald et al. (2024) Grünwald, P., de Heide, R., Koolen, W., 2024. Safe Testing. JRSS B: Statistical Methodology URL: https://doi.org/10.1093/jrsssb/qkae011.
- Haussler and Opper (1997) Haussler, D., Opper, M., 1997. Mutual information, metric entropy and cumulative relative entropy risk. The Annals of Statistics 25, 2451–2492. URL: http://www.jstor.org/stable/2959041.
- Henzi and Law (2023) Henzi, A., Law, M., 2023. A rank-based sequential test of independence. ArXiv preprint arXiv:2305.13818.
- Koning (2023) Koning, N.W., 2023. Online permutation tests: -values and likelihood ratios for testing group invariance. arXiv:2310.01153. arXiv preprint arXiv:2310.01153.
- Koolen and Grünwald (2022) Koolen, W.M., Grünwald, P., 2022. Log-optimal anytime-valid e-values. Int. Journal of Approximate Reasoning 141, 69–82.
- Kotłowski and Grünwald (2011) Kotłowski, W., Grünwald, P., 2011. Maximum likelihood vs. sequential normalized maximum likelihood in on-line density estimation, in: Proceedings of the 24th Annual Conference on Learning Theory, JMLR Workshop and Conference Proceedings. pp. 457–476.
- Li (2010) Li, S., 2010. Concise formulas for the area and volume of a hyperspherical cap. Asian Journal of Mathematics & Statistics 4, 66–70.
- Malov (1996) Malov, S., 1996. Sequential ranks and order statistics. Journal of Mathematical Sciences 81, 2434–2441.
- Ramdas et al. (2023) Ramdas, A., Grünwald, P., Vovk, V., Shafer, G., 2023. Game-theoretic statistics and safe anytime-valid inference. Statistical Science 38, 576–601.
- Ramdas et al. (2022) Ramdas, A., Ruf, J., Larsson, M., Koolen, W.M., 2022. Testing exchangeability: Fork-convexity, supermartingales and e-processes. International Journal of Approximate Reasoning 141, 83–109.
- Rényi (1962) Rényi, A., 1962. On the extreme elements of observations. MTA III. Oszt. Közl 12, 105–121.
- Savage (1956) Savage, I.R., 1956. Contributions to the Theory of Rank Order Statistics-the Two-Sample Case. The Annals of Mathematical Statistics 27, 590–615. doi:10.1214/aoms/1177728170. publisher: Institute of Mathematical Statistics.
- Shiryaev (2016) Shiryaev, A.N., 2016. Probability-1. volume 95. Springer.
- Smith (1981) Smith, A.F., 1981. On random sequences with centred spherical symmetry. Journal of the Royal Statistical Society: Series B (Methodological) 43, 208–209.
- Vovk (2002) Vovk, V., 2002. On-line confidence machines are well-calibrated, in: The 43rd Annual IEEE Symposium on Foundations of Computer Science, 2002. Proceedings., IEEE. pp. 187–196.
- Vovk (2004) Vovk, V., 2004. A universal well-calibrated algorithm for on-line classification. The Journal of Machine Learning Research 5, 575–604.
- Vovk (2023) Vovk, V., 2023. The power of forgetting in statistical hypothesis testing, in: Conformal and Probabilistic Prediction with Applications, PMLR. pp. 347–366.
- Vovk et al. (2005) Vovk, V., Gammerman, A., Shafer, G., 2005. Algorithmic learning in a random world. volume 29. Springer.
- Vovk et al. (2003) Vovk, V., Nouretdinov, I., Gammerman, A., 2003. Testing exchangeability on-line, in: Proceedings of the 20th International Conference on Machine Learning (ICML-03), pp. 768–775.
- Vovk and Wang (2021) Vovk, V., Wang, R., 2021. E-values: Calibration, combination and applications. The Annals of Statistics 49, 1736–1754.
Appendix
Appendix for “Anytime-Valid Tests of Group Invariance through Conformal Prediction” by Tyron Lardy and Muriel Felipe Pérez-Ortiz.
Appendix A Proofs
A.1 Proof of Theorem 1
Proof 1 (Theorem 1)
The proof can be divided in two main steps: (1) to show that, conditionally on , is uniformly distributed for each and (2) to show that are also independent. The second step is completely analogous to the proof of Theorem 3 by Vovk (2002). For each , define the -algebra . Notice that contains—among others—all -invariant functions of because is a maximally invariant function of —any other -invariant function of is a function of . Let such that , then we have that . By the invariance of —it is the Haar probability measure—, it follows that
An analogous identity can be derived for the second term in (3). We have .
We will denote and define . If is continuous, then is the CDF of that distribution, otherwise it is the CDF minus the probability of equality. In any case, is is nonincreasing and left-continuous. For any , we have that for some , with equality if is continuous in . Then we can write
(9) |
For any , we have that if and only if either or , which happens precisely when . We therefore see
If is continuous in , then this shows that , since in that case. If is not continuous in , then we have that
Notice that if and only if and , so that we can write
Putting everything together, we see that . This shows the first part, that has a conditional uniform distribution on .
For the second part of the proof, we show that the sequence is also an independent sequence. We have that is -measurable because it is invariant under transformations of the form for (see also Vovk, 2004, Lemma 2). We proceed (implicitly) by induction:
It follows by the law of total expectation that
which shows that are independent and uniformly distributed on for any . This implies that the distribution of coincides with by Kolmogorov’s extension theorem (see e.g. Shiryaev, 2016, Theorem II.3.3). This shows the claim of the theorem.
A.2 Proof of Proposition 1
Proof 2 (Proposition 1)
For and , let , where, by a slight abuse of notation, we refer by to the concatenation of and . We will show that has the claimed properties. First, we will show that the vectors and are in the same orbit, so that also . To this end, let denote the group element such that . Then it holds that
where we called the concatenation of and . This shows the first claim. For the second claim, that is one-to-one for each fixed , we show that we can reconstruct from and .
Pick any such that . We furthermore know that there exists some such that . Note that does nothing to the final coordinate of , so by Assumption 1 there is a such that . Then we see
We find that and therefore .
A.3 Proof of Proposition 2
The proof of Proposition 2 follows directly from Lemma 1. It states that, with probability one, enough of the original data can be recovered using the smoothed ranks and the orbit representative. We state Lemma 1, prove Proposition 2 and then prove Lemma 1.
Lemma 1
Suppose, for each , that is a one-to-one function of , then there exists a map s.t. for any Here, is the sequence given by .
Proof 3 (Lemma 2)
Consider, without loss of generality, the case that . Because of the independence of and under and the assumption that the marginal distribution of under and under are equal, . Using the sequence of functions from Lemma 1 and that the external randomization is independent of , the claim follows.
Proof 4 (Lemma 1)
As in the proof of Theorem 1, we will denote and define . Furthermore, we will write for the distribution of given and denote its support by
If , then there exists an open interval with and . For all with , we have that , since contains an open neighborhood of an interior point of the support. It follows that . In words, there are no points to the right of such that . Consequently, we have
In a similar fashion, we can conclude that the same identity holds if . Notice furthermore that whenever , which happens with probability one. Together with the fact that , this gives , so also . If , set . If , then it follows that , so set . Since is one-to-one by assumption, its inverse maps to . By Proposition 1, there also exists a map from and to . At this point, we can repeat the procedure above to recover from , from which we can then recover , etc. Together, all of the maps involved give the function as in the statement of the proposition.
A.4 Proof of Theorem 2
Proof 5 (Theorem 2)
We first show (6). Assume that is such that for all . Let denote the distribution under which the marginal of coincides with that under , and such that , where is uniform on and independent from . First note that
In the last inequality, we used Lemma 1. Since the distribution of has full support under , we have that , so it also holds that . We have shown that is a modification of the likelihood ratio evaluated at . We now show that the latter is optimal.
Denote and let ; a concave function. We will show that the derivative of in is negative, which implies that attains its maximum in . This in turn implies our claim. Indeed,
where we use that differentiation and integration can be interchanged, because
so that the dominated convergence theorem is applicable. Finally, this gives that . The proof of (5) follows from the same argument, but using .
Appendix B Linear models and isotropy groups
The rotational symmetry described in Section 5.2 is that of symmetry around the origin, which we argued is equivalent to testing whether for some . Of course, there are many applications where it is not reasonable to assume that the data is zero-mean and it is more interesting to test whether the data is spherically symmetric around some point other than the origin. One particular instance of such noncentered sphericity is to test whether, for each , the data can be written as , where , the error is spherically symmetric and is the -vector of all ones. If is known, we can test for spherical symmetry of under and the problem reduces to that of the previous section. It is still possible treat the more realistic case where is unknown because the null model is still symmetric under a family of rotations. Notice the following: for any it holds that . Unless , it follows that every time that . That is, the null distribution of is invariant under the isotropy group of , i.e. . Invariance under the action of has previously appeared in the literature as centered spherical symmetry (Smith, 1981). Through the lens of test martingales, testing sequentially for centered spherical symmetry is equivalent to testing whether the data was generated by any Gaussian. This holds because any probability distribution on for which the marginal of the first coordinates is centered spherically symmetric for any can be written as a mixture of Gaussians (Smith, 1981; Eaton, 1989, Theorem 8.13).
Using some geometry, a test is readily obtained. Note that we can write , where is the projection of onto the span of , and the projection onto its orthogonal complement. We have that for any . Consequently, the orbit of under is given by the intersection of and the hyperplane defined by . There is a unique line that is perpendicular to and passes through the origin ; it intersects in the point . For any , Pythagoras’ theorem gives that . In other words, forms an -dimensional sphere of radius around . If one considers the projection of this sphere on the -th coordinate, then the highest possible value is given by , and the lowest value therefore by . The relative value of is therefore given by . As a result, is the relative surface area of the -dimensional hyper-spherical cap with co-latitude angle , so that equation (8) can again be used to determine . With this construction, we recover what Vovk (2023) refers to as the “full Gaussian model”, which is an online compression model that is defined in terms of the summary statistic .
This model can be extended to the case in which there are covariates, i.e. for some and . Denote for the matrix with row-vectors and, as is a standard assumption in regression, assume that is full rank for every . The model of interest is where and is spherically symmetric for each . Similar to the reasoning above, this model is invariant under the intersection of the isotropy groups of the column vectors of , i.e. . The orbit of under is given by the intersection of with the intersection of the hyperplanes defined by the columns of , so that for , computing is analogous. Interestingly, however, it does not always hold that testing for invariance under is equivalent to testing for normality with mean . A sufficient condition for the equivalence to hold is that , which is essentially the condition that the parameter vector can be consistently estimated by means of least squares (Eaton, 1989, Section 9.3).