Skip to contents

Function for creating a projection object used in the MRC projection model. Users can specify several parameters controlling the projection setup, inclusion of migration and switching processes, and assumptions regarding fertility differentials.

Usage

create_projection_object(
  name,
  country_object_list,
  region_object_list,
  steps = 10,
  migration = TRUE,
  switching = TRUE,
  switching_type = 1,
  no_diff = FALSE,
  post_switch = FALSE,
  light_migration = TRUE,
  light_switching = TRUE
)

Arguments

name

Character; name of the projection scenario - required.

country_object_list

List; country objects created by `create_country_list()`. If omitted or not a list, `create_country_list(post_switch = post_switch)` is called automatically. The same list cannot be reused across multiple projections (no default - auto-created if missing).

region_object_list

List; region objects created by `create_region_list()`. If omitted or not a list, `create_region_list()` is called automatically. Modify only if you are fully familiar with the internal structure of the package (no default - auto-created if missing).

steps

Numeric; number of 5-year projection periods to simulate (default 10).

migration

Logical; whether migration (emigration and immigration) is included in the projection (default TRUE).

switching

Logical; whether religious switching is included in the projection (default TRUE).

switching_type

Numeric; sequence of switching relative to demographic processes. Available options: 1 - The population is divided into two groups. For the first group, switching rates are applied at the beginning of the period (before demographic processes); for the second group, switching occurs at the end of the period (after demographic processes). 2 - Switching is applied entirely at the beginning of the period, before demographic processes. (Default = 1).

no_diff

Logical; if TRUE, fertility differentials by religion are ignored and all religions use the total ASFR (default FALSE - differentials are applied).

post_switch

Logical; controls how religious switching is tracked across periods. If FALSE (default), individuals who have switched religion remain in the general population and may switch again in subsequent steps. If TRUE, those who have switched are moved into separate post-switch columns and excluded from further switching. Also forwarded to `create_country_list()` when called automatically.

light_migration

Logical; if TRUE, migration output is stored in abbreviated form to reduce memory usage. Recommended when running multiple projections (default TRUE).

light_switching

Logical; if TRUE, switching output is stored in abbreviated form to reduce memory usage. Recommended when running multiple projections (default TRUE).

Value

A single projection object

See also

create_country_list to create the required country list, variants_loader to validate this object before projecting, project to run the projection, save_csv_all and save_plots_all to export results. vignette("conducting-projections") for a full walkthrough.

Examples

test_po <- create_projection_object(name = "test", steps = 5)
#> 

#> Loading Australia [==>------------------------------------------------------------------------------------] ETA  6s   3%
#> 

#> Loading Austria [===>-------------------------------------------------------------------------------------] ETA  6s   4%
#> 

#> Loading Bahamas [===>-------------------------------------------------------------------------------------] ETA  7s   4%
#> 

#> Loading Bahrain [===>-------------------------------------------------------------------------------------] ETA  6s   5%
#> 

#> Loading Bangladesh [====>---------------------------------------------------------------------------------] ETA  6s   5%
#> 

#> Loading Armenia [====>------------------------------------------------------------------------------------] ETA  6s   6%
#> 

#> Loading Barbados [=====>----------------------------------------------------------------------------------] ETA  7s   6%
#> 

#> Loading Belgium [=====>-----------------------------------------------------------------------------------] ETA  7s   7%
#> 

#> Loading Bhutan [======>-----------------------------------------------------------------------------------] ETA  7s   7%
#> 

#> Loading Bolivia [======>----------------------------------------------------------------------------------] ETA  7s   8%
#> 

#> Loading Bosnia and Herzegovina [=====>--------------------------------------------------------------------] ETA  7s   8%
#> 

#> Loading Botswana [=======>--------------------------------------------------------------------------------] ETA  7s   9%
#> 

#> Loading Brazil [========>---------------------------------------------------------------------------------] ETA  8s   9%
#> 

#> Loading Belize [========>---------------------------------------------------------------------------------] ETA  8s  10%
#> 

#> Loading Solomon Islands [=======>-------------------------------------------------------------------------] ETA  8s  10%
#> 

#> Loading Brunei [=========>--------------------------------------------------------------------------------] ETA  8s  11%
#> 

#> Loading Bulgaria [=========>------------------------------------------------------------------------------] ETA  7s  11%
#> 

