Reference Class representing a country as Country_object
Source:R/class_base.R
Country_object-class.RdObject representing demographic and model-specific information for a single country used in the MRC projection framework.
Each country object contains demographic inputs and parameters that define fertility, mortality, migration, and religious switching dynamics, as well as country-specific settings used for scenario projections.
Details
Country_object stores initial and projected data, specific options and results of the MRC projection for each country.
Fields
yearNumeric; current projection year, advances by 5 at each step
periodCharacter; current five-year period label used in previous_* output tables (e.g. "2020-2025")
nameCharacter; name of the country
codeNumeric; ISO 3166-1 country code
regionCharacter; name of the region to which the country belongs
structure_dataList; population structure matrices indexed by year label. Before `project()` is called, contains only the starting period
mortality_ratesMatrix; age- and sex-specific survival rates for each projection period (rows = sex-age groups, cols = periods)
age_specific_fertility_ratesMatrix; total population ASFRs for each projection period (rows = periods, cols = age groups)
fertility_differentialsList; religion-specific fertility differential matrices indexed by period label (values are ratios relative to total ASFR)
sex_ratioNumeric vector; fraction of boys at birth for each projection period
switching_matrices_listList; decomposed switching probability matrices, one per origin religion
outmigration_ratesList; outmigration rate matrices by period (rows = sex-age groups, cols = religions)
destination_matrixMatrix; share of emigrants directed to each destination country, by sex and religion (rows = sex-religion combos, cols = destination country codes)
start_fertility_groupNumeric; index of the first age group included in fertility calculations (default 3, corresponding to 10-14)
combined_fertility_factorizationLogical; if TRUE (default), a single global factor is applied across all fertile age groups; if FALSE, each age group's fertility births are normalised independently to match the total ASFR for that age group
previous_mortalitydata.table; mortality output. Columns: Country, Country_code, Period, Sex (integer 1/2), Age_group, Structure, Region, then one column per religion
previous_fertilitydata.table; fertility (births) output. Columns: Country, Country_code, Period, Mother_age_group, Structure, Region, Total, then one column per religion
previous_asfrdata.table; age-specific fertility rate output. Columns: Country, Country_code, Period, Mother_age_group, Structure, Region, Total (realised rate: births / exposure), then one column per religion; rows with Mother_age_group == "TFR" contain period totals. Religion columns of individual structures hold the applied rates and are reported even without exposure; Total and the "total" structure hold realised rates and are 0 where exposure is 0 (except *_post_switch columns, which show the mean applied rate)
previous_fertility_exposuredata.table; women-population exposure used in ASFR calculation. Columns: Country, Country_code, Period, Mother_age_group, Structure, Region, Total, then one column per religion
old_fertility_factorsMatrix; scaling factors applied to births to reconcile religion-specific fertility with total ASFR; one row per age group, one column per period
previous_switchingdata.table; switching output. Columns: Country, Country_code, Period, Origin_religion, Region (light mode) or additionally Sex, Age_group, Structure (full mode), then one column per destination religion
previous_immigrationdata.table; immigration output. Columns: Destination, Country_code, Period, Structure, Origin, Region (light mode) or additionally Sex, Age_group (full mode), then one column per religion
previous_emigrationdata.table; emigration output. Columns: Origin, Country_code, Period, Structure, Destination, Region (light mode) or additionally Sex, Age_group (full mode), then one column per religion
migration_listList; internal buffer accumulating immigration flows during a projection step
emigration_listList; internal buffer accumulating emigration flows during a projection step
migrant_sumMatrix; running total of emigrant counts by religion used to balance destination shares within a step
tempList; internal scratch space used during projection calculations; not intended for direct access
projection_ownerCharacter; name of the Projection_object that has claimed this country object. Empty string (`""`) if unclaimed. Prevents the same country list from being reused across multiple projections
Examples
if (FALSE) { # \dontrun{
obj <- test_object_generator(object_name = "example")
# Access a country object by its c-prefixed ISO key
co <- obj$country_object_list[["c840"]]
co$name # "USA"
co$code # 840
dim(co$structure_data[[1]]) # 40 x 7
} # }