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

sample_tls(
  data,
  sampling_variable = "tls",
  drop_nonsampled = FALSE,
  hidden_var = "hidden",
  target_n_clusters,
  target_cluster_type = c("prop", "fixed"),
  target_per_cluster,
  clusters
)

Arguments

data

pass-through population data frame

sampling_variable

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

drop_nonsampled

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

hidden_var

character string specifying hidden variable name (associated probability of visibility should be named p_visible_[hidden_var]). Defaults to "hidden" for the simulations

target_n_clusters

target number of clusters (time-locations). Clusters are always sampled proportionally to their size in terms of number of hidden population members

target_cluster_type

character string specifying the type of TLS sampling within each location. Either "prop" in which case target_per_cluster should give a share or "fixed" in which case target_per_cluster should be integer. Default is proportional sampling within clusters

target_per_cluster

numeric target for within cluster. Either share for proportional sampling or integer for fixed sampling. If in any cluster fixed number of units required for sampling is larger than the number of units in cluster, the whole cluster is sampled and the warning is produced

clusters

character string containing names of all locality names in the study population data frame

Value

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

[sampling_variable]

Sampling indicator

[sampling_variable]_cluster

Time-locations at which subject was encountered first

[sampling_variable]_loc_present

Sampled time-locations at which subject is present

[sampling_variable]_loc_sampled

Sampled time-locations at which subject was sampled

[sampling_variable]_locs_sampled

Sampled time-locations

[sampling_variable]_weight

Sampling weight without visibility

[sampling_variable]_weight_visible

Sampling weight with visibility