Learn R Programming

capm (version 0.14.0)

SampleSystematic: Simple and stratified systematic sampling

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

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.

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.

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).

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

Run this code
# NOT RUN {
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))
# }

Run the code above in your browser using DataLab