#> Loading Myanmar [==========>------------------------------------------------------------------------------] ETA  7s  12%
#> 

#> Loading Burundi [==========>------------------------------------------------------------------------------] ETA  8s  12%
#> 

#> Loading Belarus [===========>-----------------------------------------------------------------------------] ETA  8s  13%
#> 

#> Loading Cambodia [===========>----------------------------------------------------------------------------] ETA  8s  13%
#> 

#> Loading Cameroon [===========>----------------------------------------------------------------------------] ETA  7s  14%
#> 

#> Loading Canada [============>-----------------------------------------------------------------------------] ETA  7s  14%
#> 

#> Loading Cape Verde [============>-------------------------------------------------------------------------] ETA  8s  15%
#> 

#> Loading Central African Republic [==========>-------------------------------------------------------------] ETA  8s  15%
#> 

#> Loading Sri Lanka [=============>-------------------------------------------------------------------------] ETA  7s  16%
#> 

#> Loading Chad [==============>-----------------------------------------------------------------------------] ETA  7s  16%
#> 

#> Loading Chile [==============>----------------------------------------------------------------------------] ETA  7s  17%
#> 

#> Loading China [===============>---------------------------------------------------------------------------] ETA  7s  17%
#> 

#> Loading China,  Taiwan Province of China [==========>-----------------------------------------------------] ETA  7s  18%
#> 

#> Loading Colombia [===============>------------------------------------------------------------------------] ETA  7s  18%
#> 

#> Loading Comoros [================>------------------------------------------------------------------------] ETA  7s  19%
#> 

#> Loading Mayotte [================>------------------------------------------------------------------------] ETA  7s  19%
#> 

#> Loading Congo [=================>-------------------------------------------------------------------------] ETA  7s  20%
#> 

#> Loading Congo,  Dem. Rep. [===============>---------------------------------------------------------------] ETA  7s  20%
#> 

#> Loading Costa Rica [=================>--------------------------------------------------------------------] ETA  7s  21%
#> 

#> Loading Croatia [==================>----------------------------------------------------------------------] ETA  7s  21%
#> 

#> Loading Cuba [===================>------------------------------------------------------------------------] ETA  7s  22%
#> 

#> Loading Cyprus [===================>----------------------------------------------------------------------] ETA  7s  22%
#> 

#> Loading Czechia [===================>---------------------------------------------------------------------] ETA  7s  23%
#> 

#> Loading Benin [====================>----------------------------------------------------------------------] ETA  7s  23%
#> 

#> Loading Denmark [====================>--------------------------------------------------------------------] ETA  7s  24%
#> 

#> Loading Dominican Republic [==================>-----------------------------------------------------------] ETA  7s  24%
#> 

#> Loading Ecuador [=====================>-------------------------------------------------------------------] ETA  7s  25%
#> 

#> Loading El Salvador [=====================>---------------------------------------------------------------] ETA  7s  25%
#> 

#> Loading Equatorial Guinea [===================>-----------------------------------------------------------] ETA  7s  26%
#> 

#> Loading Ethiopia [======================>-----------------------------------------------------------------] ETA  7s  26%
#> 

#> Loading Eritrea [=======================>-----------------------------------------------------------------] ETA  7s  27%
#> 

#> Loading Estonia [=======================>-----------------------------------------------------------------] ETA  6s  27%
#> 

#> Loading Fiji [=========================>------------------------------------------------------------------] ETA  6s  28%
#> 

#> Loading Finland [========================>----------------------------------------------------------------] ETA  6s  28%
#> 

#> Loading France [=========================>----------------------------------------------------------------] ETA  6s  29%
#> 

#> Loading French Guiana [=======================>-----------------------------------------------------------] ETA  6s  29%
#> 

#> Loading French Polynesia [=======================>--------------------------------------------------------] ETA  6s  30%
#> 

#> Loading Djibouti [==========================>-------------------------------------------------------------] ETA  6s  30%
#> 

#> Loading Gabon [===========================>---------------------------------------------------------------] ETA  6s  31%
#> 

#> Loading Georgia [===========================>-------------------------------------------------------------] ETA  6s  31%
#> 

#> Loading Gambia [============================>-------------------------------------------------------------] ETA  6s  32%
#> 

#> Loading Palestine [===========================>-----------------------------------------------------------] ETA  6s  32%
#> 

