Skip to main page content
U.S. flag

An official website of the United States government

Dot gov

The .gov means it’s official.
Federal government websites often end in .gov or .mil. Before sharing sensitive information, make sure you’re on a federal government site.

Https

The site is secure.
The https:// ensures that you are connecting to the official website and that any information you provide is encrypted and transmitted securely.

Access keys NCBI Homepage MyNCBI Homepage Main Content Main Navigation
. 2025 Feb 10;44(3-4):e10326.
doi: 10.1002/sim.10326.

Between- and Within-Cluster Spearman Rank Correlations

Affiliations

Between- and Within-Cluster Spearman Rank Correlations

Shengxin Tu et al. Stat Med. .

Abstract

Clustered data are common in practice. Clustering arises when subjects are measured repeatedly, or subjects are nested in groups (e.g., households, schools). It is often of interest to evaluate the correlation between two variables with clustered data. There are three commonly used Pearson correlation coefficients (total, between-, and within-cluster), which together provide an enriched perspective of the correlation. However, these Pearson correlation coefficients are sensitive to extreme values and skewed distributions. They also vary with data transformation, which is arbitrary and often difficult to choose, and they are not applicable to ordered categorical data. Current nonparametric correlation measures for clustered data are only for the total correlation. Here we define population parameters for the between- and within-cluster Spearman rank correlations. The definitions are natural extensions of the Pearson between- and within-cluster correlations to the rank scale. We show that the total Spearman rank correlation approximates a linear combination of the between- and within-cluster Spearman rank correlations, where the weights are functions of rank intraclass correlations of the two random variables. We also discuss the equivalence between the within-cluster Spearman rank correlation and the covariate-adjusted partial Spearman rank correlation. Furthermore, we describe estimation and inference for the three Spearman rank correlations, conduct simulations to evaluate the performance of our estimators, and illustrate their use with data from a longitudinal biomarker study and a clustered randomized trial.

Keywords: clustered data; nonparametric correlation measures; rank association measures.

PubMed Disclaimer

Conflict of interest statement

The authors declare no conflicts of interest.

Figures

FIGURE 1
FIGURE 1
Toy examples for the relationship between total (γt), between‐cluster (γb), within‐cluster (γw) Spearman rank correlations, and the rank intraclass correlations (γIX, γIY). Subfigures (a)‐(f) correspond to 6 different data generating scenarios. For illustration purposes, we show five clusters and five (two for [f]) observations to represent the distribution of each cluster. Black dots represent cluster medians, and the other symbols represent the five clusters. The solid lines show the direction of the within‐cluster correlation and the dashed lines show the direction of the between‐cluster correlation.
FIGURE 2
FIGURE 2
Bias and coverage of 95% confidence intervals for our estimators of γb, γw, and γt at different true values and different cluster sizes under Scenarios I (normality) and II (exponentiated Y). The circle sign stands for the approximation‐based estimator (γ^bA) of γb, and the plus sign stands for the cluster‐median‐based estimator (γ^bM) of γb. The number of clusters was set at 100. “1–50” means the cluster size follows a uniform distribution from 1 to 50. When γb,γw,γt=(0.79,0.68,0.05) and cluster sizes are 10 or 1–50, γ^bM had negative bias greater than 0.05 and poor coverage below 75% (not shown in the figure due to out of bounds). For specific bias and coverage values of γ^bA and γ^bM, please refer to Web Table 1.
FIGURE 3
FIGURE 3
Scatter plot of CD4 and CD8 counts (cells/mm3) and estimates of within‐, between‐cluster, and total Pearson (ρw, ρb, ρt) correlations. The red cross sign represents the sample cluster median and the circle sign represents the observation. The estimates (95% confidence intervals) of within‐, between‐cluster, and total Spearman rank correlations are invariant to data transformations, γ^w=0.53[0.51,0.55], γ^bM=0.24[0.20,0.29], γ^bA=0.21[0.17,0.26], and γ^t=0.29[0.25,0.32], where γ^bM is the estimator of γb based on cluster medians obtained from CPM and γ^bA is the estimator of γb based on the linear approximation.
FIGURE 4
FIGURE 4
Scatter plots of PHQ‐9 scores, age at enrollment (years), HIV knowledge, HIV stigma, and 12‐month adherence (%) of female and male partners enrolled in the clustered randomized clinical trial. The red cross sign represents the sample cluster median and the dot sign represents the observation. The right side of each subfigure shows the estimates (95% confidence intervals) of within‐cluster, between‐cluster, and total Spearman rank correlations (γ^w, γ^bM, γ^bA, and γ^t), where γ^bM is the estimator of γb based on cluster medians obtained from CPM and γ^bA is the estimator of γb based on the linear approximation.

References

    1. Snijders T. and Bosker R., Multilevel Analysis: An Introduction to Basic and Advanced Multilevel Modeling (London: Sage Publishers, 1999).
    1. Ferrari P., Al‐Delaimy W. K., Slimani N., et al., “An Approach to Estimate Between‐ and Within‐Group Correlation Coefficients in Multicenter Studies: Plasma Carotenoids as Biomarkers of Intake of Fruits and Vegetables,” American Journal of Epidemiology 162, no. 6 (2005): 591–598. - PubMed
    1. Castilho J., Shepherd B., Koethe J., et al., “CD4+/CD8+ Ratio, Age, and Risk of Serious Noncommunicable Diseases in HIV‐Infected Adults on Antiretroviral Therapy,” Aids 30, no. 6 (2016): 899–908. - PMC - PubMed
    1. Spearman C., “The Proof and Measurement of Association between Two Things,” Journal of Psychopathology and Clinical Science 15, no. 1 (1904): 72–101.
    1. Kendall M. G., “A New Measure of Rank Correlation,” Biometrika 30, no. 1–2 (1938): 81–89.

LinkOut - more resources