Arguments

A vector of length N that indicates which stratum each unit belongs to.

clusters

A vector of length N that indicates which cluster each unit belongs to.

n

Use for a design in which n units (or clusters) are sampled. In a stratified design, exactly n units in each stratum will be sampled. (optional)

prob

Use for a design in which either floor(N*prob) or ceiling(N*prob) units (or clusters) are sampled. The probability of being sampled is exactly prob because with probability 1-prob, floor(N*prob) units (or clusters) will be sampled and with probability prob, ceiling(N*prob) units (or clusters) will be sampled. prob must be a real number between 0 and 1 inclusive. (optional)

strata_n

Use for a design in which strata_n describes the number of units to sample within each stratum.

strata_prob

Use for a design in which strata_prob describes the probability of being sampled within each stratum. Differs from prob in that the probability of being sampled can vary across strata.

simple

logical, defaults to FALSE. If TRUE, simple random sampling is used. When simple = TRUE, please do not specify n or strata_n.

check_inputs

logical. Defaults to TRUE.

strata_var

deprecated

clust_var

deprecated

Value

A list of class "declaration". The list has five entries:
$rs_function, a function that generates random samplings according to the declaration.
$rs_type, a string indicating the type of random sampling used
$probabilities_vector, A vector length N indicating the probability of being sampled.
$strata, the stratification variable.
$clusters, the clustering variable.

Examples

# The declare_rs function is used in three ways:# 1. To obtain some basic facts about a sampling procedure:declaration<-declare_rs(N=100, n=30)
declaration