---
title: 'generalRSS: Ranked Set Sampling Package'
url: https://www.emergentmind.com/topics/generalrss
type: topic
---

# generalRSS: Ranked Set Sampling Package

Searching arXiv for the specific topic and closely related ranked set sampling work to ground the article in current literature.
generalRSS is an R package for sampling and inference under balanced ranked set sampling (BRSS) and unbalanced ranked set sampling (URSS). In this context, RSS denotes ranked set sampling rather than syndication or radio signal strength. The package is designed for settings in which measuring the study variable \(Y\) is expensive but an auxiliary variable \(X\) is cheap and sufficiently correlated with \(Y\) to permit ranking. Its stated contribution is to extend RSS software beyond balanced designs by supporting RSS data generation, efficient URSS allocation strategies, and inferential procedures for means, medians, proportions, and two-sample area under the curve (AUC), with medical illustrations based on NHANES data [2509.02039].

## 1. Ranked set sampling as a stratified design

Ranked set sampling is presented in contrast to simple random sampling (SRS). Under SRS, one draws \(n\) units at random, measures \(Y\) on all \(n\) units, and uses \(\bar{Y}\) to estimate the population mean. RSS modifies this workflow by repeatedly drawing sets of size \(H\), ranking units within each set using the auxiliary variable \(X\), and measuring \(Y\) on only one unit from each ranked set. The resulting design is stratified by rank. A standard RSS dataset is written as
\[
\{(y_i, h_i, r_i), i=1,2,\dots,n\},
\]
where \(y_i\) is the measured outcome, \(h_i \in \{1,\dots,H\}\) is the rank stratum, and \(r_i\) is the set size, usually \(r_i=H\) [2509.02039].

The package description emphasizes that RSS gains efficiency by using auxiliary information for ranking and stratification. The intuitive mechanism is variance reduction: units within a given rank stratum are more homogeneous in \(Y\) than a generic SRS draw, provided ranking quality is adequate. The common mean estimator under RSS is
\[
\widehat{\mu}_{\mathrm{RSS}} = \frac{1}{H} \sum_{h=1}^H \bar{Y}_{[h]}, 
\qquad
\bar{Y}_{[h]} = \frac{1}{n_h}\sum_{r=1}^{n_h} Y_{[h],r},
\]
and its variance is estimated by
\[
\widehat{\sigma}^2_{\widehat{\mu}_{\mathrm{RSS}}}
=
\frac{1}{H^2} \sum_{h=1}^H \frac{1}{n_h(n_h - 1)}
\sum_{r=1}^{n_h} \left(Y_{[h],r} - \bar{Y}_{[h]}\right)^2.
\]
Under suitable conditions, the estimator is unbiased for the population mean, and the package uses the corresponding asymptotic normal approximation for testing and interval estimation [2509.02039].

The formulation adopted by generalRSS treats rank strata as the fundamental analytic units. A cycle is one pass through all ranks \(1,\dots,H\). In balanced designs each cycle contributes exactly one measured observation to every stratum; in unbalanced designs strata can receive unequal numbers of measurements. This distinction is central to the package’s scope.

## 2. Balanced and unbalanced ranked set sampling

BRSS assumes equal allocation across rank strata:
\[
n_h = m \quad \text{for all } h=1,\dots,H,
\]
so the total sample size is \(n = Hm\). For \(H=3\), one cycle consists of three separate sets of size three, from which the smallest, middle, and largest ranked units are measured in turn. After \(m\) cycles, each rank stratum contains \(m\) observations [2509.02039].

URSS relaxes this symmetry and allows
\[
n_h \text{ to differ across } h,
\qquad
n = \sum_{h=1}^H n_h.
\]
The paper describes URSS through incomplete cycles: strata that have reached their target allocation drop out, while remaining strata continue to be sampled. For \(H=3\) with \(n_1<n_2<n_3\), ranks \(1,2,3\) are initially sampled together; after stratum 1 reaches \(n_1\), only ranks 2 and 3 are sampled; after stratum 2 reaches \(n_2\), only rank 3 continues [2509.02039].

The package positions URSS as particularly effective for skewed distributions. The rationale given is that variances can differ substantially across rank strata, so equal allocation need not be efficient. This suggests a direct analogy with classical stratified sampling: if strata contribute unequally to estimator variance, optimal or near-optimal designs should oversample the more informative ranks. In the paper’s framing, URSS is therefore not merely a relaxation of BRSS but a design class with its own allocation theory and inferential machinery.

## 3. Package structure and implemented functionality

generalRSS separates design, simulation, and inference. The package explicitly supports both continuous and binary outcomes, and it distinguishes between functions that operate on explicit populations and functions that simulate RSS data from parametric models [2509.02039].

