Post processing

Overview Structs

Overview Functions

Structs

GEMS.PostProcessorType
PostProcessor

A type to provide data processing features supplying reports, plots, or other data analyses.

Internal Fields

  • simulation::Simulation: Simulation object
  • infectionsDF::DataFrame: Infections (joined with popuation to get information on infeter and infectee)
  • populationDF::DataFrame: Population dataframe with one row per individual
  • vaccinationsDF::DataFrame: Output of the vaccination logger
  • deathsDF::DataFrame: Output of the death logger
  • testsDF::DataFrame: Output of the test logger
  • pooltestsDF::DataFrame: Output of the pool test logger
  • quarantinesDF::DataFrame: Output of th quarantine logger
  • cache::Dict{String, Any}: Internal cache to store and retrieve intermediate results

Constructors

GEMS.PostProcessorMethod
PostProcessor(simulation::Simulation)

Create a PostProcessor object for an associated Simulation. Post Processing requires a simulation to be done.

GEMS.PostProcessorMethod
PostProcessor(simulations::Vector{Simulation})

Create a vector of PostProcessor objects for a vector of associated Simulation objects. Post Processing requires all simulations to be done.

GEMS.PostProcessorMethod
PostProcessor(batch::Batch)

Create a vector of PostProcessor objects for all Simulations in a Batch. Post Processing requires all simulations to be done.

Functions

GEMS.age_incidenceFunction
age_incidence(postProcessor::PostProcessor, timespan::Int64, basesize::Int64)

Returns a DataFrame containing the infection incidence stratified by (10-year) age groups. The timespan parameter defines a time window in ticks and the basesize parameter defines the reference population size to calculate incidences. Assuming 1 tick to be 1 day, a timespan = 7 and basesize = 100_000 configuration results in the commonly known seven-day incidence per 100,000.

The structure assumes no individuals exceeding the age of 100.

Parameters

  • postProcessor::PostProcessor: Post processor instance
  • timespan::Int64: Reference time window to calculate incidence
  • basesize::Int64: Reference population size to calculate incidence

Returns

  • DataFrame with the following columns:
NameTypeDescription
tickInt16Simulation tick (time)
totalFloat64Total incidence
a0_10Float64Incidence in age cohort 0-10
a11_20Float64Incidence in age cohort 11-20
a21_30Float64Incidence in age cohort 21-30
a31_40Float64Incidence in age cohort 31-40
a41_50Float64Incidence in age cohort 41-50
a51_60Float64Incidence in age cohort 51-60
a61_70Float64Incidence in age cohort 61-70
a71_80Float64Incidence in age cohort 71-80
a81_90Float64Incidence in age cohort 81-90
a91_100Float64Incidence in age cohort 91-100
age_incidence(rd::ResultData)

Returns a DataFrame with incidence over time stratified by age groups. Look up the PostProcessor docs to find the column definitions. Returns an empty dictionary if the data is not available in the input ResultData object.

GEMS.attack_rateMethod
attack_rate(postProcessor::PostProcessor)

Divides the number of individuals who have been infected one (or multiple) time(s) by the total number of individuals.

GEMS.compartment_fillMethod
compartment_fill(postProcessor::PostProcessor)

Returns a DataFrame containing the total count of infected individuals in the respective disease states exposed, infectious, deceased and recovered.

Returns

  • DataFrame with the following columns:
NameTypeDescription
tickInt16Simulation tick (time)
exposed_cntInt64Total number of individuals in the exposed state
infectious_cntInt64Total number of individuals in the infectious state
recovered_cntInt64Total number of individuals in the recovered state
deaths_cntInt64Total number of individuals in the deceased state
GEMS.compartment_periodsMethod
compartment_periods(postProcessor::PostProcessor)

Calculates the durations of the disease compartments of all infections and returns a DataFrame containing all additional infectee-related information.

Returns

  • DataFrame with the following columns:
