Health-GPS 3.0.0.0
Global Health Policy Simulation model (Health-GPS)
Loading...
Searching...
No Matches
dynamic_hierarchical_linear_model.h
Go to the documentation of this file.
1#pragma once
2
4
5#include "mapping.h"
6#include "random_algorithm.h"
8
9namespace hgps {
10
14 std::string name;
15
17 std::map<core::Identifier, double> coefficients{};
18
21};
22
27
29 std::map<core::Identifier, FactorDynamicEquation> male{};
30
32 std::map<core::Identifier, FactorDynamicEquation> female{};
33};
34
39 public:
48 std::shared_ptr<RiskFactorSexAgeTable> expected,
49 std::shared_ptr<std::unordered_map<core::Identifier, double>> expected_trend,
50 std::shared_ptr<std::unordered_map<core::Identifier, int>> trend_steps,
51 const std::map<core::IntegerInterval, AgeGroupGenderEquation> &equations,
52 const std::map<core::Identifier, core::Identifier> &variables,
53 const double boundary_percentage);
54
55 RiskFactorModelType type() const noexcept override;
56
57 std::string name() const noexcept override;
58
59 void generate_risk_factors(RuntimeContext &context) override;
60
61 void update_risk_factors(RuntimeContext &context) override;
62
63 private:
64 const std::map<core::IntegerInterval, AgeGroupGenderEquation> &equations_;
65 const std::map<core::Identifier, core::Identifier> &variables_;
66 double boundary_percentage_;
67
68 const AgeGroupGenderEquation &equations_at(int age) const;
69
70 void update_risk_factors_exposure(
71 RuntimeContext &context, Person &entity,
72 const std::map<core::Identifier, double> &current_risk_factors,
73 const std::map<core::Identifier, FactorDynamicEquation> &equations);
74
75 static std::map<core::Identifier, double>
76 get_current_risk_factors(const HierarchicalMapping &mapping, Person &entity);
77
78 double sample_normal_with_boundary(Random &random, double mean, double standard_deviation,
79 double boundary) const;
80};
81
84 public:
94 std::unique_ptr<RiskFactorSexAgeTable> expected,
95 std::unique_ptr<std::unordered_map<core::Identifier, double>> expected_trend,
96 std::unique_ptr<std::unordered_map<core::Identifier, int>> trend_steps,
97 std::map<core::IntegerInterval, AgeGroupGenderEquation> equations,
98 std::map<core::Identifier, core::Identifier> variables,
99 const double boundary_percentage = 0.05);
100
103 std::unique_ptr<RiskFactorModel> create_model() const override;
104
105 private:
106 std::map<core::IntegerInterval, AgeGroupGenderEquation> equations_;
107 std::map<core::Identifier, core::Identifier> variables_;
108 double boundary_percentage_;
109};
110
111} // namespace hgps
Defines the dynamic hierarchical linear model data type.
Definition dynamic_hierarchical_linear_model.h:83
std::unique_ptr< RiskFactorModel > create_model() const override
Construct a new DynamicHierarchicalLinearModel from this definition.
Definition dynamic_hierarchical_linear_model.cpp:162
Implements the dynamic hierarchical linear model type.
Definition dynamic_hierarchical_linear_model.h:38
std::string name() const noexcept override
Gets the model name.
Definition dynamic_hierarchical_linear_model.cpp:25
RiskFactorModelType type() const noexcept override
Gets the model type identifier.
Definition dynamic_hierarchical_linear_model.cpp:21
void update_risk_factors(RuntimeContext &context) override
Update risk factors for population.
Definition dynamic_hierarchical_linear_model.cpp:39
void generate_risk_factors(RuntimeContext &context) override
Generates the initial risk factors for a population and newborns.
Definition dynamic_hierarchical_linear_model.cpp:27
Defines the hierarchical model mapping data type.
Definition mapping.h:61
General purpose Random number generator algorithms.
Definition random_algorithm.h:8
Risk factor adjustable model definition interface.
Definition risk_factor_adjustable_model.h:158
Risk factor model interface with mean adjustment by sex and age.
Definition risk_factor_adjustable_model.h:63
Defines the Simulation runtime context data type.
Definition runtime_context.h:22
Top-level namespace for Health-GPS Console host application.
Definition command_options.cpp:8
RiskFactorModelType
Health GPS risk factor module types enumeration.
Definition risk_factor_model.h:12
Define the age group dynamic equations data type.
Definition dynamic_hierarchical_linear_model.h:24
std::map< core::Identifier, FactorDynamicEquation > male
The males dynamic equations.
Definition dynamic_hierarchical_linear_model.h:29
std::map< core::Identifier, FactorDynamicEquation > female
The females dynamic equations.
Definition dynamic_hierarchical_linear_model.h:32
core::IntegerInterval age_group
The reference age group.
Definition dynamic_hierarchical_linear_model.h:26
Defines a factor linear regression equation.
Definition dynamic_hierarchical_linear_model.h:12
std::map< core::Identifier, double > coefficients
The regression model coefficients.
Definition dynamic_hierarchical_linear_model.h:17
std::string name
The factor name.
Definition dynamic_hierarchical_linear_model.h:14
double residuals_standard_deviation
The residuals standard deviation.
Definition dynamic_hierarchical_linear_model.h:20
Defines a virtual population person data type.
Definition person.h:39