Learn R Programming

animation (version 0.2-0)

sample.strat: Demonstration for stratified sampling

Description

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

Usage

sample.strat(pop = ceiling(10 * runif(10, 0.5, 1)), 
    size = ceiling(pop * runif(length(pop), 0, 0.5)), 
    control = ani.control(interval = 0.2), ...)

Arguments

pop
a vector for the size of each stratum in the population.
size
a corresponding vector for the sample size in each stratum (recycled if necessary).
control
control parameters for the animation; see ani.control
...
other arguments passed to ani.control

Value

  • None (invisible `NULL').

References

Cochran, W G (1977) Sampling Techniques, Wiley, ISBN 0-471-16240-X

See Also

sample

Examples

Run this code
sample.strat()

# HTML animation page
ani.start()
sample.strat(pop = sample(15, 5), saveANI = TRUE)
ani.stop()

Run the code above in your browser using DataLab