NameTypeDescription
infection_idInt32Infectee id
totalInt16Total duration of infection in ticks
exposedInt16Duration of the exposed period in ticks
infectiousInt16Duration of the infectious period in ticks
pre_symptomaticInt16Duration of the pre-symptomatic period in ticks
asymptomaticInt16Duration of the asymptomatic period in ticks
symptomaticInt16Duration of the symptomatic period in ticks
GEMS.cumulative_casesMethod
cumulative_cases(postProcessor::PostProcessor)

Returns a DataFrame containing the cumulative infections count of infected individuals in the respective disease states exposed, infectious, and removed.

Returns

  • DataFrame with the following columns:
NameTypeDescription
tickInt16Simulation tick (time)
exposed_cumInt64Total number of individuals in the exposed state
infectious_cumInt64Total number of individuals in the infectious state
removed_cumInt64Total number of individuals in the removed state
GEMS.cumulative_deathsMethod
cumulative_deaths(postProcessor::PostProcessor)

Returns a DataFrame containing the total count of individuals that died.

Returns

  • DataFrame with the following columns:
NameTypeDescription
tickInt16Simulation tick (time)
deaths_cumInt64Total number of individuals that have died until now
GEMS.cumulative_disease_progressionsMethod
cumulative_disease_progressions(postProcessor::PostProcessor)

Calculates the accumulated number of individuals in a certain disease state (latent, presymptomatic, symptomatic and asymptomatic) after the individual has been infected. Rows indicate the number of elapsed ticks since infections.

Example: Row 8 showing [20, 47, 290, 50] would mean that eight ticks after exposure, 20 individuals were latent, 47 were presymptomatic (no symptoms yet, but will be developing), 290 had symptoms and 50 are not experiencing symptoms and won't ever do.

Returns

  • DataFrame with the following columns:
NameTypeDescription
latentInt64Number of latent individuals X ticks after exposure
pre_symptomaticInt64Number of pre-symptomatic individuals X ticks after exposure
symptomaticInt64Number of symptomatic individuals X ticks after exposure
asymptomaticInt64Number of asymptomatic individuals X ticks after exposure
GEMS.cumulative_quarantinesMethod
cumulative_quarantines(postProcessor::PostProcessor)

Returns a DataFrame containing cumulative information about days spent in isolation.

Columns

NameTypeDescription
tickInt16Simulation tick (time)
quarantinedInt64Total number of individuals in isolation during that tick
studentsInt64Total number of students in isolation during that tick
workersInt64Total number of workers in isolation during that tick
otherInt64Total number of non-students and -workers in isolation during that tick
GEMS.deathsDFMethod
deathsDF(postProcessor::PostProcessor)

Returns the internal flat deaths DataFrame.

Columns

NameTypeDescription
tickInt16Tick of the death event
idInt32Individual's id
sexInt8Individual's sex
ageInt8Individual's age
educationInt8Individual's education level
occupationInt8Individual's occupation group
householdInt32Individual's associated household
officeInt32Individual's associated office
schoolInt32Individual's associated school
GEMS.detected_infectionsMethod
detected_infections(postProcessor::PostProcessor)

A subset of the infections dataframe with only the detected cases. An infection is considered to be detected if the infection has a non-missing first_detected_tick. For the column definitions, look up the infectionsDF(postProcessor) documentation.

Returns

  • DataFrame: Please look up the column definitions in the infectionsDF(postProcessor) documentation.
GEMS.detected_tick_casesMethod
detected_tick_cases(postProcessor::PostProcessor)

Returns the number of detected cases per tick and the number of true new exposures. This analysis is based on the tick_test column of the infections-dataframe which indicates when an individual with an active infection was first tested positive. Thus, there might be a delay between exposure_cnt and detected_cnt.

Returns

  • DataFrame with the following columns:
