S.SI: Simple Random Sampling Without Replacement

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

View source: R/S.SI.r

Description

Draws a simple random sample without replacement of size n from a population of size N

Usage

1
S.SI(N, n, e=runif(N))

Arguments

N

Population size

n

Sample size

e

By default, a vector of size N of independent random numbers drawn from the Uniform(0,1)

Details

The selected sample is drawn according to a selection-rejection (list-sequential) algorithm

Value

The function returns a vector of size N. Each element of this vector indicates if the unit was selected. Then, if the value of this vector for unit k is zero, the unit k was not selected in the sample; otherwise, the unit was selected in the sample.

Author(s)

Hugo Andres Gutierrez Rojas hagutierrezro@gmail.com

References

Sarndal, C-E. and Swensson, B. and Wretman, J. (1992), Model Assisted Survey Sampling. Springer.
Fan, C.T., Muller, M.E., Rezucha, I. (1962), Development of sampling plans by using sequential (item by item) selection techniques and digital computer, Journal of the American Statistical Association, 57, 387-402.
Gutierrez, H. A. (2009), Estrategias de muestreo: Diseno de encuestas y estimacion de parametros. Editorial Universidad Santo Tomas.

See Also

E.SI

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
27
28
############
## Example 1
############
# Vector U contains the label of a population of size N=5
U <- c("Yves", "Ken", "Erik", "Sharon", "Leslie")
# Fixes the random numbers in order to select a sample
# Ideal for teaching purposes in the blackboard
e <- c(0.4938, 0.7044, 0.4585, 0.6747, 0.0640)
# Draws a simple random sample without replacement of size n=3
sam <- S.SI(5,3,e)
sam
# The selected sample is
U[sam]

############
## Example 2
############
# Uses the Marco and Lucy data to draw a random sample according to a SI design
data(Marco)
data(Lucy)

N <- dim(Lucy)[1]
n <- 400
sam<-S.SI(N,n)
# The information about the units in the sample is stored in an object called data
data <- Lucy[sam,]
data
dim(data)

psirusteam/TeachingSampling documentation built on April 23, 2020, 8:31 p.m.