#> Loading Germany [============================>------------------------------------------------------------] ETA  6s  33%
#> 

#> Loading Ghana [=============================>-------------------------------------------------------------] ETA  6s  33%
#> 

#> Loading Kiribati [=============================>----------------------------------------------------------] ETA  6s  34%
#> 

#> Loading Greece [==============================>-----------------------------------------------------------] ETA  6s  34%
#> 

#> Loading Grenada [==============================>----------------------------------------------------------] ETA  6s  35%
#> 

#> Loading Guadeloupe [=============================>--------------------------------------------------------] ETA  6s  35%
#> 

#> Loading Guam [================================>-----------------------------------------------------------] ETA  6s  36%
#> 

#> Loading Guatemala [===============================>-------------------------------------------------------] ETA  6s  36%
#> 

#> Loading Guinea [================================>---------------------------------------------------------] ETA  6s  37%
#> 

#> Loading Guyana [=================================>--------------------------------------------------------] ETA  6s  37%
#> 

#> Loading Haiti [=================================>---------------------------------------------------------] ETA  6s  38%
#> 

#> Loading Honduras [=================================>------------------------------------------------------] ETA  6s  38%
#> 

#> Loading China,  Hong Kong SAR [============================>----------------------------------------------] ETA  6s  39%
#> 

#> Loading Hungary [==================================>------------------------------------------------------] ETA  6s  39%
#> 

#> Loading Iceland [==================================>------------------------------------------------------] ETA  6s  40%
#> 

#> Loading India [====================================>------------------------------------------------------] ETA  6s  40%
#> 

#> Loading Indonesia [==================================>----------------------------------------------------] ETA  6s  41%
#> 

#> Loading Iran [=====================================>------------------------------------------------------] ETA  6s  41%
#> 

#> Loading Iraq [=====================================>------------------------------------------------------] ETA  6s  42%
#> 

#> Loading Ireland [=====================================>---------------------------------------------------] ETA  6s  42%
#> 

#> Loading Israel [======================================>---------------------------------------------------] ETA  6s  43%
#> 

#> Loading Italy [======================================>----------------------------------------------------] ETA  6s  43%
#> 

#> Loading Ivory Coast [====================================>------------------------------------------------] ETA  6s  44%
#> 

#> Loading Jamaica [======================================>--------------------------------------------------] ETA  5s  44%
#> 

#> Loading Japan [========================================>--------------------------------------------------] ETA  5s  45%
#> 

#> Loading Kazakhstan [======================================>-----------------------------------------------] ETA  5s  45%
#> 

#> Loading Jordan [========================================>-------------------------------------------------] ETA  5s  46%
#> 

#> Loading Kenya [=========================================>-------------------------------------------------] ETA  5s  46%
#> 

#> Loading North Korea [=======================================>---------------------------------------------] ETA  5s  47%
#> 

#> Loading Republic of Korea [====================================>------------------------------------------] ETA  5s  47%
#> 

#> Loading Kosovo [==========================================>-----------------------------------------------] ETA  5s  48%
#> 

#> Loading Kuwait [==========================================>-----------------------------------------------] ETA  5s  48%
#> 

#> Loading Kyrgyzstan [=========================================>--------------------------------------------] ETA  5s  49%
#> 

#> Loading Laos [============================================>-----------------------------------------------] ETA  5s  49%
#> 

#> Loading Lebanon [===========================================>---------------------------------------------] ETA  5s  50%
#> 

#> Loading Lesotho [============================================>--------------------------------------------] ETA  5s  50%
#> 

#> Loading Latvia [=============================================>--------------------------------------------] ETA  5s  51%
#> 

#> Loading Liberia [=============================================>-------------------------------------------] ETA  5s  51%
#> 

#> Loading Libya [==============================================>--------------------------------------------] ETA  5s  52%
#> 

#> Loading Lithuania [============================================>------------------------------------------] ETA  5s  52%
#> 

#> Loading Luxembourg [============================================>-----------------------------------------] ETA  5s  53%
#> 

#> Loading Macao [===============================================>-------------------------------------------] ETA  4s  53%
#> 

#> Loading Madagascar [=============================================>----------------------------------------] ETA  4s  54%
#> 

#> Loading Malawi [================================================>-----------------------------------------] ETA  4s  54%
#> 

