View source: R/fit_setting_contacts.R
fit_setting_contacts | R Documentation |
fits a gam model for each setting on the survey population data & the
setting wise contact data. The underlying method is described in more
detail in fit_single_contact_model()
. The models can be fit in parallel,
see the examples. Note that this function is parallelisable with future
,
and will be impacted by any future
plans provided.
fit_setting_contacts(
contact_data_list,
population,
symmetrical = TRUE,
school_demographics = NULL,
work_demographics = NULL
)
contact_data_list |
A list of dataframes, each containing information
on the setting (home, work, school, other), age_from, age_to,
the number of contacts, and the number of participants. Example data
can be retrieved with |
population |
|
symmetrical |
whether to enforce symmetrical terms in the model.
Defaults to TRUE. See |
school_demographics |
(optional) defaults to census average proportion
at school. You can provide a dataset with columns, "age" (numeric), and
"school_fraction" (0-1), if you would like to specify these
details. See |
work_demographics |
(optional) defaults to census average proportion
employed. You can provide a dataset with columns, "age" (numeric), and
"work_fraction", if you would like to specify these details. See
|
list of fitted gam models - one for each setting provided
Nicholas Tierney
# These aren't being run as they take too long to fit
## Not run:
contact_model <- fit_setting_contacts(
contact_data_list = get_polymod_setting_data(),
population = get_polymod_population()
)
# can fit the model in parallel
library(future)
plan(multisession, workers = 4)
polymod_setting_data <- get_polymod_setting_data()
polymod_population <- get_polymod_population()
contact_model <- fit_setting_contacts(
contact_data_list = polymod_setting_data,
population = polymod_population
)
# you can specify your own population data for school and work demographics
contact_model_diff_data <- fit_setting_contacts(
contact_data_list = polymod_setting_data,
population = polymod_population,
school_demographics = conmat_original_school_demographics,
work_demographics = conmat_original_work_demographics
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.