Skip to contents

Simulate population data for given input fields

Usage

simulate_population(
  x,
  age = NULL,
  obesity = NULL,
  exposure = NULL,
  simulated_css = NULL,
  ...
)

Arguments

x

GeoTox object.

age

input x to function simulate_age. After simulating ages, the inhalation rate is subsequently calculated using simulate_inhalation_rate.

obesity

input x to function simulate_obesity.

exposure

input x to function simulate_exposure.

simulated_css

input simulated_css to functions sample_Css and get_fixed_css.

...

additional arguments passed to other functions. See details.

Value

The same object with simulated fields added.

Details

Additional parameters include n for sample size, IR_params for simulate_inhalation_rate, obes_prev, obes_sd, and obes_label for simulate_obesity, and expos_mean, expos_sd, and expos_label for simulate_exposure.

Examples

# Use a subset of the package data for demonstration purposes
set.seed(2357)
n <- 10 # Population size
m <- 5 # Number of regions
idx <- if (m < 100) sample(1:100, m) else 1:100

# Create GeoTox object
geoTox <- GeoTox() |>
  # Simulate populations for each region
  simulate_population(age = split(geo_tox_data$age, ~FIPS)[idx],
                      obesity = geo_tox_data$obesity[idx, ],
                      exposure = split(geo_tox_data$exposure, ~FIPS)[idx],
                      simulated_css = geo_tox_data$simulated_css,
                      n = n)