Learn R Programming

capm (version 0.9.1)

Calculate2StageSampleSize: Two-stage cluster sampling size and composition

Description

Calculates sample size and composition for a two-stage cluster sampling design to estimate a total.

Usage

Calculate2StageSampleSize(psu.ssu = NULL, psu.x = NULL, conf.level = 0.95, error = 0.1, cost = 4, minimum.ssu = 15)

Arguments

psu.ssu
data.frame with all primary sampling units (PSU). First column contains PSU unique identifiers. Second column contains numeric PSU sizes.
psu.x
data.frame. Each row corresponds to a secondary sampling unit (SSU) surveyed in a pilot study. First column contains the PSU identifiers to which the ssu belongs to. Second column contains the totals observed in the ssu and must be numeric.
conf.level
the confidence level required. It must be numeric between 0 and 1 inclusive.
error
the maximum relative difference between the estimate and the unknown population value. It must be numeric between 0 and 1 inclusive.
cost
the ratio of the cost of sampling a PSU to the cost of sampling a SSU.
minimum.ssu
integer to define the minimum number of SSU to be selected per PSU. If the calculated number of SSU to be selected is lesser than minimum.ssu, it is redefined as minimum.ssu. To avoid any lower threshold, define minimum.ssu as equal to 0.

Value

Matrix with the sample size and composition and with variability estimates.

Details

It is assumed that psu from the pilot are selected with probability proportional to size (PPS) and with replacement. ssu are assumed to be selected via simple (systematic) random sampling.

PSU must have the same identifiers in psu.ssu and in psu.x.

References

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

http://oswaldosantos.github.io/capm

Examples

Run this code
# Load data with psu identifiers and sizes.
data(psu.ssu)

# Load data from a pilot sample.
data(pilot)

# Calculate sample size and composition.
(sample.sc <- Calculate2StageSampleSize(psu.ssu, pilot, conf.level = 0.95, error = 0.1, cost = 4))

Run the code above in your browser using DataLab