NameTypeDescription
tickInt16Simulation tick (time)
total_reported_casesInt64Total number of reported cases at that tick
new_detectionsInt64Number of true new detected cases at that tick (not known before)
double_reportsInt64Number of cases that were reported at that tick but were known before
false_positivesInt64Number of false positive reports at that tick
exposed_cntInt64Number of new infections at that tick
GEMS.detection_rateMethod
detection_rate(postProcessor::PostProcessor)

Returns the fraction of detected cases.

GEMS.effectiveRMethod
effectiveR(postProcessor::PostProcessor)

Returns a DataFrame containing the effective R value for each tick.

For each infectee, this method looks ahead for secondary infections this individual might cause during the total span of the simulation. These infections are then counted towards the R-value of the initial infection. If individual A, for example, is infected at time 42 and causes four secondary infections during the next 14 ticks, these four infections are counted towards the R-value of time 42.

Note: This only works in scenarios without re-infection as the current implementation just evaluates the total infections caused by each individual in general. If an individual was infected multiple times, secondary infections will inflate the statistic.

Returns

  • Dataframe with the following columns:
NameTypeDescription
tickInt16Simulation tick (time)
effective_RFloat64Effective R-value
rolling_RFloat64Effective R rolling average of the 7 previous ticks
GEMS.hospital_dfMethod
hospital_df(postProcessor::PostProcessor)

Creates a DataFrame that includes information about the current hospitalizations etc.

Returns

  • DataFrame with the following columns:
NameTypeDescription
tickInt16Simulation tick (time)
hospital_cntInt64New hospitalizations per tick
hospital_releasesInt64Hospital releases per tick
icu_cntInt64New ICU admissions per tick
icu_releasesInt64ICU releases per tick
ventilation_cntInt64New ventilations per tick
ventilation_releasesInt64Ventilation stops
current_hospitalizedInt64Number of currently hospitalized agents
current_icuInt64Number of agents currently in the ICU
current_ventilationInt64Number of currently ventilated agents
GEMS.household_attack_ratesMethod
household_attack_rates(postProcessor::PostProcessor; hh_samples::Int64 = HOUSEHOLD_ATTACK_RATE_SAMPLES)

Returns a DataFrame containing data on the in-household attack rate. The in-household attack rate is defined as the fraction of individuals in a given household that got infected within the household (in-household infection chain) caused by the first introduction of the pathogen in this household. It does not reflect overall fraction of individuals that were infected in this household throughout the course of the simuation. As the attack rate calculation is very computationally intensive, it is not done for all household but rather for a subset of households. You can change the desired subset size through the optional hh_samples argument. Its default can be found in constants.jl

Returns

  • DataFrame with the following columns:
NameTypeDescription
first_introductionInt16Time of when the first member of the respective household was exposed
hh_idInt32Household setting identifier
hh_sizeInt16Household size
chain_sizeInt32Number of individuals that got infected within the household
hh_attack_rateFloat64Number of infected individuals divided by household size
GEMS.individuals_per_age_groupFunction
individuals_per_age_group(post_processor::PostProcessor, interval_steps::Int64)

The population in populationDF will be splitted in age groups of size interval_steps and the number of individuals per age group is counted.

The input DataFrame already needs a column called "sum" where the sum of individuals in this age is stored.

Returns

  • returns a DataFrame with the follwing structure:
NameTypeDescription
age_groupStringMin and Max age in this age group
num_individualsInt64Total number of individuals
individuals_per_age_group(post_processor::PostProcessor, interval_steps::Int64, aggregation_bound::Int64)

The the population in populationDF will be splitted in age groups of size interval_steps and the number of individuals per age group is counted. The splitting is capped at aggregation_bound.

The input DataFrame already needs a column called "sum" where the sum of individuals in this age is stored.

Returns

  • returns a DataFrame with the follwing structure:
NameTypeDescription
age_groupStringMin and Max age in this age group
num_individualsInt64Total number of individuals
GEMS.infectionsMethod
infections(postProcessor::PostProcessor)

