Learn R Programming

asbio (version 0.3-1)

runSampDesign: Plots of random sampling designs

Description

Compares outcomes of simple random sampling, stratified random sampling and cluster sampling

Usage

runSampDesign(n = 20)

Arguments

n
The number of samples to be randomly selected from a population of 400.

Value

  • A plot is returned with four subplots. (a) shows the population before sampling, (b) shows simple random sampling, (c) shows stratified random sampling, (d) shows cluster sampling.

Details

Returns a plot comparing outcomes of random sampling, stratified random sampling and cluster sampling from a population of size 400. For stratified random sampling the population is subdivided into four equally strata of size 100. and n/4 samples are taken within each strata. For cluster sampling the population is subdivided into four equally sized clusters and a census is taken from two clusters (regardless of specification of n).

Examples

Run this code
runSampDesign(20)
#Not run
#Animated demonstration
r<-rep(20,100)
for(i in 1:100){ 
runSampDesign(r[i])
Sys.sleep(.5)
}

Run the code above in your browser using DataLab