R/study_population.R
get_study_population.Rd
Simulate single population with given network structure using data.table
get_study_population(
network_handler = sim_block_network,
network_handler_args,
group_names,
p_visible,
add_groups
)
function that takes several arguments and returns igraph network object with vertex attribute type
in the binary coded format (consists of 0's and 1's only)
list of arguments passed to network_handler
character vector of groups within population with last group being hidden
named list of visibility tendencies by group. This is used as mean of Beta distribution (with SD = 0.09) to generate probability of being recognized as member of group, being sampled as seed, etc. The order of objects in list have to follow the order of group_names
named list of probabilities of additional group memberships. Examples include probability of service utilization (for service multiplier), being present at particular time-location (for TLS), etc.
Population data frame for single study
if (FALSE) {
get_study_population_dt(
network_handler = sim_block_network,
network_handler_args =
list(N = 1000, K = 2, prev_K = c(known = .1, hidden = .2), rho_K = 0,
p_edge_within = list(known = c(0.1, 0.1), hidden = c(0.1, 0.3)),
p_edge_between = list(known = 0.02, hidden = 0.02),
directed = FALSE),
# groups
group_names = c("known", "hidden"),
# probability of visibility (show-up) for each group
p_visible = list(known = 1, hidden = .5),
# probability of service utilization in hidden population
# for service multiplier
add_groups =
list(
service_use = "rbinom(.N, 1, 0.25)",
"paste0('loc_', 1:10) := lapply(rep(.2, times = 10), function(add) rbinom(.N, 1, 0.05 + hidden * add))",
known_2 = 0.3,
"paste0('known_', 3:10) := lapply(3:10, function(x) rbinom(.N, 1, 0.3))")
)
}