Yihui Xie

sample.strat()

Demonstration of the stratified sampling

Yihui Xie & Lijia Yu / 2017-04-04


Each rectangle stands for a stratum, and the simple random sampling without replacement is performed within each stratum. The points being sampled are marked out (by red circles by default).

library(animation)
ani.options(nmax = 50)
par(mar = rep(1, 4), lwd = 2)
sample.strat(col = c("bisque", "white"))