# Simulate catchment area
catch_df <- catchment_sim(4, 5, shape = 2.5, rate = 1.3)
# Simulate elementary schools using default gamma distribution
elementary_df <- elementary_pop(catch_df, shape = 3.3, rate = 0.015)
# Simulate households with children
house_children <- subpop_children(elementary_df, n = 2,
prop_parent_couple = 0.7,
prop_children_couple = c(0.3, 0.5, 0.2),
prop_children_lone = c(0.4, 0.4, 0.2),
prop_elem_age = 0.6)
# Using custom distributions
house_children2 <- subpop_children(elementary_df, n = 3,
prop_parent_couple = 0.7,
prop_children_couple = c(0.3, 0.5, 0.2),
prop_children_lone = c(0.4, 0.4, 0.2),
prop_elem_age = 0.6,
parent_dist = stats::rnorm, mean = 0.5, sd = 0.1,
child_dist = stats::rbeta, shape1 = 2, shape2 = 2,
age_dist = stats::runif)
Run the code above in your browser using DataLab