S.BE: Bernoulli Sampling Without Replacement

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

View source: R/S.BE.r

Description

Draws a Bernoulli sample without replacement of expected size $n$ from a population of size $N$

Usage

1
S.BE(N, prob)

Arguments

N

Population size

prob

Inclusion probability for each unit in the population

Details

The selected sample is drawn according to a sequential procedure algorithm based on an uniform distribution. The Bernoulli sampling design is not a fixed sample size one.

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.
Gutierrez, H. A. (2009), Estrategias de muestreo: Diseno de encuestas y estimacion de parametros. Editorial Universidad Santo Tomas.
Tille, Y. (2006), Sampling Algorithms. Springer.

See Also

E.BE

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
############
## Example 1
############
# Vector U contains the label of a population of size N=5
U <- c("Yves", "Ken", "Erik", "Sharon", "Leslie")
# Draws a Bernoulli sample without replacement of expected size n=3
# The inlusion probability is 0.6 for each unit in the population
sam <- S.BE(5,0.6)
sam
# The selected sample is
U[sam]

############
## Example 2
############
# Uses the Lucy data to draw a Bernoulli sample

data(Lucy)
attach(Lucy)
N <- dim(Lucy)[1]
# The population size is 2396. If the expected sample size is 400
# then, the inclusion probability must be 400/2396=0.1669
sam <- S.BE(N,0.01669)
# The information about the units in the sample is stored in an object called data
data <- Lucy[sam,]
data
dim(data)

Example output

     [,1]
[1,]    0
[2,]    2
[3,]    0
[4,]    0
[5,]    5
[1] "Ken"    "Leslie"
         ID Ubication  Level Zone Income Employees Taxes SPAM
38    AB038     c1k38  Small    A    462        84   9.0  yes
95   AB1151     c1k95  Small    A    490        98  10.5  yes
109  AB1241     c2k10  Small    B    428        61   8.0   no
110   AB125     c2k11  Small    B    211        26   1.0  yes
264  AB1461     c3k66  Small    B    268        84   3.0  yes
293  AB1488     c3k95  Small    B    209        30   1.0  yes
336  AB1527     c4k39  Small    B    206        53   1.0   no
337  AB1528     c4k40  Small    B    235        51   2.0   no
350   AB154     c4k53  Small    B     82        73   0.5  yes
351  AB1540     c4k54  Small    B    300        82   3.0   no
377  AB1564     c4k80  Small    B    300        66   3.0   no
389  AB1575     c4k92  Small    B    273        16   3.0  yes
483  AB1660     c5k87  Small    B    244        75   2.0  yes
545  AB1717     c6k50  Small    B    140        59   0.5   no
554  AB1725     c6k59  Small    B    130        74   0.5   no
588  AB1756     c6k93  Small    B    141        27   0.5  yes
622  AB1787     c7k28  Small    B      9        37   0.5  yes
652  AB1814     c7k58  Small    B     86        77   0.5   no
666  AB1827     c7k72  Small    B    160        56   1.0  yes
732  AB1887     c8k39  Small    C    350        25   5.0   no
822  AB1975     c9k30  Small    C    420        36   8.0  yes
831  AB1983     c9k39  Small    C    440        94   8.0  yes
1102 AB2278    c12k13  Small    C    374        14   6.0  yes
1133  AB231    c12k44  Small    C     42        57   0.5   no
1141 AB2317    c12k52  Small    C    433        97   8.0  yes
1144  AB232    c12k55  Small    C     87         9   0.5  yes
1227  AB248    c13k39  Small    C    117        18   0.5  yes
1277  AB298    c13k89  Small    C    153         7   1.0   no
1304  AB325    c14k17  Small    C    172        16   1.0   no
1364  AB385    c14k77  Small    C    214        38   1.0   no
1431  AB452    c15k45  Small    C    186        60   1.0  yes
1464  AB485    c15k78  Small    C    237        23   2.0  yes
1535  AB556    c16k50  Small    C    237        31   2.0  yes
1547  AB568    c16k62  Small    C    304        38   4.0  yes
1564  AB730    c16k79  Small    D    420       101   8.0  yes
1607  AB102    c17k23 Medium    A    550        67  14.0  yes
1676 AB1095    c17k92 Medium    A    986       124  46.0  yes
1755 AB1186    c18k72 Medium    A    990       145  47.0   no
1864 AB1318    c19k82 Medium    B    511       104  12.0  yes
1916 AB2140    c20k35 Medium    C    520        92  12.0  yes
1928 AB2222    c20k47 Medium    C    590        91  16.0   no
2001  AB625    c22k21 Medium    D    630        80  20.0  yes
2044  AB678    c22k64 Medium    D    550        31  14.0  yes
2075  AB711    c22k95 Medium    D    630        71  20.0   no
2162  AB819    c23k83 Medium    D    620        70  19.0  yes
2204  AB867    c24k26 Medium    E    546        34  14.0  yes
2223  AB888    c24k45 Medium    E    770        89  29.0   no
2237  AB909    c24k59 Medium    E    577        49  15.0  yes
2255  AB929    c24k77 Medium    E    758        48  29.0  yes
2386  AB916    c26k10    Big    E   1161       157  62.0   no
[1] 50  8

TeachingSampling documentation built on April 22, 2020, 1:05 a.m.