Health-GPS 3.0.0.0
Global Health Policy Simulation model (Health-GPS)
Loading...
Searching...
No Matches
hgps::StaticLinearModel Class Referencefinal

Implements the static linear model type. More...

#include <static_linear_model.h>

Inheritance diagram for hgps::StaticLinearModel:
[legend]
Collaboration diagram for hgps::StaticLinearModel:
[legend]

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.
 

Detailed Description

Implements the static linear model type.

The static model is used to initialise the virtual population.

Constructor & Destructor Documentation

◆ StaticLinearModel()

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.

Parameters
expectedThe expected risk factor values by sex and age
expected_trendThe expected trend of risk factor values
trend_stepsThe number of time steps to apply the trend
expected_trend_boxcoxThe expected boxcox factor
namesThe risk factor names
modelsThe linear models used to compute a person's risk factor values
rangesThe value range of each risk factor
lambdaThe lambda values of the risk factors
stddevThe standard deviations of the risk factors
choleskyCholesky decomposition of the risk factor correlation matrix
policy_modelsThe linear models used to compute a person's intervention policies
policy_rangesThe value range of each intervention policy
policy_choleskyCholesky decomposition of the intervention policy covariance matrix
trend_modelsThe linear models used to compute a person's risk factor trends
trend_rangesThe value range of each risk factor trend
trend_lambdaThe lambda values of the risk factor trends
info_speedThe information speed of risk factor updates
rural_prevalenceRural sector prevalence for age groups and sex
income_modelsThe income models for each income category
physical_activity_stddevThe standard deviation of the physical activity
trend_typeThe type of trend to apply (Null, UPFTrend, or IncomeTrend)
expected_income_trendThe expected income trend of risk factor values
expected_income_trend_boxcoxThe expected income trend boxcox factor
income_trend_stepsThe number of time steps to apply the income trend
income_trend_modelsThe linear models used to compute income trends
income_trend_rangesThe value range of each income trend
income_trend_lambdaThe lambda values of the income trends
income_trend_decay_factorsThe exponential decay factors for income trends
is_continuous_income_modelWhether this model uses continuous income calculation (FINCH approach)
continuous_income_modelThe continuous income model parameters (if using FINCH approach)
income_category_layoutFinal income category buckets from project_requirements
Exceptions
HgpsExceptionfor invalid arguments
Parameters
physical_activity_models
physical_activity_modelsPhysical activity models for both India (simple) and FINCH (continuous) approaches
income_stratum_expected_tables
income_stratum_expected_tablesOptional per-stratum expected tables (ordered as in config)
income_stratum_adjustment_enabled
income_stratum_adjustment_enabledWhether per-stratum factors-mean adjustment is enabled
adjustment_income_stratum_count
adjustment_income_stratum_countNumber of rank buckets used for adjustment strata
logistic_models
logistic_modelsLogistic regression models for two-stage modeling (optional) Empty models indicate no logistic regression for that risk factor
Here is the call graph for this function:

Member Function Documentation

◆ generate_risk_factors()

void hgps::StaticLinearModel::generate_risk_factors ( RuntimeContext context)
overridevirtual

Generates the initial risk factors for a population and newborns.

Parameters
contextThe simulation run-time context

Implements hgps::RiskFactorModel.

Here is the call graph for this function:

◆ is_continuous_income_model()

bool hgps::StaticLinearModel::is_continuous_income_model ( ) const
noexcept

Check if using continuous income model (FINCH approach)

Returns
true if continuous income model is enabled

◆ name()

std::string hgps::StaticLinearModel::name ( ) const
overridevirtualnoexcept

Gets the model name.

Returns
The human-readable model name

Implements hgps::RiskFactorModel.

Here is the caller graph for this function:

◆ type()

RiskFactorModelType hgps::StaticLinearModel::type ( ) const
overridevirtualnoexcept

Gets the model type identifier.

Returns
The module type identifier

Implements hgps::RiskFactorModel.

◆ update_risk_factors()

void hgps::StaticLinearModel::update_risk_factors ( RuntimeContext context)
overridevirtual

Update risk factors for population.

Parameters
contextThe simulation run-time context

Implements hgps::RiskFactorModel.

Here is the call graph for this function:

The documentation for this class was generated from the following files: