Continuum-level inference#

Continuum-level or domain-level inference conducted on 1D data consists of (1) calculating a 1D test statistic and then (2) conducting inference.

Test statistic calculation is very similar for 1D and 0D data. There are only two key differences. First, the test statistic value is calculated at every domain point for 1D data; if the original data are submitted as a (J,Q) array, where J and Q are the numbers of observations and domain points, respectively, then the test statistic continuum is a one-dimensional (Q,) array. Second, heteroscedasticity and non-sphericity corrections are performed once at the domain-level for 1D data.

Conducting 1D inference departs more from standard 0D procedures. If you were to calculate p-values and/or critical \(\alpha\)-based thresholds using standard distributions like the Student’s t-distribution, the resulting probability results would be invalid because they would fail to consider both (i) the size of the domain Q and (ii) the correlation amongst neighboring domain points. In other words, a simple 0D calculation would be unable to control the false positive rate \(\alpha\) at the domain level.

For domain-level inference, the key probability is the probability that the maximum test statistic value \(z_\max\) (across the domain) will exceed an arbitrary height u. This can be expressed as the survival function: \(P(z_\max > u)\). Setting this probability to \(\alpha\) (i.e., \(P(z_\max > u) = \alpha\)) allows one to calculate the critical height u (denoted \(z_c\)) for which only 100\(\alpha\)% of an infinite number of experiments with no true effect would produce a \(z_\max\) value that exceeds \(z_c\). Calculating \(z_c\) is the central goal of classical hypothesis testing when applied to domain-level inference. An observed test statistic continuum whose \(z_\max\) value exceeds \(z_c\) is regarded as significant at \(\alpha\). The p-value associated with the observed \(z_\max\) is then less than \(\alpha\) by definition.

spm1d offers five methods for calculating this threshold \(z_c\), using the same test statistic for all methods. Only the threshold \(z_c\) and downstream values such as clusters and their p-values differ. The threshold \(z_c\) changes with inference methods due to the assumptions and procedures that each method makes. No method is perfect, and none is “correct” or “incorrect”. Each has its own strengths and weaknesses making a given procedure more or less suitable in certain scenarios. spm1d users should be aware of these method-dependent limitations.

Random field theory (method='rft')#

spm1d’s default continuum-level inference method is random field theory (RFT). RFT assumes that the residuals (e.g., differences from the mean continuum) can be modeled as smooth, Gaussian random fields. RFT provides parametric, analytical solutions (i.e., precise mathematical equations) regarding various field-related probabilities — including \(P(z_\max > u)\) — when the underlying residuals are Gaussian.

In most statistics software, parametric inference requires just sample size (i.e., degrees of freedom) to calculate probabilities regarding 0D test statistics. RFT requires just one additional parameter (smoothness; see Smoothness estimation) to calculate probabilities regarding 1D test statistic continua. Smoothness may be regarded as approximately inversely proportional to the average first-derivative across the domain. More precisely, the required quantity is the number of resolution elements (resels) in the domain. Adler (1981) and Worsley et al. (1992, 1996) showed that for smooth Gaussian fields the expected Euler characteristic of the excursion set above \(u\) has a closed form in terms of \(u\), the degrees of freedom and the resel count. It closely approximates \(P(z_\max > u)\) at the heights that are relevant to hypothesis testing:

\[P\!\left(z_\max > u\right) \approx \mathbb{E}\!\left[\chi\!\left(A_u\right)\right]\]

When the data are very smooth, there are few resels and \(P(z_\max > u)\) is not much greater than the corresponding 0D probability. In contrast, rough data have many resels and need a correspondingly higher \(z_c\) to retain a Type I error rate of \(\alpha\) across the domain. From the perspective of classical hypothesis testing, this RFT procedure may be regarded as a smoothness-dependent correction for multiple comparisons that tightly controls \(\alpha\) for arbitrary domain smoothness. This \(\alpha\) control can be verified through simulation. For example, 1000 two-sample datasets of smooth Gaussian noise (10 observations per group, FWHM = 20) give a false positive rate of 0.049 at \(\alpha\) = 0.05, and the 95th percentile of the simulated field maxima (2.919) is close to RFT’s analytical threshold (2.944).

