Sampling handler for drawing proportional sample with given characteristics from individual study population

sample_pps(
  data,
  sampling_variable = "pps",
  drop_nonsampled = FALSE,
  target_n_pps = 400,
  n_clusters = target_n_pps,
  sampling_frame = NULL,
  strata = NULL,
  cluster = NULL,
  weights_type = c("absolute", "relative")
)

Arguments

data

pass-through population data frame

sampling_variable

character string that is used as prefix for all variables generated by proportional sampling. Default is 'pps'

drop_nonsampled

logical indicating whether to drop units that are not sampled. Default is FALSE

target_n_pps

target size of proportional sample

n_clusters

number of clusters

sampling_frame

character vector containing all binary vectors identifying sampling frame

strata

character vector containing name(s) of stratifying variables. Currently not implemented

cluster

character vector containing name(s) of all cluster variables

weights_type

character string giving the type of weights to compute. Can be one of "absolute" or "relative". Currently only absolute weights are calculated

Value

Population or sample data frame for single study with PPS sample characteristics added

[sampling_variable]

Sampling indicator

[sampling_variable]_frame

Indicator for sampling frame (respondents with 0 cannot be enrolled)

[sampling_variable]_strata

ID of respondent's strata

[sampling_variable]_strata_prop

Proportion of sampling frame in the strata to which respondent belongs

[sampling_variable]_cluster

ID of respondent's cluster

[sampling_variable]_cluster_prop

Proportion of strata in the cluster to which respondent belongs

[sampling_variable]_weight

Sampling weights