S.WR {TeachingSampling} | R Documentation |
Draws a simple random sample witht replacement of size $m$ from a population of size $N$
S.WR(N, m)
N |
Population size |
m |
Sample size |
The selected sample is drawn according to a sequential procedure algorithm based on a binomial distribution
The function returns a vector of size m. Each element of this vector indicates the unit that was selected.
Hugo Andrés Gutiérrez Rojas hugogutierrez@usantotomas.edu.co
Till'e, Y. (2006), Sampling Algorithms. Springer.
Guti'errez, H. A. (2009), Estrategias de muestreo: Dise~no de encuestas y estimaci'on de par'ametros.
Editorial Universidad Santo Tom'as.
############ ## Example 1 ############ # Vector U contains the label of a population of size N=5 U <- c("Yves", "Ken", "Erik", "Sharon", "Leslie") # Draws a simple random sample witho replacement of size m=3 sam <- S.WR(5,3) sam # The selected sample U[sam] ############ ## Example 2 ############ # Uses the Marco and Lucy data to draw a random sample of units accordind to a # simple random sampling with replacement design data(Marco) data(Lucy) N <- dim(Marco)[1] m <- 400 sam<-S.WR(N,m) # The information about the units in the sample is stored in an object called data data <- Lucy[sam,] data dim(data)