Step 5: Education Fate Base Model
Todo: clean inputation using information of already graduated, in school, etc.
Model Description
At this step we add the base “fate” module for school outcome. Based on the information in the starting population and parameters by year of birth and sex, the final school outcome is decided at birth.
The new EducBaseFate.mpp Module
This module sets the base education fate and stores the underlying individual probabilities of education progressions. The education fate is decided at birth. There are three different outcomes: low, medium, high. The module sets three states at birth:
educ_fate: the individual outcome in 3 levels low, medium, high
educ_prob1: the individual probability to move from low to medium
educ_prob2: the individual probability to move from medium to high
Probabilities to progress from low to medium and from medium to high are given by two parameters by year of birth and sex. The way how the education fate is decided depends on the year of birth and the person type.
Persons from the starting population: the education outcome is taken from the starting population file if the person was born before the years of birth covered by the parameters. This means, up to two age cut-offs, the information of the starting population is ignored at all, or only used to decide the first progression (low to medium, but not medium to high which is modeled).
Persons born in the simulation: the education fate is decided based on the parameters.
The function SetEducBaseFate() which decides the fate is hooked to the SetAlive() Event of the PersonCore.mpp module, ie. is called directly at birth after the actor enters the simulation and all actor sets are available and family links are operational.
This module is the base version for the education fate. As the probabilities on which the decision was based are stored, the outcome can be adjusted by a refined model in order to account for additional individual-level characeristics (like parents’ education) and/or to aligne the aggregated outcome to target rates or constraints.
When adding this module, some adaptations are necessary in other modules:
The state educ_startpop has to be initialized in the Start() function in the PersonCore.mpp module.
The year of birth ranges for the model parameters depend on the country and time context. The according ranges YOB_EDUC_PROG1 and YOB_EDUC_PROG2 are accordingly added in _CountryContext.mpp
////////////////////////////////////////////////////////////////////////////////////////////////////
// Types
////////////////////////////////////////////////////////////////////////////////////////////////////
classification EDUC_LEVEL3 //EN Education level
{
EL3_LOW, //EN Low
EL3_MEDIUM, //EN Medium
EL3_HIGH //EN High
};
classification EDUC_LEVEL5 //EN Education Level
{
EL5_LOW, //EN Low
EL5_MEDIUMV, //EN Medium - vocational
EL5_MEDIUMG, //EN Medium - general
EL5_HIGHV, //EN High - vocational
EL5_HIGHG //EN High - general
};
aggregation EDUC_LEVEL3, EDUC_LEVEL5 //EN Aggregation of Education Levels
{
EL3_LOW, EL5_LOW,
EL3_MEDIUM, EL5_MEDIUMV,
EL3_MEDIUM, EL5_MEDIUMG,
EL3_HIGH, EL5_HIGHV,
EL3_HIGH, EL5_HIGHG
};
////////////////////////////////////////////////////////////////////////////////////////////////////
// Parameters
////////////////////////////////////////////////////////////////////////////////////////////////////
parameters
{
//EN Education progression probability low -> medium
double EducProg1[SEX][YOB_EDUC_PROG1];
//EN Education progression probability medium -> high
double EducProg2[SEX][YOB_EDUC_PROG2];
};
//EN Education Base Fate Model
parameter_group PG_EducBaseFate
{
EducProg1, EducProg2
};
////////////////////////////////////////////////////////////////////////////////////////////////////
// Actor States and Events
////////////////////////////////////////////////////////////////////////////////////////////////////
actor Person
{
EDUC_LEVEL3 educ_fate = { EL3_LOW }; //EN Primary Education Fate
EDUC_LEVEL5 educ_startpop = { EL5_LOW }; //EN Primary Education Fate
double educ_prob1 = { 0.0 }; //EN Base prob. progressing low medium
double educ_prob2 = { 0.0 }; //EN Base prob. progressing medium high
void SetEducBaseFate(); //EN Setting the education fate
hook SetEducBaseFate, SetAliveEvent; //EN Hook SetEducBaseFate to SetAlive
};
////////////////////////////////////////////////////////////////////////////////////////////////////
// Implementation
////////////////////////////////////////////////////////////////////////////////////////////////////
void Person::SetEducBaseFate()
{
// Person born in simulation
if ( person_type == PT_CHILD )
{
educ_prob1 = EducProg1[sex][RANGE_POS(YOB_EDUC_PROG1,year_of_birth)];
educ_prob2 = EducProg2[sex][RANGE_POS(YOB_EDUC_PROG2,year_of_birth)];
EDUC_LEVEL3 eolFate = EL3_LOW;
if ( RandUniform(5) < educ_prob1 ) eolFate = EL3_MEDIUM;
if ( eolFate == EL3_MEDIUM && RandUniform(6) < educ_prob2 ) eolFate = EL3_HIGH;
educ_fate = eolFate;
}
// Person from starting population
else if ( person_type == PT_START )
{
// Case 1: take the education from the starting population
if ( year_of_birth < MIN(YOB_EDUC_PROG2))
{
educ_fate = EDUC_LEVEL5_To_EDUC_LEVEL3(educ_startpop);
}
// Case 2: take first progression from the starting population
else if ( year_of_birth < MIN(YOB_EDUC_PROG1))
{
educ_prob2 = EducProg2[sex][RANGE_POS(YOB_EDUC_PROG2,year_of_birth)];
EDUC_LEVEL3 eolFate = EL3_LOW;
if ( educ_startpop != EL5_LOW ) eolFate = EL3_MEDIUM;
if ( eolFate == EL3_MEDIUM && RandUniform(7) < educ_prob2 ) eolFate = EL3_HIGH;
educ_fate = eolFate;
}
// Case 3: model from parameters ignoring starting population values
else
{
educ_prob1 = EducProg1[sex][RANGE_POS(YOB_EDUC_PROG1,year_of_birth)];
educ_prob2 = EducProg2[sex][RANGE_POS(YOB_EDUC_PROG2,year_of_birth)];
EDUC_LEVEL3 eolFate = EL3_LOW;
if ( RandUniform(8) < educ_prob1 ) eolFate = EL3_MEDIUM;
if ( eolFate == EL3_MEDIUM && RandUniform(9) < educ_prob2 ) eolFate = EL3_HIGH;
educ_fate = eolFate;
}
}
}
table Person TabEducTest //EN Educ Table
[is_alive]
{
person_type+ *
{
unit
}
* year_of_birth
* educ_fate+
};
Initializations in the Start() Function
The state educ_startpop is added to the list of variables initiated in the Start() Function.
// Initialize states
if (person_type == PT_START) // Person comes from starting population
{
// (A) States from Starting population file
time = peObservation->pmc[PMC_BIRTH] + RandUniform(2);
sex = (SEX)(int)peObservation->pmc[PMC_SEX];
family_role = (FAM_ROLE)( int )peObservation->pmc[PMC_ROLE];
educ_startpop = (EDUC_LEVEL5)(int)peObservation->pmc[PMC_EDUC];
Context-Specific Ranges in _CountryContext.mpp
range YOB_EDUC_PROG1{ 1990, 2050 }; //EN Year of birth
range YOB_EDUC_PROG2{ 1980, 2050 }; //EN Year of birth