Selects every k-th unit starting from a random position.
systematic(n, N)An integer vector of n selected indices (1 to N).
The sampling interval is k = N/n. A random start u is drawn from (0, k], then units at positions ceiling(u), ceiling(u + k), ceiling(u + 2k), ... are selected.
Properties:
Fixed sample size n
Equal inclusion probabilities: \(\pi = n/N\)
Very fast: O(n) time
Implicit stratification based on unit ordering
Note: Order of units matters. Sort by an auxiliary variable first to achieve implicit stratification.
srs() for simple random sampling,
up_systematic() for systematic sampling with unequal probabilities
# Basic usage
set.seed(42)
idx <- systematic(3, 12)
idx # e.g., c(2, 6, 10) - interval of 4
#> [1] 4 8 12
# Implicit stratification
df <- data.frame(
id = 1:100,
region = rep(1:10, each = 10)
)
df <- df[order(df$region), ]
idx <- systematic(10, 100)
table(df$region[idx])
#>
#> 1 2 3 4 5 6 7 8 9 10
#> 1 1 1 1 1 1 1 1 1 1