| Function group | Functions | Stated role |
|---|---|---|
| Sampling and simulation | `rss.sampling`, `rss.simulation`, `rss.prop.sampling`, `rss.prop.simulation` | Generate BRSS or URSS data for continuous or binary outcomes |
| Allocation design | `rss.design` | Compute efficient URSS allocations for mean or proportion settings |
| Inference | `rss.z.test`, `rss.t.test`, `rss.ELR.test`, `rss.sign.test`, `rss.prop.test`, `rss.AUC.test` | Mean, median, proportion, and AUC inference under RSS |

The paper contrasts this functionality with existing RSS software, naming `RSSampling`, `NSM3`, `RSStest`, and `RankedSetSampling` as packages that are essentially restricted to balanced designs or a narrower inferential range. generalRSS is described as addressing this limitation by extending support to URSS in data generation, allocation, and inference [2509.02039].

The simulation interface includes a ranking-quality parameter \(\rho\), with \(\rho=1\) corresponding to perfect ranking and lower values representing ranking error. The available parametric families named in the paper are normal, \(t\), and lognormal for continuous outcomes, and Bernoulli-type generation for binary outcomes. This makes the package a planning tool as well as an analysis tool: one can study design sensitivity to skewness, imperfect rankings, and unequal allocations before data collection.

## 4. Allocation theory for URSS

The package’s most distinctive methodological component is `rss.design`, which computes efficient URSS allocations. For mean estimation, the paper describes integer Neyman allocation, adjusted Neyman allocation, and LRC allocation. The classical Neyman principle is
\[
n_h \propto S_h,
\qquad
n_h = n \frac{S_h}{\sum_{j=1}^H S_j},
\]
where \(S_h\) is the within-stratum standard deviation. In practice, generalRSS estimates these quantities from RSS data and returns an integer allocation satisfying the target total sample size approximately [2509.02039].

The paper gives a concrete illustration using
```r
rss.data = rss.simulation(H=3, nsamp = c(3,10,5), dist="t",
                          rho=1, delta=0)
rss.design(rss.data)
```
which yields an original allocation \((3,10,5)\) and an Integer Neyman recommendation \((4,5,9)\). It then reports adjusted Neyman and LRC allocations:
\[
(4,10,9) \quad \text{and} \quad (6,10,10),
\]
respectively. The adjusted Neyman design is described as requiring minimal additional sampling while preserving improved efficiency relative to BRSS; the LRC design may require more augmentation [2509.02039].

For binary outcomes, `rss.design(..., prop = TRUE)` implements Neyman allocation for proportion estimation. The reported example
```r
rss.prop.data = rss.prop.simulation(H=3, nsamp=c(10,15,20), p=0.5)
rss.design(rss.prop.data, prop = TRUE)
```
returns a non-integer recommendation close to
\[
(12.45017,\ 19.36741,\ 13.18242).
\]
This reflects the package’s general strategy: unequal allocation is treated as an efficiency problem, not as a nuisance caused only by missing data.

## 5. Inferential procedures

The mean-based procedures `rss.z.test` and `rss.t.test` use the estimator \(\widehat{\mu}_{\mathrm{RSS}}\) and its estimated variance. The asymptotic pivot reported for the \(z\)-procedure is
\[
\frac{\widehat{\mu}_{\mathrm{RSS}} - \mu_0}
{\widehat{\sigma}_{\widehat{\mu}_{\mathrm{RSS}}}}
\overset{d}{\longrightarrow}
N(0,1),
\]
while `rss.t.test` provides a small-sample alternative with estimated degrees of freedom [2509.02039].

For one-sample mean inference, the package also implements empirical likelihood through `rss.ELR.test`. The paper states that the resulting empirical likelihood ratio statistic \(-2\log \mathrm{LR}\) is asymptotically \(\chi^2_1\). This places generalRSS within the semiparametric empirical-likelihood literature rather than restricting it to normal approximations.

Median inference is handled by `rss.sign.test`. For BRSS the sign statistic is
\[
S_{\mathrm{RSS}}^{+} = \sum_{i=1}^n I(y_i - M_0 > 0),
\]
with asymptotic distribution
\[
n^{-1/2}\left(S_{\mathrm{RSS}}^{+} - \frac{n}{2}\right)
\overset{d}{\longrightarrow}
N\left(0,\frac{\eta^2}{4}\right),
\]
where
\[
\eta^{2}=1-\frac{4}{H}\sum_{h=1}^{H}\left\{ B\left(h,H-h+1,\frac{1}{2}\right)-\frac{1}{2}\right\}^{2}.
\]
For URSS, the paper gives the asymptotic form
\[
S_{\mathrm{RSS}}^{+} - \sum_{h=1}^H n_h (1-\beta_h)
\overset{d}{\longrightarrow}
N\left(0,\sum_{h=1}^H n_h \beta_h (1-\beta_h)\right),
\]
with \(\beta_h = B(h,H-h+1,1/2)\) [2509.02039].