In addition to the critical threshold \(z_c\) , RFT also yields probabilities related to additional 1D geometric features including domain-level, cluster-level and set-level p-values; for 0D data just a single p-value exists because a 0D test statistic does not have any geometrical feature other than its height. The domain-level probability is the \(z_\max\) probability considered above. Cluster-level p-values represent the probability that a suprathreshold cluster broader than the observed cluster would be produced by smooth, purely random Gaussian fields. Set-level p-values additionally incorporate the number of suprathreshold clusters and represent the probability that at least \(k\) clusters with the observed breadth would be produced by smooth, purely random Gaussian fields. spm1d automatically calculates these various probabilities and returns them in a single inference object as p_zmax, p_set and p_cluster.

Permutation (method='perm')#

A permutation test numerically constructs the null distribution of \(z_\max\) by recomputing the test statistic (and its \(z_\max\) value) for random data relabelings (e.g., randomly assigning the observations to groups in ANOVA). The critical threshold \(z_c\) is the \((1-\alpha)\) quantile of this permutation distribution; this is the same as the “Fmax” procedure from the functional data analysis literature. Cluster-level p-values are also available via a secondary permutation which thresholds each test statistic continuum at \(z_c\) and then calculates the geometrical properties of each cluster (e.g., cluster breadth, integral, number of clusters, etc.) to form secondary cluster-specific distributions.

Permutation requires no smoothness or normality assumptions but is computationally expensive. The resolution of its p-values is limited to 1/nperm, where nperm is the selected number of permutations (usually 10000). Permutation does not explicitly consider smoothness. Instead it implicitly incorporates smoothness into all permutation distributions because the test statistic continuum generated during each permutation step is itself smooth.

The permutation threshold is calculated directly from the permutation distribution and is not bounded by the Bonferroni threshold. For very rough data and very small samples the permutation threshold can therefore exceed the Bonferroni threshold. This occurs because only a few permutations are possible in these cases (e.g., 32 for a one-sample test with five observations) and the upper tail of the permutation distribution is poorly resolved.

Permutation relaxes only the normality assumption and does not remove the need for a covariance model (e.g., modeling group variances in ANOVA as separate rather than as a single variance value for all groups). See Unequal variances for more details.

Permutation results are expected to converge to RFT results when the sample size is large enough to support many permutations and when the underlying data are normally distributed. Moreover, in many cases the permutation and RFT results will be qualitatively similar. If there is a very large true effect, both RFT and permutation methods are expected to detect it regardless of whether the data are actually distributed normally.

In general users are encouraged to run both parametric and nonparametric inference. Insofar as the results qualitatively agree, it would be suitable to conclude that RFT’s assumption of normality did not affect conclusions for that particular dataset.

This recommendation is somewhat different than common practice in the literature, where the outcome of explicit normality tests often drives the subsequent adoption of parametric vs. nonparametric methods. This workflow is supported in spm1d through the use of normality tests. However a generally more robust solution is to conduct both parametric (RFT) and nonparametric inference and to report qualitative differences where the two disagree.

False discovery rate (method='fdr')#

spm1d’s false discovery rate (FDR) implementation uses the Benjamini–Hochberg procedure to control the expected proportion of false positives ℹ️ among the points declared significant. It ranks the points’ uncorrected p-values and finds the largest \(k\) for which \(p_{(k)} \le k\alpha/Q\). The critical threshold \(z_c\) is the test statistic value at that point.

ℹ️ FDR vs FPR

Note that this FDR quantity differs from the false positive rate (FPR) \(\alpha\) that the RFT and permutation methods control. Because FDR and FPR are different quantities, their methods generally produce different results. Use of an FPR vs. FDR method should be chosen based on the purpose of the analyses. Users are encouraged to explore the broad FDR literature when deciding whether a particular study is more consistent with FDR control vs. FPR control.

FDR is less conservative than family-wise error control when a true effect spans a large portion of the domain.

Additional points relevant to the spm1d implementation:

  • The FDR procedure reports a lack of significance as zc = inf.

  • Its p-values pertain to individual points (p_point).

  • No cluster-level or set-level probabilities are available with spm1d’s FDR implementation.

Bonferroni (method='bonf')#

The Bonferroni procedure divides \(\alpha\) by the number of domain points \(Q\). It validly controls the family-wise error rate at \(\alpha\) for any dependence structure, but it treats the \(Q\) points as \(Q\) independent tests. That is overly conservative for smooth data. Its threshold is therefore almost always much higher than the RFT threshold. It represents an upper bound on parametrically determined \(z_c\) because it corresponds to an assumption of perfectly rough fields. In general the Bonferroni correction should not be used except as an upper-bound reference.

