Fit a contact model to a survey poulation
fit_setting_contacts.Rd
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.
Arguments
- contact_data_list
A list of dataframes, each containing informatio 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
get_polymod_setting_data()
.- population
conmat_population
object or dataset with columnslower.age.limit
andpopulation
. Example data can be retrieved withget_polymod_population()
.- symmetrical
whether to enforce symmetrical terms in the model. Defaults to TRUE. See
details
offit_single_contact_model
for more information.
Examples
# These aren't being run as they take too long to fit
if (FALSE) {
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
)
}