For binary outcomes, `rss.prop.test` uses
\[
\hat{p} = \frac{1}{H}\sum_{h=1}^H \frac{1}{n_h}\sum_{r=1}^{n_h} Y_{[h],r},
\]
and a variance estimator
\[
\widehat{\mathrm{Var}(\hat{p})}
=
\frac{1}{H^2}\sum_{h=1}^H \frac{1}{n_h}\hat{p}_h(1-\hat{p}_h),
\]
with
\[
\hat{p}_h = \sum_{l=H-h+1}^H \binom{H}{l}\hat{p}^l(1-\hat{p})^{H-l}.
\]
The corresponding confidence interval is
\[
\hat{p} \pm z_{1-\alpha/2}\sqrt{
\frac{1}{H^2}\sum_{h=1}^H \frac{1}{n_h}\hat{p}_h(1-\hat{p}_h)
}.
\]

Two-sample ROC analysis is supported through `rss.AUC.test`. The target parameter is
\[
\delta = P(Y_1 > Y_2),
\]
and the paper states that empirical-likelihood inference for AUC yields an asymptotic \(\chi^2_1\) likelihood-ratio statistic. This is one of the clearest examples of the package’s extension beyond mean estimation.

## 6. Medical data applications

The first application uses NHANES BMI data for one-sample mean inference. After removing duplicate IDs, the paper reports 6,779 unique individuals, a population mean BMI of \(26.48768\), and a BMI–Weight correlation of approximately \(0.903\). An intended BRSS design with \(H=3\) and allocation \((10,10,10)\) becomes URSS after missing BMI values, producing \((9,10,9)\). Applying `rss.t.test` to this observed URSS sample yields
\[
\widehat{\mu}_{\mathrm{RSS}} = 27.03478,
\]
with confidence interval
\[
[24.91328,\ 29.15628],
\]
of length approximately \(4.243\). After using `rss.design` and augmenting only the third rank stratum to obtain \((9,10,12)\), the updated analysis gives
\[
\widehat{\mu}_{\mathrm{RSS}} = 26.45867,
\]
with interval
\[
[24.46912,\ 28.44822],
\]
of length approximately \(3.979\). In a 500-replicate comparison, Original URSS, Updated RSS, and SRS yield coverage probabilities \(0.954\), \(0.954\), and \(0.944\), with CI lengths \(4.929\), \(4.665\), and \(5.933\), respectively [2509.02039].

The second application concerns two-sample AUC estimation for fasting plasma glucose in NHANES, using glycohemoglobin as the ranking variable and diabetes status as the grouping variable. The paper reports mean fasting plasma glucose \(100.4777\) for the non-diabetic group and \(156.5644\) for the diabetic group, with correlation approximately \(0.814\) between glycohemoglobin and fasting plasma glucose, and a population AUC around \(0.8861\). Under BRSS with \(H=3\) and \((10,10,10)\) in both groups, `rss.AUC.test` gives
\[
\widehat{\mathrm{AUC}} = 0.9211,
\]
with confidence interval
\[
[0.8157,\ 0.9743],
\]
of length about \(0.1586\). Under URSS with allocations \((5,10,15)\) for the non-diabetic group and \((15,10,5)\) for the diabetic group, the estimate becomes
\[
\widehat{\mathrm{AUC}} = 0.8804,
\]
with interval
\[
[0.7976,\ 0.9334],
\]
of length about \(0.1359\). A 500-replicate comparison reports coverage probabilities \(0.934\), \(0.930\), and \(0.930\) for URSS, BRSS, and SRS, with CI lengths \(0.171\), \(0.175\), and \(0.181\), respectively [2509.02039].

These examples are methodologically important because they illustrate two distinct uses of URSS. In the BMI study, URSS arises operationally from missingness in an intended BRSS design and is then improved by allocation adjustment. In the AUC study, URSS is chosen deliberately to oversample informative strata.

## 7. Methodological position and practical implications

generalRSS is situated as a package for both design and inference rather than as a narrow collection of test routines. Its stated contribution is to make URSS operational in ordinary data analysis by combining data generation, allocation optimization, and inferential procedures within one framework [2509.02039].

Several practical implications follow directly from the package design. First, BRSS is not treated as the universal default; URSS is presented as preferable when the distribution of \(Y\) is skewed, when rank-stratum variances differ, when missing data convert a balanced plan into an unbalanced sample, or when the inferential target is not the mean but a functional such as AUC. Second, the package assumes that ranking quality matters and therefore includes simulation support through the parameter \(\rho\). Third, the implemented procedures range from normal and \(t\)-based approximations to empirical likelihood, which permits both classical and semiparametric workflows.

The article’s broader statistical message is that ranked set sampling should be understood as a flexible stratified design class. Balanced and unbalanced schemes share the same rank-stratum logic, but they differ sharply in efficiency when auxiliary information is strong and outcome distributions are asymmetric. generalRSS formalizes that distinction in software by making unequal allocation a first-class design variable rather than a post hoc correction.

Source: https://www.emergentmind.com/topics/generalrss