Uncorrected (method='uncorr')#

The uncorrected threshold is the 0D critical value and depends only on the degrees of freedom, ignoring \(Q\) and field smoothness. This is NOT a valid continuum-level procedure and is provided for comparison purposes only. Never report uncorrected results for continuum-level analyses.

Choosing#

RFT is the default method and is appropriate for most smooth, approximately normal datasets. Permutation may be preferable when normality is doubtful and can also be used to check RFT results. FDR is not directly related to the FPR procedures (RFT and permutation). It is suitable for exploratory analyses in which the proportion of false discoveries rather than their existence is the main concern. The Bonferroni and uncorrected procedures provide upper and lower bounds on probabilistic quantities and should generally not be reported except as a reference to the other procedures.

ℹ️ RFT vs permutation

RFT’s assumption of normality becomes increasingly inconsequential as true effect size grows. When the true effect is large, and the sample size is not very small, both the RFT and permutation methods will detect the effect as significant. From the perspective of classical hypothesis testing, RFT’s assumptions are most relevant when both (i) normality is violated and (ii) effects are borderline significant. In that case RFT and permutation results may differ. Regardless, a difference between RFT and permutation results does not imply that one is correct and the other is incorrect; in fact both are correct from the standpoint of their assumptions and limitations.

Thus we recommend the following:

  • Conduct RFT inference as the default

  • Use permutation to verify the RFT results

  • If the RFT and permutation results differ qualitatively, look at the data to find potential sources of non-normality (e.g., outliers) and fix data problems if relevant. Otherwise it may be preferable to report both the nonparametric and RFT results and to explain why they differ based on the observed distribution.

  • Use FDR procedures only for purely exploratory studies where false discoveries may be more important than false positives.

Example#

Applying the five inference methods to a single dataset (jd.PlantarArchAngle) yields these thresholds and probabilities:

dataset = jd.PlantarArchAngle()
y, A    = dataset.y, dataset.x
t       = spm1d.stats.ttest_paired( y[ A == 1 ], y[ A == 0 ] )
np.random.seed( 0 )
for method in ('rft', 'perm', 'fdr', 'bonf', 'uncorr'):
    kwargs = dict( nperm=-1 ) if method == 'perm' else {}      # all 1024 permutations
    ti     = t.inference( 0.05, method=method, **kwargs )
    print( f'{method:<6}  zc = {ti.zc:.3f},  h0reject = {ti.h0reject},  p_zmax = {ti.p_zmax:.4f}' )
rft     zc = 3.829,  h0reject = True,  p_zmax = 0.0021
perm    zc = 3.598,  h0reject = True,  p_zmax = 0.0039
fdr     zc = 4.194,  h0reject = True,  p_zmax = 0.0063
bonf    zc = 5.298,  h0reject = True,  p_zmax = 0.0106
uncorr  zc = 2.262,  h0reject = True,  p_zmax = 0.0001

Interpretations:

  • The (invalid) uncorrected threshold is identical to the 0D critical value.

  • The Bonferroni threshold treats the 101 domain points as independent tests and gives the highest threshold.

  • The RFT and permutation thresholds lie between the uncorr and bonf extremes and are relatively close to each other because these data are relatively normal.

  • All valid (and invalid) methods reject the null hypothesis here because the effect is quite large.

How is this different from conducting separate tests at each domain point?#

The reason can be inferred from a thought experiment: if you were to collect the original data not at \(Q\)=101, but instead at a higher sampling rate with \(Q\)=1000, \(Q\)=1e6 or \(Q\)=1e9, the SPM result would not change provided that the original data sampled at \(Q\)=101 accurately contain the frequencies of interest. In contrast, separate hypothesis tests conducted at each domain point must consider the number of tests conducted in order to control the false positive rate at \(\alpha\) (i.e., the multiple comparisons problem). As \(Q\) increases, so too must the critical threshold in order to maintain a false positive rate of \(\alpha\) across all domain points.

The SPM/RFT threshold does not increase with \(Q\) because it considers domain smoothness with respect to domain size. That ratio is essentially constant regardless of \(Q\). Here “smoothness” can be approximately interpreted as the inverse of the average first derivative of model residuals. As \(Q\) grows, smoothness also grows and the relative smoothness (i.e., the ratio: smoothness / \(Q\)) stays essentially constant.

References#