SampleSystematic: Simple and stratified systematic sampling

Description Usage Arguments Details Value References See Also Examples

View source: R/SampleSystematic.R

Description

Select sampling units using simple or stratified systematic samplin. In the context of two-stage cluster sampling, select Secondary Sampling Units (SSU) in one or more Primary Sampling Units (PSU), using systematic sampling.

Usage

1
2
SampleSystematic(psu.ssu = NULL, su = NULL, N = NULL,
  write = FALSE, ...)

Arguments

psu.ssu

data.frame with all PSU. First column contains PSU unique identifiers. Second column contains numeric PSU sizes. It is used only for the second stage of a two-stage cluster design (see details).

su

numeric indicating the number of sampling units to be selected. If su has more than one element, stratified sampling is applied and psu.ssu is ignored (see details).

N

numeric indicating the number of sampling units in the population. It is intended for simple or stratified sampling designs and when used, psu.ssu is ignored (see details).

write

logical. If TRUE, a *.csv file containing the PSU and their SSU is writed in the current working directory.

...

further arguments passed to write.table function.

Details

When N is defined, psu.ssu is ignored. If N has one element, su must too and the result is a simple systematic selection. If N has more than one element, su must have the same number of elements and each oredered pair represent an strata. Thus, when N has more than one element, the result is a stratified sampling with systematic selection within each strata (see examples).

Value

A matrix. For the second stage in a two-stage cluster sampling, the names of columns are the identifiers of selected psu, coerced by as.character to avoid scientific notation in case the identifiers be of class numeric. The rows correspond to the selected SSU within each PSU. For simple systematic sampling, the rows correspond to the selected sampling units. For stratified sampling, each column represent an strata and the rows correspond to the selected sampling units in each strata.

References

Levy P and Lemeshow S (2008). Sampling of populations: methods and applications, Fourth edition. John Wiley and Sons, Inc.

Baquero, O. S., Marconcin, S., Rocha, A., & Garcia, R. D. C. M. (2018). Companion animal demography and population management in Pinhais, Brazil. Preventive Veterinary Medicine.

http://oswaldosantos.github.io/capm

See Also

SamplePPS.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
data(psu_ssu)

## Two-stage cluster sampling
selected_psu <- SamplePPS(psu.ssu = psu_ssu, psu = 10)

# Take a systematic sampling of 5 SSU within each selected PSU.
SampleSystematic(selected_psu, 5, write = FALSE)

## Simple systematic sampling
SampleSystematic(su = 5, N = 100)

## Stratified systematic sampling
SampleSystematic(su = c("urban" = 50, "rural" = 10),
                 N = c("urban" = 4000, "rural" = 150))

Example output

     411915205000134 411915205000004 411915205000021 411915205000006
[1,]              11               9               5               6
[2,]              39              53              67              53
[3,]              67              97             129             100
[4,]              95             141             191             147
[5,]             123             185             253             194
     411915205000043 411915205000081 411915205000092 411915205000073
[1,]              45              10              65              69
[2,]             101              50             142             158
[3,]             157              90             219             247
[4,]             213             130             296             336
[5,]             269             170             373             425
     411915205000118 411915205000022
[1,]              19              24
[2,]              59              67
[3,]              99             110
[4,]             139             153
[5,]             179             196
     [,1]
[1,]    8
[2,]   28
[3,]   48
[4,]   68
[5,]   88
      urban rural
 [1,]    70    11
 [2,]   150    26
 [3,]   230    41
 [4,]   310    56
 [5,]   390    71
 [6,]   470    86
 [7,]   550   101
 [8,]   630   116
 [9,]   710   131
[10,]   790   146
[11,]   870    NA
[12,]   950    NA
[13,]  1030    NA
[14,]  1110    NA
[15,]  1190    NA
[16,]  1270    NA
[17,]  1350    NA
[18,]  1430    NA
[19,]  1510    NA
[20,]  1590    NA
[21,]  1670    NA
[22,]  1750    NA
[23,]  1830    NA
[24,]  1910    NA
[25,]  1990    NA
[26,]  2070    NA
[27,]  2150    NA
[28,]  2230    NA
[29,]  2310    NA
[30,]  2390    NA
[31,]  2470    NA
[32,]  2550    NA
[33,]  2630    NA
[34,]  2710    NA
[35,]  2790    NA
[36,]  2870    NA
[37,]  2950    NA
[38,]  3030    NA
[39,]  3110    NA
[40,]  3190    NA
[41,]  3270    NA
[42,]  3350    NA
[43,]  3430    NA
[44,]  3510    NA
[45,]  3590    NA
[46,]  3670    NA
[47,]  3750    NA
[48,]  3830    NA
[49,]  3910    NA
[50,]  3990    NA

capm documentation built on Oct. 30, 2019, 9:52 a.m.