#> Loading Malaysia [===============================================>----------------------------------------] ETA  4s  55%
#> 

#> Loading Maldives [================================================>---------------------------------------] ETA  4s  55%
#> 

#> Loading Mali [==================================================>-----------------------------------------] ETA  4s  56%
#> 

#> Loading Malta [==================================================>----------------------------------------] ETA  4s  56%
#> 

#> Loading Martinique [================================================>-------------------------------------] ETA  4s  57%
#> 

#> Loading Mauritania [================================================>-------------------------------------] ETA  4s  57%
#> 

#> Loading Mauritius [=================================================>-------------------------------------] ETA  4s  58%
#> 

#> Loading Mexico [===================================================>--------------------------------------] ETA  4s  58%
#> 

#> Loading Mongolia [===================================================>------------------------------------] ETA  4s  59%
#> 

#> Loading Moldova [====================================================>------------------------------------] ETA  4s  59%
#> 

#> Loading Montenegro [==================================================>-----------------------------------] ETA  4s  60%
#> 

#> Loading Morocco [=====================================================>-----------------------------------] ETA  4s  60%
#> 

#> Loading Mozambique [===================================================>----------------------------------] ETA  4s  61%
#> 

#> Loading Oman [=======================================================>------------------------------------] ETA  4s  61%
#> 

#> Loading Namibia [======================================================>----------------------------------] ETA  4s  62%
#> 

#> Loading Nepal [========================================================>----------------------------------] ETA  4s  62%
#> 

#> Loading Netherlands [====================================================>--------------------------------] ETA  3s  63%
#> 

#> Loading Curacao [=======================================================>---------------------------------] ETA  3s  63%
#> 

#> Loading Aruba [=========================================================>---------------------------------] ETA  3s  64%
#> 

#> Loading New Caledonia [====================================================>------------------------------] ETA  3s  64%
#> 

#> Loading Vanuatu [=========================================================>-------------------------------] ETA  3s  65%
#> 

#> Loading New Zealand [======================================================>------------------------------] ETA  3s  65%
#> 

#> Loading Nicaragua [========================================================>------------------------------] ETA  3s  66%
#> 

#> Loading Niger [===========================================================>-------------------------------] ETA  3s  66%
#> 

#> Loading Nigeria [==========================================================>------------------------------] ETA  3s  67%
#> 

#> Loading Norway [===========================================================>------------------------------] ETA  3s  67%
#> 

#> Loading Micronesia [=========================================================>----------------------------] ETA  3s  68%
#> 

#> Loading Pakistan [===========================================================>----------------------------] ETA  3s  68%
#> 

#> Loading Panama [=============================================================>----------------------------] ETA  3s  69%
#> 

#> Loading Papua New Guinea [======================================================>-------------------------] ETA  3s  69%
#> 

#> Loading Paraguay [============================================================>---------------------------] ETA  3s  70%
#> 

#> Loading Peru [================================================================>---------------------------] ETA  3s  70%
#> 

#> Loading Philippines [===========================================================>-------------------------] ETA  3s  71%
#> 

#> Loading Poland [===============================================================>--------------------------] ETA  3s  71%
#> 

#> Loading Portugal [==============================================================>-------------------------] ETA  3s  72%
#> 

#> Loading Guinea-Bissau [===========================================================>-----------------------] ETA  3s  72%
#> 

#> Loading East Timor [=============================================================>------------------------] ETA  2s  73%
#> 

#> Loading Puerto Rico [=============================================================>-----------------------] ETA  2s  73%
#> 

#> Loading Qatar [==================================================================>------------------------] ETA  2s  74%
#> 

#> Loading Réunion [=================================================================>-----------------------] ETA  2s  74%
#> 

#> Loading Romania [=================================================================>-----------------------] ETA  2s  75%
#> 

#> Loading Russia [===================================================================>----------------------] ETA  2s  75%
#> 

#> Loading Rwanda [===================================================================>----------------------] ETA  2s  76%
#> 

#> Loading St. Lucia [=================================================================>---------------------] ETA  2s  76%
#> 

#> Loading Saint Vincent and the Grenadines [================================================>---------------] ETA  2s  77%
#> 

#> Loading Sao Tome & Principe [==========================================================>------------------] ETA  2s  77%
#> 

#> Loading Saudi Arabia [================================================================>-------------------] ETA  2s  78%
#> 

