Skip to contents

The DiseasyPopulation module is responsible for handling the population included in the model.

See vignette("diseasy-population").

Value

A new instance of the DiseasyPopulation R6 class.

Super class

DiseasyBaseModule -> DiseasyPopulation

Active bindings

groups

(data.frame())
The demographic groups that have been configured in the module.

population

(tibble)
The population groups and their sizes configured in the module.

population_proportion

(numeric())
The distribution of individuals across the demography groups defined in the module.

regional_stratification

(character())
The level of spatial stratification of the population. Read only.

age_cuts_lower

(integer())
vector of ages defining the lower bound for each age group. If NULL, age groups of contact_basis is used. Read only.

activity

(diseasy::DiseasyActivity)
The local copy of an DiseasyActivity module. Read-only.

regions

(diseasy::DiseasyRegions)
The local copy of an DiseasyRegions module. Read-only.

Methods

Inherited methods


DiseasyPopulation$new()

Creates a new instance of the DiseasyPopulation R6 class.

Usage

DiseasyPopulation$new(
  age_cuts_lower = 0L,
  regional_stratification = NULL,
  regions = NULL,
  ...
)

Arguments

age_cuts_lower

(integer())
vector of ages defining the lower bound for each age group. If NULL, age groups of contact_basis is used.

regional_stratification

(character())
The level of spatial stratification of the population.

regions

(DiseasyRegions)
An instance of a regional module which should provide the demography of the population.

...

Parameters sent to DiseasyBaseModule R6 constructor


DiseasyPopulation$stratify_age()

Sets the age stratification of the model population.

Usage

DiseasyPopulation$stratify_age(age_cuts_lower)

Arguments

age_cuts_lower

(integer())
vector of ages defining the lower bound for each age group. If NULL, age groups of contact_basis is used.

Returns

NULL (called for side effects)


DiseasyPopulation$stratify_regions()

Sets the spatial stratification of the model population.

Usage

DiseasyPopulation$stratify_regions(regional_stratification)

Arguments

regional_stratification

(character())
The level of spatial stratification of the population.

Returns

NULL (called for side effects)


DiseasyPopulation$validate_configuration()

Validate the stratifications are supported by demography data. Throw error if misconfigured.

Usage

DiseasyPopulation$validate_configuration(
  age_cuts_lower = self %.% age_cuts_lower,
  regional_stratification = self %.% regional_stratification
)

Arguments

age_cuts_lower

(integer())
vector of ages defining the lower bound for each age group. If NULL, age groups of contact_basis is used.

regional_stratification

(character())
The level of spatial stratification of the population.

Returns

NULL (called for side effects)


DiseasyPopulation$per_capita_contact_matrices()

Compute the per-capita contact matrices. See vignette("diseasy-activity") for details.

Usage

DiseasyPopulation$per_capita_contact_matrices(weights = rep(1, 4))

Arguments

weights

(numeric(4))
vector of weights for the four types of contacts. If NULL, no weighting is done.

Returns

list(matrix)
A list (with names indicating the dates of changes in contacts) of contact rates (matrix).


DiseasyPopulation$describe()

Prints a human readable report of the internal state of the module.

Usage

DiseasyPopulation$describe()


DiseasyPopulation$clone()

The objects of this class are cloneable with this method.

Usage

DiseasyPopulation$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

  # Create population module
  population <- DiseasyPopulation$new()

  # By default a single, non-stratified population is used in the models.
  population
#> # DiseasyPopulation ##########################################
#> Stratifications:
#> Age: No age stratification has been configured
#> Space: No spatial stratification has been configured

  # Stratification can be added via methods

  # Stratifying by age
  population$stratify_age(age_cuts_lower = c(0, 60)) # 2 age groups
  # NB: Age cuts must be available in demography and disease data.

  population
#> # DiseasyPopulation ##########################################
#> Stratifications:
#> Age: Stratified by age: 00-59, 60+
#> Space: No spatial stratification has been configured

  rm(population)