Returns the internal flat infections DataFrame.

Columns

NameTypeDescription
infection_idInt32Unique identifier of an infection
tickInt16Tick of the infection event
id_aInt32Infecter id
id_bInt32Infectee id
infectious_tickInt16Tick at which infectee becomes infectious
removed_tickInt16Tick at which infectee becomes removed (recovers)
symptoms_tickInt16Tick at which infectee develops symptoms
severeness_tickInt16Tick at which infectee's symptoms become severe
hospital_tickInt16Tick at which infectee is hospitalized
icu_tickInt16Tick at which infectee is admitted to ICU
ventilation_tickInt16Tick at which infectee requires ventilation
symptom_categoryInt8Disease progression category (asymp., mild, severe, critical)
setting_idInt32Id of setting in which infection happens
setting_typeCharSetting type of the infection setting
latFloat32Latitude of infection location
lonFloat32Longitude of infection location
agsInt32German Community Identification Number of infection
source_infection_idInt32ID of the infection even that caused this infection (chain)
generation_timeInt16Time between preceeding infection and this exposure
serial_intervalInt16Time between onset of symptoms of this and preceeding infection
test_typeStringType of test which detected this infection
first_detected_tickInt16Tick of (reportable) test that first detected this infection
sex_aInt8Infecter sex
age_aInt8Infecter age
number_of_vaccinations_aInt8Infecter number of previous vaccinations
vaccination_tick_aInt16Infecter last time of vaccination
education_aInt8Infecter education level
occupation_aInt8Infecter occupation group
household_aInt32Infecter associated household
office_aInt32Infecter associated office
schoolclass_aInt32Infecter associated school
sex_bInt8Infectee sex
age_bInt8Infectee age
number_of_vaccinations_aInt8Infecter number of previous vaccinations
vaccination_tick_aInt16Infecter last time of vaccination
education_bInt8Infectee education level
occupation_bInt8Infectee occupation group
household_bInt32Infectee associated household
office_bInt32Infectee associated office
schoolclass_bInt32Infectee associated schoolclass
household_ags_bInt32Infectee household German Community Identification Number
GEMS.infectionsDFMethod
infectionsDF(postProcessor::PostProcessor)

Returns the internal flat infections DataFrame. Lookup the docstring of infections(postProcessor::PostProcessor) for column definitions.

GEMS.observed_RMethod
observed_R(postProcessor::PostProcessor)

Returns a DataFrame containing estimations for the effective (current) reproduction number R, based on detected infections. The calculation uses the estimation for the (rolling) observed serial interval (SI) and the total of detected cases within a time window of the length defined in R_ESTIMATION_TIME_WINDOW (lookup constants.jl) ending with a current tick t. It divides the total detected infections in the current time window with the total detected infections in the time window that lies one SI behind. The function does this for the mean estimate of the serial interval as well as the (floored) lower-95% confidence bound and the (ceiled) upper-95% confidence bound.

Example

  • For tick t = 42 and
  • Given the R_ESTIMATION_TIME_WINDOW = 7, and
  • The rolling observed serial interval being 4,
  • This function does: sum(infections[35:42]) / sum(infections[31:38])

Returns

  • DataFrame with the following columns:
NameTypeDescription
tickInt16Simulation tick (time)
mean_est_RFloat64Mean estimation (based on detected infections) for R
lower_est_RFloat64Lower bound estimation (based on detected infections) for R
upper_est_RFloat64Upper bound estimation (based on detected infections) for R
GEMS.pooltestsDFMethod
pooltestsDF(postProcessor::PostProcessor)

Returns the internal flat pool tests DataFrame.

Columns

NameTypeDescription
test_tickInt16Tick of the test event
setting_idInt32Setting id of the tested pool
setting_typeInt32Setting type
test_resultBoolTest result (pos./neg.)
no_of_individualsInt32Number of tested individuals
no_of_infectedInt32Number of actually infected individuals
test_typeStringName of test type
GEMS.populationDFMethod
populationDF(postProcessor)

