S.WR: Simple Random Sampling With Replacement

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Draws a simple random sample witht replacement of size m from a population of size N

Usage

1
S.WR(N, m)

Arguments

N

Population size

m

Sample size

Details

The selected sample is drawn according to a sequential procedure algorithm based on a binomial distribution

Value

The function returns a vector of size m. Each element of this vector indicates the unit that was selected.

Author(s)

Hugo Andres Gutierrez Rojas hugogutierrez@usantotomas.edu.co

References

Tille, Y. (2006), Sampling Algorithms. Springer.
Gutierrez, H. A. (2009), Estrategias de muestreo: Diseno de encuestas y estimacion de parametros. Editorial Universidad Santo Tomas.

See Also

E.WR

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
############
## 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 Lucy data to draw a random sample of units accordind to a
# simple random sampling with replacement design
data(Lucy)
attach(Lucy)

N <- dim(Lucy)[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)

damarals/TeachingSampling documentation built on June 2, 2019, 9:06 p.m.