#> Loading Senegal [=====================================================================>-------------------] ETA  2s  78%
#> 

#> Loading Serbia [======================================================================>-------------------] ETA  2s  79%
#> 

#> Loading Seychelles [===================================================================>------------------] ETA  2s  79%
#> 

#> Loading Sierra Leone [==================================================================>-----------------] ETA  2s  80%
#> 

#> Loading Singapore [=====================================================================>-----------------] ETA  2s  80%
#> 

#> Loading Slovakia [======================================================================>-----------------] ETA  2s  81%
#> 

#> Loading Viet Nam [======================================================================>-----------------] ETA  2s  81%
#> 

#> Loading Slovenia [=======================================================================>----------------] ETA  2s  82%
#> 

#> Loading Somalia [========================================================================>----------------] ETA  2s  82%
#> 

#> Loading South Africa [====================================================================>---------------] ETA  2s  83%
#> 

#> Loading Zimbabwe [========================================================================>---------------] ETA  2s  83%
#> 

#> Loading Spain [===========================================================================>---------------] ETA  1s  84%
#> 

#> Loading South Sudan [======================================================================>--------------] ETA  1s  84%
#> 

#> Loading Sudan [============================================================================>--------------] ETA  1s  85%
#> 

#> Loading Western Sahara [=====================================================================>------------] ETA  1s  85%
#> 

#> Loading Suriname [==========================================================================>-------------] ETA  1s  86%
#> 

#> Loading Eswatini [===========================================================================>------------] ETA  1s  86%
#> 

#> Loading Sweden [=============================================================================>------------] ETA  1s  87%
#> 

#> Loading Switzerland [=========================================================================>-----------] ETA  1s  87%
#> 

#> Loading Syria [===============================================================================>-----------] ETA  1s  88%
#> 

#> Loading Tajikistan [===========================================================================>----------] ETA  1s  88%
#> 

#> Loading Thailand [=============================================================================>----------] ETA  1s  89%
#> 

#> Loading Togo [=================================================================================>----------] ETA  1s  89%
#> 

#> Loading Tonga [================================================================================>----------] ETA  1s  90%
#> 

#> Loading Trinidad & Tobago [======================================================================>--------] ETA  1s  90%
#> 

#> Loading United Arab Emirates [====================================================================>-------] ETA  1s  91%
#> 

#> Loading Tunisia [================================================================================>--------] ETA  1s  91%
#> 

#> Loading Türkiye [================================================================================>--------] ETA  1s  92%
#> 

#> Loading Turkmenistan [============================================================================>-------] ETA  1s  92%
#> 

#> Loading Uganda [==================================================================================>-------] ETA  1s  93%
#> 

#> Loading Ukraine [==================================================================================>------] ETA  1s  93%
#> 

#> Loading North Macedonia [===========================================================================>-----] ETA  1s  94%
#> 

#> Loading Egypt [=====================================================================================>-----] ETA  1s  94%
#> 

#> Loading United Kingdom [=============================================================================>----] ETA  0s  95%
#> 

#> Loading Channel Islands [============================================================================>----] ETA  0s  95%
#> 

#> Loading Tanzania [===================================================================================>----] ETA  0s  96%
#> 

#> Loading USA [========================================================================================>----] ETA  0s  96%
#> 

#> Loading U.S. Virgin Islands [=========================================================================>---] ETA  0s  97%
#> 

#> Loading Burkina Faso [================================================================================>---] ETA  0s  97%
#> 

#> Loading Uruguay [======================================================================================>--] ETA  0s  98%
#> 

#> Loading Uzbekistan [===================================================================================>--] ETA  0s  98%
#> 

#> Loading Venezuela [=====================================================================================>-] ETA  0s  99%
#> 

#> Loading Samoa [=========================================================================================>-] ETA  0s  99%
#> 

#> Loading Yemen [==========================================================================================>] ETA  0s 100%
#> 

#> Loading Zambia [==========================================================================================] ETA  0s 100%
#> 
#> [1] "Global starting parameters:"
#> [1] "Migration: TRUE"
#> [1] "Light migration: TRUE"
#> [1] "Switching: TRUE"
#> [1] "Light switching: TRUE"
#> [1] "Switching type: split"
#> [1] "Steps: 5"
#> [1] "No fertility differentials: FALSE"
#> [1] "Post switch separation: FALSE"