Returns the internal flat population DataFrame.

Columns

NameTypeDescription
idInt32Individual id
sexInt8Individual sex
ageInt8Individual age
educationInt8Individual education level
occupationInt8Individual occupation group
householdInt32Individual associated household
officeInt32Individual associated office
schoolInt32Individual associated school
GEMS.population_pyramidMethod
population_pyramid(postProcessor::PostProcessor)

Returns a DataFrame containing data to generate a population pyramid. It provides the sum of all female and male individuals in all age groups in the population model. Sums for female are multiplied by -1 to facilitate visualization.

Returns

  • DataFrame with the following columns:
NameTypeDescription
ageInt81-year age classes
sexInt8Sex according to population DataFame (0 = female, 1 = male)
genderStringString variant of Sex [Female, Male]
sumInt64Total of all genders in all ages (females multiplied by -1)
GEMS.reported_tick_casesMethod
reported_tick_cases(postProcessor::PostProcessor)

Returns the number of reported positive test cases per tick. This analysis is based on the testDF dataframe.

Returns

  • DataFrame with the following columns:
NameTypeDescription
tickInt16Simulation tick (time)
reported_cntInt64Number of newly reported infections (positive reportable tests) at that tick
GEMS.rolling_observed_SIMethod
rolling_observed_SI(postProcessor::PostProcessor)

Returns a DataFrame containing aggregated estimations on the serial interval based on true detected cases. The estimations are based on all true detected cases in a 14-past-days time window. If fewer than 50 infections were recorded in that time window, detections prior to that are added until the sample is complete. This is done in order to reduce large stochastic fluctuations due to small sample size.

Returns

  • DataFrame with the following columns:
NameTypeDescription
tickInt16Simulation tick (time)
min_SIInt16Minimal serial interval recored for any infection that tick
max_SIInt16Maximum serial interval recored for any infection that tick
lower_95_SIFloat64Lower 95% confidence interval for serial intervals that tick
upper_95_SIFloat64Upper 95% confidence interval for serial intervals that tick
std_SIFloat64Stanard deviation for serial intervals that tick
mean_SIFloat64Mean for serial intervals that tick
GEMS.setting_sizesMethod
setting_sizes(postProcessor::PostProcessor)

Returns a Dictionary containing information about size of the settings. The keys are equal to the settingtypes and the values correspond to a countmap of the setting sizes.

Returns

  • Dict{String, Dict{Int64, Int64}}: Nested dictionary where the first key is the name of the setting type (e.g., "Household") and the innter dictionary is a countmap with the key being a setting size (e.g., 5) and the value the number of occurences.
GEMS.settingdataMethod
settingdata(postProcessor::PostProcessor)

Returns a DataFrame containing information about setting types

Returns

  • DataFrame with the following columns:
NameTypeDescription
setting_typeStringSetting type identifier (name)
number_of_settingsInt64Overall number of settings of that type
min_individualsFloat64Lowest number of individuals assigned to a setting of this type
max_individualsFloat64Highest number of individuals assigned to a setting of this type
avg_individualsFloat64Average number of individuals assigned to a setting of this type
GEMS.sim_infectionsDFMethod
sim_infectionsDF(postProcessor::PostProcessor)

Returns a DataFrame containing all infections that happened during the simulation run. As it is a direct filter on the PostProcessors internal infectionsDF, the column structure is identical to the output of infectionsDF(postProcessor)

GEMS.simulationMethod
simulation(postProcessor::PostProcessor)

Returns the associated Simulation object.

GEMS.testsDFMethod
testsDF(postProcessor::PostProcessor)

Returns the internal flat tests DataFrame. It was joined with the population dataframe to also obtain personal characteristics about the testees.

