|
Health-GPS 3.0.0.0
Global Health Policy Simulation model (Health-GPS)
|
Implements the static linear model type. More...
#include <static_linear_model.h>
Public Member Functions | |
| StaticLinearModel (std::shared_ptr< RiskFactorSexAgeTable > expected, std::shared_ptr< std::unordered_map< core::Identifier, double > > expected_trend, std::shared_ptr< std::unordered_map< core::Identifier, int > > trend_steps, std::shared_ptr< std::unordered_map< core::Identifier, double > > expected_trend_boxcox, const std::vector< core::Identifier > &names, const std::vector< LinearModelParams > &models, const std::vector< core::DoubleInterval > &ranges, const std::vector< double > &lambda, const std::vector< double > &stddev, const Eigen::MatrixXd &cholesky, const std::vector< LinearModelParams > &policy_models, const std::vector< core::DoubleInterval > &policy_ranges, const Eigen::MatrixXd &policy_cholesky, std::shared_ptr< std::vector< LinearModelParams > > trend_models, std::shared_ptr< std::vector< core::DoubleInterval > > trend_ranges, std::shared_ptr< std::vector< double > > trend_lambda, double info_speed, const std::unordered_map< core::Identifier, std::unordered_map< core::Gender, double > > &rural_prevalence, const std::unordered_map< core::Income, LinearModelParams > &income_models, double physical_activity_stddev, TrendType trend_type, std::shared_ptr< std::unordered_map< core::Identifier, double > > expected_income_trend=nullptr, std::shared_ptr< std::unordered_map< core::Identifier, double > > expected_income_trend_boxcox=nullptr, std::shared_ptr< std::unordered_map< core::Identifier, int > > income_trend_steps=nullptr, std::shared_ptr< std::vector< LinearModelParams > > income_trend_models=nullptr, std::shared_ptr< std::vector< core::DoubleInterval > > income_trend_ranges=nullptr, std::shared_ptr< std::vector< double > > income_trend_lambda=nullptr, std::shared_ptr< std::unordered_map< core::Identifier, double > > income_trend_decay_factors=nullptr, bool is_continuous_income_model=false, const LinearModelParams &continuous_income_model=LinearModelParams{}, core::IncomeCategoryLayout income_category_layout={}, const std::unordered_map< core::Identifier, PhysicalActivityModel > &physical_activity_models={}, const std::vector< IncomeStratumExpectedTableEntry > &income_stratum_expected_tables={}, bool income_stratum_adjustment_enabled=false, std::size_t adjustment_income_stratum_count=0u, bool has_active_policies=true, const std::vector< LinearModelParams > &logistic_models={}, core::Gender gender2_indicator=core::Gender::male) | |
| Initialises a new instance of the StaticLinearModel class. | |
| RiskFactorModelType | type () const noexcept override |
| Gets the model type identifier. | |
| std::string | name () const noexcept override |
| Gets the model name. | |
| bool | is_continuous_income_model () const noexcept |
| Check if using continuous income model (FINCH approach) | |
| void | generate_risk_factors (RuntimeContext &context) override |
| Generates the initial risk factors for a population and newborns. | |
| void | update_risk_factors (RuntimeContext &context) override |
| Update risk factors for population. | |
Public Member Functions inherited from hgps::RiskFactorAdjustableModel | |
| RiskFactorAdjustableModel (std::shared_ptr< RiskFactorSexAgeTable > expected, std::shared_ptr< std::unordered_map< core::Identifier, double > > expected_trend, std::shared_ptr< std::unordered_map< core::Identifier, int > > trend_steps, TrendType trend_type=TrendType::Null, std::shared_ptr< std::unordered_map< core::Identifier, double > > expected_income_trend=nullptr, std::shared_ptr< std::unordered_map< core::Identifier, double > > expected_income_trend_decay_factors=nullptr) | |
| Constructs a new RiskFactorAdjustableModel instance. | |
| virtual double | get_expected (RuntimeContext &context, core::Gender sex, int age, const core::Identifier &factor, OptionalRange range, bool apply_trend) const |
| Gets a person's expected risk factor value. | |
| void | adjust_risk_factors (RuntimeContext &context, const std::vector< core::Identifier > &factors, OptionalRanges ranges, bool apply_trend, const RiskFactorSexAgeTable *expected_override=nullptr, std::optional< std::size_t > income_stratum_filter=std::nullopt, std::vector< IncomeStratumAdjustmentExampleRow > *debug_example_rows=nullptr) const |
| Adjust risk factors such that mean sim value matches expected value. | |
| int | get_trend_steps (const core::Identifier &factor) const |
| Gets the number of time steps to apply the trend. | |
| const std::shared_ptr< std::unordered_map< core::Identifier, double > > & | get_expected_trend () const noexcept |
| Gets the expected trend values. | |
| void | set_logistic_factors (const std::unordered_set< core::Identifier > &logistic_factors) |
| Sets the logistic factors for simulated mean calculation. | |
Public Member Functions inherited from hgps::RiskFactorModel | |
| virtual | ~RiskFactorModel ()=default |
| Destroys a RiskFactorModel instance. | |
Implements the static linear model type.
The static model is used to initialise the virtual population.
| hgps::StaticLinearModel::StaticLinearModel | ( | std::shared_ptr< RiskFactorSexAgeTable > | expected, |
| std::shared_ptr< std::unordered_map< core::Identifier, double > > | expected_trend, | ||
| std::shared_ptr< std::unordered_map< core::Identifier, int > > | trend_steps, | ||
| std::shared_ptr< std::unordered_map< core::Identifier, double > > | expected_trend_boxcox, | ||
| const std::vector< core::Identifier > & | names, | ||
| const std::vector< LinearModelParams > & | models, | ||
| const std::vector< core::DoubleInterval > & | ranges, | ||
| const std::vector< double > & | lambda, | ||
| const std::vector< double > & | stddev, | ||
| const Eigen::MatrixXd & | cholesky, | ||
| const std::vector< LinearModelParams > & | policy_models, | ||
| const std::vector< core::DoubleInterval > & | policy_ranges, | ||
| const Eigen::MatrixXd & | policy_cholesky, | ||
| std::shared_ptr< std::vector< LinearModelParams > > | trend_models, | ||
| std::shared_ptr< std::vector< core::DoubleInterval > > | trend_ranges, | ||
| std::shared_ptr< std::vector< double > > | trend_lambda, | ||
| double | info_speed, | ||
| const std::unordered_map< core::Identifier, std::unordered_map< core::Gender, double > > & | rural_prevalence, | ||
| const std::unordered_map< core::Income, LinearModelParams > & | income_models, | ||
| double | physical_activity_stddev, | ||
| TrendType | trend_type, | ||
| std::shared_ptr< std::unordered_map< core::Identifier, double > > | expected_income_trend = nullptr, |
||
| std::shared_ptr< std::unordered_map< core::Identifier, double > > | expected_income_trend_boxcox = nullptr, |
||
| std::shared_ptr< std::unordered_map< core::Identifier, int > > | income_trend_steps = nullptr, |
||
| std::shared_ptr< std::vector< LinearModelParams > > | income_trend_models = nullptr, |
||
| std::shared_ptr< std::vector< core::DoubleInterval > > | income_trend_ranges = nullptr, |
||
| std::shared_ptr< std::vector< double > > | income_trend_lambda = nullptr, |
||
| std::shared_ptr< std::unordered_map< core::Identifier, double > > | income_trend_decay_factors = nullptr, |
||
| bool | is_continuous_income_model = false, |
||
| const LinearModelParams & | continuous_income_model = LinearModelParams{}, |
||
| core::IncomeCategoryLayout | income_category_layout = {}, |
||
| const std::unordered_map< core::Identifier, PhysicalActivityModel > & | physical_activity_models = {}, |
||
| const std::vector< IncomeStratumExpectedTableEntry > & | income_stratum_expected_tables = {}, |
||
| bool | income_stratum_adjustment_enabled = false, |
||
| std::size_t | adjustment_income_stratum_count = 0u, |
||
| bool | has_active_policies = true, |
||
| const std::vector< LinearModelParams > & | logistic_models = {}, |
||
| core::Gender | gender2_indicator = core::Gender::male |
||
| ) |
Initialises a new instance of the StaticLinearModel class.
| expected | The expected risk factor values by sex and age |
| expected_trend | The expected trend of risk factor values |
| trend_steps | The number of time steps to apply the trend |
| expected_trend_boxcox | The expected boxcox factor |
| names | The risk factor names |
| models | The linear models used to compute a person's risk factor values |
| ranges | The value range of each risk factor |
| lambda | The lambda values of the risk factors |
| stddev | The standard deviations of the risk factors |
| cholesky | Cholesky decomposition of the risk factor correlation matrix |
| policy_models | The linear models used to compute a person's intervention policies |
| policy_ranges | The value range of each intervention policy |
| policy_cholesky | Cholesky decomposition of the intervention policy covariance matrix |
| trend_models | The linear models used to compute a person's risk factor trends |
| trend_ranges | The value range of each risk factor trend |
| trend_lambda | The lambda values of the risk factor trends |
| info_speed | The information speed of risk factor updates |
| rural_prevalence | Rural sector prevalence for age groups and sex |
| income_models | The income models for each income category |
| physical_activity_stddev | The standard deviation of the physical activity |
| trend_type | The type of trend to apply (Null, UPFTrend, or IncomeTrend) |
| expected_income_trend | The expected income trend of risk factor values |
| expected_income_trend_boxcox | The expected income trend boxcox factor |
| income_trend_steps | The number of time steps to apply the income trend |
| income_trend_models | The linear models used to compute income trends |
| income_trend_ranges | The value range of each income trend |
| income_trend_lambda | The lambda values of the income trends |
| income_trend_decay_factors | The exponential decay factors for income trends |
| is_continuous_income_model | Whether this model uses continuous income calculation (FINCH approach) |
| continuous_income_model | The continuous income model parameters (if using FINCH approach) |
| income_category_layout | Final income category buckets from project_requirements |
| HgpsException | for invalid arguments |
| physical_activity_models | |
| physical_activity_models | Physical activity models for both India (simple) and FINCH (continuous) approaches |
| income_stratum_expected_tables | |
| income_stratum_expected_tables | Optional per-stratum expected tables (ordered as in config) |
| income_stratum_adjustment_enabled | |
| income_stratum_adjustment_enabled | Whether per-stratum factors-mean adjustment is enabled |
| adjustment_income_stratum_count | |
| adjustment_income_stratum_count | Number of rank buckets used for adjustment strata |
| logistic_models | |
| logistic_models | Logistic regression models for two-stage modeling (optional) Empty models indicate no logistic regression for that risk factor |
|
overridevirtual |
Generates the initial risk factors for a population and newborns.
| context | The simulation run-time context |
Implements hgps::RiskFactorModel.
|
noexcept |
Check if using continuous income model (FINCH approach)
|
overridevirtualnoexcept |
Gets the model name.
Implements hgps::RiskFactorModel.
|
overridevirtualnoexcept |
|
overridevirtual |
Update risk factors for population.
| context | The simulation run-time context |
Implements hgps::RiskFactorModel.