boundsSFR() computes exact bounds of Spearman's footrule
for partially observed univariate, distinct data using the results and
algorithms following Zeng et al., 2025.
Let \(X = (x_1, \ldots, x_n)\) and \(Y = (y_1, \ldots, y_n)\) be
two vectors of univariate, distinct data, and denote the rank of \(x_i\)
in \(X\) as \(R(x_i, X)\), the rank of \(y_i\) in \(Y\) as
\(R(y_i, Y)\).
Spearman's footrule is defined as the absolute distance between the ranked
values of \(X\) and \(Y\):
$$D(X,Y) = \sum_{i=1}^{n} |R(x_i, X) - R(y_i, Y)|.$$
Scaled Spearman's footrule is defined as:
$$D_{Scale}(X,Y) = 1 - 3D(X,Y)/(n^2-1).$$
When \(n\) is odd, \(D_{Scale}(X,Y) \in [-0.5,1]\), but when \(n\) is
even, \(D_{Scale}(X,Y) \in [-0.5\{1+3/(n^2-1)\},1]\) (Kendall, 1948).
The p-value of the independence test using Spearman's footrule, denoted
as \(p\), is computed using the normality approximation result in Diaconis, P., & Graham, R. L. (1977).
If pval = TRUE, bounds of the p-value, \(p_{l}, p_{u}\) will be
computed in the presence of missing data, such that \(p \in [p_{l}, p_{u}]\).
The independence test method proposed in Zeng et al., 2025 returns \(p_{u}\) as its p-value.
This method controls the Type I error regardless of the values of missing data.
See Zeng et al., 2025 for details.