Columns

NameTypeDescription
test_tickInt16Tick of the test event
idInt32Individual's id
test_resultBoolTest result
infectedBoolIndividual's current infection state
infection_idInt32Individual's infection id
test_typeStringTest name
reportableBoolIf true, a positive test result will be "reported"
sexInt8Individual's sex
ageInt8Individual's age
number_of_vaccinationsInt8Individual's number of vaccinations
vaccination_tickInt16Tick when the individual was last vaccinated
educationInt8Individual's education level
occupationInt8Individual's occupation group
householdInt32Individual's associated household
officeInt32Individual's associated office
schoolInt32Individual's associated school
GEMS.tick_casesMethod
tick_cases(postProcessor::PostProcessor)

Returns a DataFrame containing the count of individuals currently entering in the respective disease states exposed, infectious, and removed.

Returns

  • DataFrame with the following columns:
NameTypeDescription
tickInt16Simulation tick (time)
exposed_cntInt64Number of individuals entering the exposed state
infectious_cntInt64Number of individuals entering the infectious state
removed_cntInt64Number of individuals entering the removed state
GEMS.tick_cases_per_settingMethod
tick_cases_per_setting(postProcessor::PostProcessor)

Returns a DataFrame containing information about the infections in different setting types

Returns

  • DataFrame with the following columns:
NameTypeDescription
tickInt16Current tick of the simulation
setting_typeStringSetting type identifier (name)
daily_casesInt64Cases for setting and tick
GEMS.tick_deathsMethod
tick_deaths(postProcessor::PostProcessor)

Returns a DataFrame containing the count of individuals that died per tick.

Returns

  • DataFrame with the following columns:
NameTypeDescription
tickInt16Simulation tick (time)
death_cntInt64Number of individuals that dies
GEMS.tick_generation_timesMethod
tick_generation_times(postProcessor::PostProcessor)

Returns a DataFrame containing aggregated information on the generation time per tick.

Returns

  • DataFrame with the following columns:
NameTypeDescription
tickInt16Simulation tick (time)
min_generation_timeInt16Minimal generation time recored for any infection that tick
max_generation_timeInt16Maximum generation time recored for any infection that tick
lower_95_generation_timeFloat64Lower 95% confidence interval for generation times that tick
upper_95_generation_timeFloat64Upper 95% confidence interval for generation times that tick
std_generation_timeFloat64Stanard deviation for generation times that tick
mean_generation_timeFloat64Mean for generation times that tick
GEMS.tick_pooltestsMethod
 tick_pooltests(postProcessor::PostProcessor)

Returns a Dict for each employed test_type containing their name as a key and a DataFrame containing the number of applied pool tests (positive/negative/total) per tick.

Returns

  • Dict{String, DataFrame}: The key is the TestType's name. The values are DataFrames with the following columns:
NameTypeDescription
tickInt16Simulation tick (time)
positive_testsInt64Number of positive tests
negative_testsInt64Number of negative tests
total_testsInt64Number of tests performed
GEMS.tick_serial_intervalsMethod
tick_serial_intervals(postProcessor::PostProcessor)

Returns a DataFrame containing aggregated information on the serial interval per tick.

Returns

  • DataFrame with the follwing columns:
NameTypeDescription
tickInt16Simulation tick (time)
min_SIInt16Minimal serial interval recored for any infection that tick
max_SIInt16Maximum serial interval recored for any infection that tick
lower_95_SIFloat64Lower 95% confidence interval for serial intervals that tick
upper_95_SIFloat64Upper 95% confidence interval for serial intervals that tick
std_SIFloat64Stanard deviation for serial intervals that tick
mean_SIFloat64Mean for serial intervals that tick
GEMS.tick_testsMethod
tick_tests(postProcessor::PostProcessor)

Returns a Dict for each employed test_type containing their name as a key and a DataFrame containing the count of individuals that got tested (positive/negative) as well as the people reported positive for the first time per tick.

Returns

  • Dict{String, DataFrame}: The key is the TestType's name. The values are DataFrames with the following columns:
NameTypeDescription
tickInt16Simulation tick (time)
reported_casesInt16Number cases tested positive for the first time
positive_testsInt64Number of positive tests
negative_testsInt64Number of negative tests
total_testsInt64Number of tests performed
positive_rateFloat64Fraction of positive tests
rolling_positive_rateFloat64Positive rate rolling average of the 7 previous ticks
GEMS.time_to_detectionMethod
time_to_detection(postProcessor::PostProcessor)

Returns the mean, standard deviation, minimum, maximum, upper- and lower 95% confidence intervals of the time to detection for all detected cases. The time to detection is defined as the number of ticks between the time of exposure and time of detection.

Returns

  • DataFrame with the following columns:
NameTypeDescription
tickInt64Simulation tick (time)
mean_time_to_detectionInt64Mean time to detection at that tick
std_time_to_detectionInt64Standard deviation of time to detection at that tick
min_time_to_detectionInt64Minimum time to detection at that tick
max_time_to_detectionInt64Maximum time to detection at that tick
upper_95_time_to_detectionInt64Upper 95% confidence interval of time to detection at that tick
lower_95_time_to_detectionInt64Lower 95% confidence interval of time to detection at that tick
GEMS.total_detected_casesMethod
total_detected_cases(postProcessor::PostProcessor)

Returns the total number of detected cases.

GEMS.total_quarantinesMethod
total_quarantines(postProcessor::PostProcessor)

Returns the total number of total ticks spent in quarantine. E.g., if 10 indiviuals were in quarantine for 5 ticks each, this function will return 50.

GEMS.total_testsMethod
total_tests(postProcessor::PostProcessor)

Sums up the total number of tests per test type.

Returns

  • Dict{String, Int64}: Dictionary where the key is the TestType's name and the value the number of tests that were applied.
GEMS.weighted_error_sumFunction
weighted_error_sum(post_processor::PostProcessor, error_matrix::ContactMatrix{T})::T where T <: Number

Calculate a weighted error sum for the given contact matrix. Each cell will be multiplied by the number of individuals in the corresponding age group and then divided by the number of individuals in the whole population.

weighted_error_sum = (cell value * individuals per age group) / population size)

To calculate the weighted sum, "weighted arithmetic mean" is used.

Assumptions

  • error_matrix Matrix contains error values between two contact matrices.
weighted_error_sum(post_processor::PostProcessor, setting::DataType, reference_matrix::ContactMatrix{T}; fit_to_reference_matrix::Bool)::T where T <: Number

Calculate a "weighted error sum" for a setting specific contact matrix compared to a reference_matrix. The post_processor is used to calculate a contact matrix for the associated simulation that will then be fitted by a factor alpha calculated from the differences between the simulation contact matrix and the reference_matrix.

Compared to weighted_error_sum(post_processor::PostProcessor, error_matrix::ContactMatrix{T})::T where T <: Number the error_matrix first needs to be calculated using the post_processor and the reference_matrix.

Each cell of the calculated error matrix will be multiplied by the number of individuals in the corresponding age group and then divided by the number of individuals in the whole population of the simulation.

weighted_error_sum = (cell value * individuals per age group) / population size)

To calculate the weighted sum, "weighted arithmetic mean" is used.

Parameters

  • post_processor::PostProcessor: PostProcessor object containing the simulation and population data
  • setting::DataType: Settingtype of the reference_matrix (i.e. Household)
  • reference_matrix::ContactMatrix{T}: Matrix containing mean number of contacts per age group between individuals of one settingtype.
  • fit_to_reference_matrix::Bool: Flag, indicating if the matrix calculated from the simulation should be fitted to the 'reference_matrix`.

Assumptions

  • reference_matrix logically stems from the same setting as setting!